MCPcopy
hub / github.com/CadQuery/cadquery / ParallelDirSelector

Class ParallelDirSelector

cadquery/selectors.py:192–212  ·  view source on GitHub ↗

r""" Selects objects parallel 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(ParallelDirSelector((0, 0, 1)))

Source from the content-addressed store, hash-verified

190
191
192class ParallelDirSelector(BaseDirSelector):
193 r"""
194 Selects objects parallel with the provided direction.
195
196 Applicability:
197 Linear Edges
198 Planar Faces
199
200 Use the string syntax shortcut \|(X|Y|Z) if you want to select based on a cardinal direction.
201
202 Example::
203
204 CQ(aCube).faces(ParallelDirSelector((0, 0, 1)))
205
206 selects faces with the normal parallel to the z direction, and is equivalent to::
207
208 CQ(aCube).faces("|Z")
209 """
210
211 def test(self, vec: Vector) -> bool:
212 return self.direction.cross(vec).Length < self.tolerance
213
214
215class DirectionSelector(BaseDirSelector):

Callers 1

testBaseDirSelectorMethod · 0.85

Calls

no outgoing calls

Tested by 1

testBaseDirSelectorMethod · 0.68