+ def FindFreeBorders(self, ClosedOnly=True):
+ """
+ Returns all or only closed free borders
+
+ Returns:
+ list of SMESH.FreeBorder's
+ """
+
+ return self.editor.FindFreeBorders( ClosedOnly )
+
+ def FillHole(self, holeNodes, groupName=""):
+ """
+ Fill with 2D elements a hole defined by a SMESH.FreeBorder.
+
+ Parameters:
+ FreeBorder: either a SMESH.FreeBorder or a list on node IDs. These nodes
+ must describe all sequential nodes of the hole border. The first and the last
+ nodes must be the same. Use :meth:`FindFreeBorders` to get nodes of holes.
+ groupName (string): name of a group to add new faces
+ Returns:
+ a :class:`group <SMESH.SMESH_GroupBase>` containing the new faces; or :code:`None` if :option:`groupName` == ""
+ """
+
+
+ if holeNodes and isinstance( holeNodes, list ) and isinstance( holeNodes[0], int ):
+ holeNodes = SMESH.FreeBorder(nodeIDs=holeNodes)
+ if not isinstance( holeNodes, SMESH.FreeBorder ):
+ raise TypeError("holeNodes must be either SMESH.FreeBorder or list of integer and not %s" % holeNodes)
+ self.editor.FillHole( holeNodes, groupName )
+
+ def FindCoincidentFreeBorders (self, tolerance=0.):
+ """
+ Return groups of FreeBorder's coincident within the given tolerance.
+
+ Parameters:
+ tolerance: the tolerance. If the tolerance <= 0.0 then one tenth of an average
+ size of elements adjacent to free borders being compared is used.
+
+ Returns:
+ SMESH.CoincidentFreeBorders structure
+ """
+
+ return self.editor.FindCoincidentFreeBorders( tolerance )
+
+ def SewCoincidentFreeBorders (self, freeBorders, createPolygons=False, createPolyhedra=False):
+ """
+ Sew FreeBorder's of each group
+
+ Parameters:
+ freeBorders: either a SMESH.CoincidentFreeBorders structure or a list of lists
+ where each enclosed list contains node IDs of a group of coincident free
+ borders such that each consequent triple of IDs within a group describes
+ a free border in a usual way: n1, n2, nLast - i.e. 1st node, 2nd node and
+ last node of a border.
+ For example [[1, 2, 10, 20, 21, 40], [11, 12, 15, 55, 54, 41]] describes two
+ groups of coincident free borders, each group including two borders.
+ createPolygons: if :code:`True` faces adjacent to free borders are converted to
+ polygons if a node of opposite border falls on a face edge, else such
+ faces are split into several ones.
+ createPolyhedra: if :code:`True` volumes adjacent to free borders are converted to
+ polyhedra if a node of opposite border falls on a volume edge, else such
+ volumes, if any, remain intact and the mesh becomes non-conformal.
+
+ Returns:
+ a number of successfully sewed groups
+ """
+
+ if freeBorders and isinstance( freeBorders, list ):
+ # construct SMESH.CoincidentFreeBorders
+ if isinstance( freeBorders[0], int ):
+ freeBorders = [freeBorders]
+ borders = []
+ coincidentGroups = []
+ for nodeList in freeBorders:
+ if not nodeList or len( nodeList ) % 3:
+ raise ValueError("Wrong number of nodes in this group: %s" % nodeList)
+ group = []
+ while nodeList:
+ group.append ( SMESH.FreeBorderPart( len(borders), 0, 1, 2 ))
+ borders.append( SMESH.FreeBorder( nodeList[:3] ))
+ nodeList = nodeList[3:]
+ pass
+ coincidentGroups.append( group )
+ pass
+ freeBorders = SMESH.CoincidentFreeBorders( borders, coincidentGroups )
+
+ return self.editor.SewCoincidentFreeBorders( freeBorders, createPolygons, createPolyhedra )
+