Skip to content

Commit 7d8aa1c

Browse files
New selector fixes
1 parent 02a087d commit 7d8aa1c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cadquery/occ_impl/shape_protocols.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def Area(self) -> float:
7676
def BoundingBox(self, tolerance: Optional[float] = None) -> BoundBox:
7777
...
7878

79+
def distance(self, other, tol: float = 1e-6) -> float:
80+
...
81+
7982

8083
class Shape1DProtocol(ShapeProtocol, Protocol):
8184
def tangentAt(

cadquery/selectors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __init__(self, s: Shape):
9999

100100
def filter(self, objectList: Sequence[Shape]):
101101

102-
return [min(objectList, key=lambda el: self.s.distance(el))]
102+
return [min(objectList, key=lambda el: self.shape.distance(el))]
103103

104104

105105
class BoxSelector(Selector):
@@ -888,7 +888,7 @@ def filter(self, objectList: Sequence[Shape]):
888888
return self.mySelector.filter(objectList)
889889

890890

891-
#%% Aliases
891+
# %% Aliases
892892

893893
NearestToPoint = NearestToPointSelector
894894
NearestToShape = NearestToShapeSelector

0 commit comments

Comments
 (0)