def _make_solid(shells): if not isinstance(shells, (list, tuple)): shells = [shells] algo = BRepBuilderAPI_MakeSolid() for s in shells: algo.Add(s.Shell()) fixer = ShapeFix_Solid(algo.Solid()) fixer.Perform() return Shape(fixer.Solid())
def fix_close_solid(occsolid): """ This function fixes an OCCsolid by making sure all the OCCfaces in the solid have an outward orientation. Parameters ---------- occsolid : OCCsolid The OCCsolid to be fixed. Returns ------- fixed solid : OCCsolid The fixed OCCsolid. If None it means the solid is not fixed. """ shape_fix = ShapeFix_Solid(occsolid) shape_fix.Perform() fix_solid = shape_fix.Solid() fix_solid_list = fetch.topo_explorer(fix_solid, "solid") if not fix_solid_list: return None else: fix_solid = fix_solid_list[0] breplib.OrientClosedSolid(fix_solid) return fix_solid
def _shapefix_solid(shp): algo2 = ShapeFix_Solid(shp.Shape()) algo2.Perform() return Shape(algo2.Solid())