(self, l_shells, filename, tol)
Method to recreate a TopoDS_Shape associated to a geometric shape
        after the modification of points of each Face. It
        returns a TopoDS_Shape (Shape).

        :param l_shells: the list of shells after initial parsing
        :param filename: the output filename
        :param tol: tolerance on the surface creation after modification
        :return: None
Method to recreate a TopoDS_Shape associated to a geometric shape
        after the modification of points of each Face. It
        returns a TopoDS_Shape (Shape).
Method to recreate a TopoDS_Shape associated to a geometric shape after the modification of points of each Face . It returns a TopoDS_Shape ( Shape ) .
def write_shape(self, l_shells, filename, tol):
        """
        Method to recreate a TopoDS_Shape associated to a geometric shape
        after the modification of points of each Face. It
        returns a TopoDS_Shape (Shape).

        :param l_shells: the list of shells after initial parsing
        :param filename: the output filename
        :param tol: tolerance on the surface creation after modification
        :return: None

        """
        self.outfile = filename
        # global compound containing multiple shells
        global_compound_builder = BRep_Builder()
        global_comp = TopoDS_Compound()
        global_compound_builder.MakeCompound(global_comp)

        if self.check_topo == 0:
            # cycle on shells (multiple objects)
            shape_shells_explorer = TopExp_Explorer(
                self.shape.Oriented(TopAbs_FORWARD), TopAbs_SHELL)
            ishell = 0

            while shape_shells_explorer.More():
                per_shell = topods_Shell(shape_shells_explorer.Current())
                # a local compound containing a shell
                compound_builder = BRep_Builder()
                comp = TopoDS_Compound()
                compound_builder.MakeCompound(comp)

                # cycle on faces
                faces_explorer = TopExp_Explorer(
                    per_shell.Oriented(TopAbs_FORWARD), TopAbs_FACE)
                iface = 0
                while faces_explorer.More():
                    topoface = topods.Face(faces_explorer.Current())
                    newface = self.write_face(l_shells[ishell][iface][0],
                                              l_shells[ishell][iface][1],
                                              topoface, tol)

                    # add face to compound
                    compound_builder.Add(comp, newface)
                    iface += 1
                    faces_explorer.Next()

                new_shell = self.combine_faces(comp, 0.01)
                itype = TopoDS_Shape.ShapeType(new_shell)
                # add the new shell to the global compound
                global_compound_builder.Add(global_comp, new_shell)

                # TODO
                #print("Shell {0} of type {1} Processed ".format(ishell, itype))
                #print "=============================================="

                ishell += 1
                shape_shells_explorer.Next()

        else:
            # cycle on faces
            # a local compound containing a shell
            compound_builder = BRep_Builder()
            comp = TopoDS_Compound()
            compound_builder.MakeCompound(comp)

            # cycle on faces
            faces_explorer = TopExp_Explorer(
                self.shape.Oriented(TopAbs_FORWARD), TopAbs_FACE)
            iface = 0
            while faces_explorer.More():
                topoface = topods.Face(faces_explorer.Current())
                newface = self.write_face(l_shells[0][iface][0],
                                          l_shells[0][iface][1], topoface, tol)

                # add face to compound
                compound_builder.Add(comp, newface)
                iface += 1
                faces_explorer.Next()

            new_shell = self.combine_faces(comp, 0.01)
            itype = TopoDS_Shape.ShapeType(new_shell)
            # add the new shell to the global compound
            global_compound_builder.Add(global_comp, new_shell)

            # TODO print to logging
            # print("Shell {0} of type {1} Processed ".format(0, itype))
            # print "=============================================="

        self.write_shape_to_file(global_comp, self.outfile)
def write_shape ( self , l_shells , filename , tol ) : self . outfile = filename # global compound containing multiple shells global_compound_builder = BRep_Builder ( ) global_comp = TopoDS_Compound ( ) global_compound_builder . MakeCompound ( global_comp ) if self . check_topo == 0 : # cycle on shells (multiple objects) shape_shells_explorer = TopExp_Explorer ( self . shape . Oriented ( TopAbs_FORWARD ) , TopAbs_SHELL ) ishell = 0 while shape_shells_explorer . More ( ) : per_shell = topods_Shell ( shape_shells_explorer . Current ( ) ) # a local compound containing a shell compound_builder = BRep_Builder ( ) comp = TopoDS_Compound ( ) compound_builder . MakeCompound ( comp ) # cycle on faces faces_explorer = TopExp_Explorer ( per_shell . Oriented ( TopAbs_FORWARD ) , TopAbs_FACE ) iface = 0 while faces_explorer . More ( ) : topoface = topods . Face ( faces_explorer . Current ( ) ) newface = self . write_face ( l_shells [ ishell ] [ iface ] [ 0 ] , l_shells [ ishell ] [ iface ] [ 1 ] , topoface , tol ) # add face to compound compound_builder . Add ( comp , newface ) iface += 1 faces_explorer . Next ( ) new_shell = self . combine_faces ( comp , 0.01 ) itype = TopoDS_Shape . ShapeType ( new_shell ) # add the new shell to the global compound global_compound_builder . Add ( global_comp , new_shell ) # TODO #print("Shell {0} of type {1} Processed ".format(ishell, itype)) #print "==============================================" ishell += 1 shape_shells_explorer . Next ( ) else : # cycle on faces # a local compound containing a shell compound_builder = BRep_Builder ( ) comp = TopoDS_Compound ( ) compound_builder . MakeCompound ( comp ) # cycle on faces faces_explorer = TopExp_Explorer ( self . shape . Oriented ( TopAbs_FORWARD ) , TopAbs_FACE ) iface = 0 while faces_explorer . More ( ) : topoface = topods . Face ( faces_explorer . Current ( ) ) newface = self . write_face ( l_shells [ 0 ] [ iface ] [ 0 ] , l_shells [ 0 ] [ iface ] [ 1 ] , topoface , tol ) # add face to compound compound_builder . Add ( comp , newface ) iface += 1 faces_explorer . Next ( ) new_shell = self . combine_faces ( comp , 0.01 ) itype = TopoDS_Shape . ShapeType ( new_shell ) # add the new shell to the global compound global_compound_builder . Add ( global_comp , new_shell ) # TODO print to logging # print("Shell {0} of type {1} Processed ".format(0, itype)) # print "==============================================" self . write_shape_to_file ( global_comp , self . outfile )