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

Class TypeSelector

cadquery/selectors.py:262–288  ·  view source on GitHub ↗

Selects objects having the prescribed geometry type. Applicability: Faces: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE, REVOLUTION, EXTRUSION, OFFSET, OTHER Edges: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER, BSPLINE, OFFSET, OTHER You can use the stri

Source from the content-addressed store, hash-verified

260
261
262class TypeSelector(Selector):
263 """
264 Selects objects having the prescribed geometry type.
265
266 Applicability:
267 Faces: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE, REVOLUTION, EXTRUSION, OFFSET, OTHER
268 Edges: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER, BSPLINE, OFFSET, OTHER
269
270 You can use the string selector syntax. For example this::
271
272 CQ(aCube).faces(TypeSelector("PLANE"))
273
274 will select 6 faces, and is equivalent to::
275
276 CQ(aCube).faces("%PLANE")
277
278 """
279
280 def __init__(self, typeString: str):
281 self.typeString = typeString.upper()
282
283 def filter(self, objectList: Sequence[Shape]) -> List[Shape]:
284 r = []
285 for o in objectList:
286 if o.geomType() == self.typeString:
287 r.append(o)
288 return r
289
290
291class _NthSelector(Selector, ABC):

Callers 1

_chooseSelectorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected