예제 #1
0
 def _bounding_box(self, obj, tol=1e-5):
     bbox = Bnd_Box()
     if self.optimal:
         BRepTools.Clean_s(obj)
         BRepBndLib.AddOptimal_s(obj, bbox)
     else:
         BRepBndLib.Add_s(obj, bbox)
     values = bbox.Get()
     return (values[0], values[3], values[1], values[4], values[2], values[5])
예제 #2
0
 def _bounding_box(self, obj, tol=1e-6):
     bbox = Bnd_Box()
     if self.optimal:
         BRepTools.Clean_s(obj)
         BRepBndLib.AddOptimal_s(obj, bbox)
     else:
         BRepBndLib.Add_s(obj, bbox)
     if not bbox.IsVoid():
         values = bbox.Get()
         return (values[0], values[3], values[1], values[4], values[2],
                 values[5])
     else:
         c = self._center_of_mass(obj)
         bb = (c[0] - tol, c[0] + tol, c[1] - tol, c[1] + tol, c[2] - tol,
               c[2] + tol)
         print("\nVoid Bounding Box", bb)
         return bb
예제 #3
0
    def __init__(self, bb: Bnd_Box) -> None:
        self.wrapped = bb
        XMin, YMin, ZMin, XMax, YMax, ZMax = bb.Get()

        self.xmin = XMin
        self.xmax = XMax
        self.xlen = XMax - XMin
        self.ymin = YMin
        self.ymax = YMax
        self.ylen = YMax - YMin
        self.zmin = ZMin
        self.zmax = ZMax
        self.zlen = ZMax - ZMin

        self.center = Vector((XMax + XMin) / 2, (YMax + YMin) / 2,
                             (ZMax + ZMin) / 2)

        self.DiagonalLength = self.wrapped.SquareExtent()**0.5
예제 #4
0
 def _bounding_box(self, obj, tol=1e-5):
     bbox = Bnd_Box()
     BRepBndLib.AddOptimal_s(obj, bbox)
     values = bbox.Get()
     return (values[0], values[3], values[1], values[4], values[2],
             values[5])