Example #1
0
	def CreateShape(self):
		endcap1 = occprim.BRepPrimAPI_MakeSphere(gp_Pnt(0,0,0),self.radius).Shape()
		endcap2 = occprim.BRepPrimAPI_MakeSphere(gp_Pnt(0,0,self.length),self.radius).Shape()
		body = occprim.BRepPrimAPI_MakeCylinder(self.radius,self.length).Shape()
		self.occ_shape = occalgo.BRepAlgoAPI_Fuse(endcap1,body).Shape()
		self.occ_shape = occalgo.BRepAlgoAPI_Fuse(self.occ_shape,endcap2).Shape()
		T = gp_Trsf()
		T.SetTranslation(gp_Vec(0,0,-self.length/2))
		self.occ_shape = occbuild.BRepBuilderAPI_Transform(self.occ_shape,T,False).Shape()
		self.OrientShape()
Example #2
0
 def CreateShape(self):
     self.occ_shape = self.elements[0].occ_shape
     for s in self.elements:
         if s.occ_shape != self.occ_shape:
             self.occ_shape = occalgo.BRepAlgoAPI_Fuse(
                 self.occ_shape, s.occ_shape).Shape()
     self.OrientShape()
Example #3
0
def fuse_shapes(shapeList):
    s1 = shapeList[0]
    _builders = []
    for s2 in shapeList[1:]:
        fuse = BRepAlgoAPI.BRepAlgoAPI_Fuse(s1, s2)
        _builders.append(fuse)
        s1 = fuse.Shape()
    s1._builders = _builders
    return s1