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

Class DirectionSelector

cadquery/selectors.py:215–235  ·  view source on GitHub ↗

Selects objects aligned with the provided direction. Applicability: Linear Edges Planar Faces Use the string syntax shortcut +/-(X|Y|Z) if you want to select based on a cardinal direction. Example:: CQ(aCube).faces(DirectionSelector((0, 0, 1))) selec

Source from the content-addressed store, hash-verified

213
214
215class DirectionSelector(BaseDirSelector):
216 """
217 Selects objects aligned with the provided direction.
218
219 Applicability:
220 Linear Edges
221 Planar Faces
222
223 Use the string syntax shortcut +/-(X|Y|Z) if you want to select based on a cardinal direction.
224
225 Example::
226
227 CQ(aCube).faces(DirectionSelector((0, 0, 1)))
228
229 selects faces with the normal in the z direction, and is equivalent to::
230
231 CQ(aCube).faces("+Z")
232 """
233
234 def test(self, vec: Vector) -> bool:
235 return self.direction.getAngle(vec) < self.tolerance
236
237
238class PerpendicularDirSelector(BaseDirSelector):

Callers 2

__init__Method · 0.85
_chooseSelectorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected