예제 #1
0
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
예제 #2
0
    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()
예제 #3
0
 def testStandardBooleanByRefPassedReturned(self):
     '''
     Checks the Standard_Boolean & byreference return parameter
     '''
     sfw = ShapeFix_Wire()
     sfw.SetModifyGeometryMode(True)
     self.assertEqual(sfw.GetModifyGeometryMode(), True)
     sfw.SetModifyGeometryMode(False)
     self.assertEqual(sfw.GetModifyGeometryMode(), False)
예제 #4
0
 def testStandardBooleanByRefPassedReturned(self):
     '''
     Checks the Standard_Boolean & byreference return parameter
     '''
     print 'Test: Standard_Boolean & by reference transformator'
     from OCC.ShapeFix import ShapeFix_Wire
     sfw = ShapeFix_Wire()
     sfw.SetModifyGeometryMode(True)
     self.assertEqual(sfw.GetModifyGeometryMode(), True)
     sfw.SetModifyGeometryMode(False)
     self.assertEqual(sfw.GetModifyGeometryMode(), False)