def makeFromWires(cls, outerWire, innerWires=[]): ''' Makes a planar face from one or more wires ''' face_builder = BRepBuilderAPI_MakeFace(outerWire.wrapped, True) # True is for planar only for w in innerWires: face_builder.Add(w.wrapped) face_builder.Build() f = face_builder.Face() sf = ShapeFix_Face(f) # fix wire orientation sf.FixOrientation() return cls(sf.Face())
def fix_face(occ_face): """ This function fixes an OCCface. Parameters ---------- occface : OCCface The OCCface to be fixed. Returns ------- fixed face : OCCface The fixed OCCface. """ fix = ShapeFix_Face(occ_face) #fix.FixMissingSeam() fix.FixOrientation() fix.Perform() return fix.Face()
def fix_face(shp, tolerance=1e-3): fix = ShapeFix_Face(shp) fix.SetMaxTolerance(tolerance) fix.Perform() return fix.Face()