Exemplo n.º 1
0
    def combine_faces(compshape, sew_tolerance):
        """
        Method to combine faces in a shell by adding connectivity and continuity
        :param compshape: TopoDS_Shape
        :param sew_tolerance: tolerance for sewing
        :return: Topo_Shell
        """

        offsew = BRepOffsetAPI_FindContigousEdges(sew_tolerance)
        sew = BRepBuilderAPI_Sewing(sew_tolerance)

        face_explorers = TopExp_Explorer(compshape, TopAbs_FACE)
        n_faces = 0
        # cycle on Faces
        while face_explorers.More():
            tface = topods.Face(face_explorers.Current())
            sew.Add(tface)
            offsew.Add(tface)
            n_faces += 1
            face_explorers.Next()

        offsew.Perform()
        offsew.Dump()
        sew.Perform()
        shell = sew.SewedShape()
        sew.Dump()

        shell = topods.Shell(shell)
        shell_fixer = ShapeFix_Shell()
        shell_fixer.FixFaceOrientation(shell)

        if shell_fixer.Perform():
            print("{} shells fixed! ".format(shell_fixer.NbShells()))
        else:
            print "Shells not fixed! "

        new_shell = shell_fixer.Shell()

        if brepalgo_IsValid(new_shell):
            print "Shell valid! "
        else:
            print "Shell failed! "

        return new_shell
Exemplo n.º 2
0
def fix_shell_orientation(occshell):
    """
    This function fixes the OCCshell orientation. The fix will orientate all the OCCfaces in the shell towards the same direction.
 
    Parameters
    ----------        
    occshell : OCCshell
        The OCCshell to be fixed.
        
    Returns
    -------
    fixed shell : OCCshell
        The fixed OCCshell.
    """
    shapefix = ShapeFix_Shell(occshell)
    shapefix.FixFaceOrientation(occshell)
    shapefix.Perform()
    fix_shell = shapefix.Shell()
    return fix_shell
Exemplo n.º 3
0
def fix_shell_orientation(occshell):
    shapefix = ShapeFix_Shell(occshell)
    shapefix.FixFaceOrientation(occshell)
    shapefix.Perform()
    fix_shell = shapefix.Shell()
    return fix_shell