Skip to content

Commit

Permalink
More consistent handling of BoundaryBox tolerance (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus7070 authored Oct 24, 2020
1 parent 23b2a10 commit 5b5d8e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cadquery/occ_impl/geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def __init__(self, bb: Bnd_Box) -> None:
def add(
self,
obj: Union[Tuple[float, float, float], Vector, "BoundBox"],
tol: float = 1e-8,
tol: Optional[float] = None,
) -> "BoundBox":
"""Returns a modified (expanded) bounding box
Expand All @@ -777,6 +777,8 @@ def add(
This bounding box is not changed.
"""

tol = TOL if tol is None else tol # tol = TOL (by default)

tmp = Bnd_Box()
tmp.SetGap(tol)
tmp.Add(self.wrapped)
Expand Down
4 changes: 2 additions & 2 deletions cadquery/occ_impl/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ def Center(self) -> Vector:

return Shape.centerOfMass(self)

def CenterOfBoundBox(self, tolerance: float = 0.1) -> Vector:
return self.BoundingBox().center
def CenterOfBoundBox(self, tolerance: Optional[float] = None) -> Vector:
return self.BoundingBox(tolerance=tolerance).center

@staticmethod
def CombinedCenter(objects: Iterable["Shape"]) -> Vector:
Expand Down

0 comments on commit 5b5d8e0

Please sign in to comment.