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

Method add

cadquery/occ_impl/geom.py:905–934  ·  view source on GitHub ↗

Returns a modified (expanded) bounding box obj can be one of several things: 1. a 3-tuple corresponding to x,y, and z amounts to add 2. a vector, containing the x,y,z values to add 3. another bounding box, where a new box will be created that

(
        self,
        obj: Union[Tuple[float, float, float], Vector, "BoundBox"],
        tol: Optional[float] = None,
    )

Source from the content-addressed store, hash-verified

903 self.DiagonalLength = self.wrapped.SquareExtent() ** 0.5
904
905 def add(
906 self,
907 obj: Union[Tuple[float, float, float], Vector, "BoundBox"],
908 tol: Optional[float] = None,
909 ) -> "BoundBox":
910 """Returns a modified (expanded) bounding box
911
912 obj can be one of several things:
913 1. a 3-tuple corresponding to x,y, and z amounts to add
914 2. a vector, containing the x,y,z values to add
915 3. another bounding box, where a new box will be created that
916 encloses both.
917
918 This bounding box is not changed.
919 """
920
921 tol = TOL if tol is None else tol # tol = TOL (by default)
922
923 tmp = Bnd_Box()
924 tmp.SetGap(tol)
925 tmp.Add(self.wrapped)
926
927 if isinstance(obj, tuple):
928 tmp.Update(*obj)
929 elif isinstance(obj, Vector):
930 tmp.Update(*obj.toTuple())
931 elif isinstance(obj, BoundBox):
932 tmp.Add(obj.wrapped)
933
934 return BoundBox(tmp)
935
936 def enlarge(self, tol: float) -> "BoundBox":
937 """Returns a modified (expanded) bounding box, expanded in all

Callers

nothing calls this directly

Calls 3

BoundBoxClass · 0.85
UpdateMethod · 0.80
toTupleMethod · 0.45

Tested by

no test coverage detected