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

Class CenterNthSelector

cadquery/selectors.py:377–396  ·  view source on GitHub ↗

Sorts objects into a list with order determined by the distance of their center projected onto the specified direction. Applicability: All Shapes.

Source from the content-addressed store, hash-verified

375
376
377class CenterNthSelector(_NthSelector):
378 """
379 Sorts objects into a list with order determined by the distance of their center projected onto the specified direction.
380
381 Applicability:
382 All Shapes.
383 """
384
385 def __init__(
386 self,
387 vector: Vector,
388 n: int,
389 directionMax: bool = True,
390 tolerance: float = 0.0001,
391 ):
392 super().__init__(n, directionMax, tolerance)
393 self.direction = vector
394
395 def key(self, obj: Shape) -> float:
396 return obj.Center().dot(self.direction)
397
398
399class DirectionMinMaxSelector(CenterNthSelector):

Callers 1

_chooseSelectorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected