def fix_closed_wire(occwire, occface, tolerance=1e-06): """ This function will try to closed an open wire. Parameters ---------- occwire : OCCwire The OCCwire to be fixed. occface : OCCface The reference OCCface used for closing the OCCwire. tolerance : float, optional The precision for the fix, Default = 1e-06. Returns ------- fixed wire : OCCwire The fixed OCCwire. """ shapefix = ShapeFix_Wire(occwire, occface, tolerance) shapefix.FixClosed() shapefix.FixSmall(True) shapefix.FixDegenerated() shapefix.FixSelfIntersection() shapefix.FixReorder() shapefix.Perform() fix_wire = shapefix.Wire() return fix_wire
def validate(cls, wire, face, tol=1e-6): fix = ShapeFix_Wire(wire, face, tol) saw = ShapeAnalysis_Wire(wire, face, tol) if saw.CheckSmall(tol): print('found small') if saw.CheckOrder(): print('found order') fix.FixReorder() fix.Perform() if saw.CheckSelfIntersection(): print('found inters') # if saw.CheckS w = fix.Wire()