- 混合多个模型为一个模型
def fix_shape(*args):
if len(args) == 0:
return None
fix_shape = None
for shape in args:
if fix_shape == None:
fix_shape = shape
continue
fix_shape = BRepAlgoAPI_Fuse(fix_shape.Shape(), shape.Shape())
return fix_shape
- 判断是否为平面
def face_is_plane(face):
# 如果是平面,则返回True
hs = BRep_Tool_Surface(face)
downcast_result = Geom_Plane.DownCast(hs)
if downcast_result is None:
return False
else:
return True
- 挖空三维模型
# 挖空三维体,针对圆锥以及面在底部的图形
def scoop(shape, thickness):
faceToRemove = None
zMax = 1
aFaceExplorer = TopExp_Explorer(shape, TopAbs_FACE)
while aFaceExplorer.More():
aFace = topods.Face(aFaceExplorer.Current())
if face_is_plane(aFace):
aPla