MCPcopy Index your code
hub / github.com/CadQuery/cadquery / CQContext

Class CQContext

cadquery/cq.py:73–121  ·  view source on GitHub ↗

A shared context for modeling. All objects in the same CQ chain share a reference to this same object instance which allows for shared state when needed.

Source from the content-addressed store, hash-verified

71
72
73class CQContext(object):
74 """
75 A shared context for modeling.
76
77 All objects in the same CQ chain share a reference to this same object instance
78 which allows for shared state when needed.
79 """
80
81 pendingWires: List[Wire]
82 pendingEdges: List[Edge]
83 firstPoint: Optional[Vector]
84 tolerance: float
85 tags: Dict[str, "Workplane"]
86
87 def __init__(self):
88 self.pendingWires = (
89 []
90 ) # a list of wires that have been created and need to be extruded
91 # a list of created pending edges that need to be joined into wires
92 self.pendingEdges = []
93 # a reference to the first point for a set of edges.
94 # Used to determine how to behave when close() is called
95 self.firstPoint = None
96 self.tolerance = 0.0001 # user specified tolerance
97 self.tags = {}
98
99 def popPendingEdges(self, errorOnEmpty: bool = True) -> List[Edge]:
100 """
101 Get and clear pending edges.
102
103 :raises ValueError: if errorOnEmpty is True and no edges are present.
104 """
105 if errorOnEmpty and not self.pendingEdges:
106 raise ValueError("No pending edges present")
107 out = self.pendingEdges
108 self.pendingEdges = []
109 return out
110
111 def popPendingWires(self, errorOnEmpty: bool = True) -> List[Wire]:
112 """
113 Get and clear pending wires.
114
115 :raises ValueError: if errorOnEmpty is True and no wires are present.
116 """
117 if errorOnEmpty and not self.pendingWires:
118 raise ValueError("No pending wires present")
119 out = self.pendingWires
120 self.pendingWires = []
121 return out
122
123
124class Workplane(object):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected