X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_SWIG%2FsmeshBuilder.py;h=df65f685f28da4cca6393f06636cde752b8d74c9;hp=26332db27bb2578d9d632387de69fdf54881b496;hb=2c751a0eddb8c36cbd7582543d6b18d6a3e827e1;hpb=ecea056f6165eddf99403a8648657a9a573bcbe0 diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 26332db27..df65f685f 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -475,6 +475,24 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ): obj,name = name,obj return Mesh(self, self.geompyD, obj, name) + def RemoveMesh( self, mesh ): + """ + Delete a mesh + """ + if isinstance( mesh, Mesh ): + mesh = mesh.GetMesh() + pass + if not isinstance( mesh, SMESH._objref_SMESH_Mesh ): + raise TypeError("%s is not a mesh" % mesh ) + so = salome.ObjectToSObject( mesh ) + if so: + sb = salome.myStudy.NewBuilder() + sb.RemoveObjectWithChildren( so ) + else: + mesh.UnRegister() + pass + return + def EnumToLong(self,theItem): """ Return a long value from enumeration @@ -2054,7 +2072,14 @@ class Mesh(metaclass = MeshMeta): def SetMeshOrder(self, submeshes): """ - Set order in which concurrent sub-meshes should be meshed + Set priority of sub-meshes. It works in two ways: + + * For sub-meshes with assigned algorithms of same dimension generating mesh of + *several dimensions*, it sets the order in which the sub-meshes are computed. + * For the rest sub-meshes, it sets the order in which the sub-meshes are checked + when looking for meshing parameters to apply to a sub-shape. To impose the + order in which sub-meshes with uni-dimensional algorithms are computed, + call **submesh.Compute()** in a desired order. Parameters: submeshes: list of lists of :class:`sub-meshes ` @@ -2755,6 +2780,10 @@ class Mesh(metaclass = MeshMeta): Parameters: group (SMESH.SMESH_GroupBase): group to remove + + Note: + This operation can create gaps in numeration of nodes or elements. + Call :meth:`RenumberElements` to remove the gaps. """ self.mesh.RemoveGroupWithContents(group) @@ -3953,6 +3982,10 @@ class Mesh(metaclass = MeshMeta): Returns: True or False + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ return self.editor.RemoveElements(IDsOfElements) @@ -3966,6 +3999,10 @@ class Mesh(metaclass = MeshMeta): Returns: True or False + + Note: + This operation can create gaps in numeration of nodes. + Call :meth:`RenumberElements` to remove the gaps. """ return self.editor.RemoveNodes(IDsOfNodes) @@ -3976,6 +4013,10 @@ class Mesh(metaclass = MeshMeta): Returns: number of the removed nodes + + Note: + This operation can create gaps in numeration of nodes. + Call :meth:`RenumberElements` to remove the gaps. """ return self.editor.RemoveOrphanNodes() @@ -4451,6 +4492,10 @@ class Mesh(metaclass = MeshMeta): Returns: False if proper faces were not found + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ return self.editor.DeleteDiag(NodeID1, NodeID2) @@ -4581,6 +4626,10 @@ class Mesh(metaclass = MeshMeta): Returns: True in case of success, False otherwise. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ MaxAngle,Parameters,hasVars = ParseAngles(MaxAngle) @@ -4605,6 +4654,10 @@ class Mesh(metaclass = MeshMeta): Returns: True in case of success, False otherwise. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ MaxAngle,Parameters,hasVars = ParseAngles(MaxAngle) @@ -4628,6 +4681,10 @@ class Mesh(metaclass = MeshMeta): Returns: True in case of success, False otherwise. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -4651,6 +4708,10 @@ class Mesh(metaclass = MeshMeta): Returns: True in case of success, False otherwise. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -4668,6 +4729,10 @@ class Mesh(metaclass = MeshMeta): theElements: the faces to be splitted. This can be either :class:`mesh, sub-mesh, group, filter ` or a list of face IDs. By default all quadrangles are split + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ unRegister = genObjUnRegister() if isinstance( theElements, Mesh ): @@ -4689,6 +4754,10 @@ class Mesh(metaclass = MeshMeta): Returns: True in case of success, False otherwise. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -4705,6 +4774,10 @@ class Mesh(metaclass = MeshMeta): Returns: True in case of success, False otherwise. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -4725,6 +4798,10 @@ class Mesh(metaclass = MeshMeta): * 1 if 1-3 diagonal is better, * 2 if 2-4 diagonal is better, * 0 if error occurs. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ return self.editor.BestSplit(IDOfQuad, self.smeshpyD.GetFunctor(theCriterion)) @@ -4737,6 +4814,10 @@ class Mesh(metaclass = MeshMeta): method: flags passing splitting method: smesh.Hex_5Tet, smesh.Hex_6Tet, smesh.Hex_24Tet. smesh.Hex_5Tet - to split the hexahedron into 5 tetrahedrons, etc. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ unRegister = genObjUnRegister() if isinstance( elems, Mesh ): @@ -4761,6 +4842,10 @@ class Mesh(metaclass = MeshMeta): Parameters: elems: elements to split\: :class:`mesh, sub-mesh, group, filter ` or element IDs; if None (default), all bi-quadratic elements will be split + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ unRegister = genObjUnRegister() if elems and isinstance( elems, list ) and isinstance( elems[0], int ): @@ -4792,6 +4877,10 @@ class Mesh(metaclass = MeshMeta): allDomains: if :code:`False`, only hexahedra adjacent to one closest to *startHexPoint* are split, else *startHexPoint* is used to find the facet to split in all domains present in *elems*. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ # IDSource unRegister = genObjUnRegister() @@ -4821,6 +4910,10 @@ class Mesh(metaclass = MeshMeta): def SplitQuadsNearTriangularFacets(self): """ Split quadrangle faces near triangular facets of volumes + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ faces_array = self.GetElementsByType(SMESH.FACE) for face_id in faces_array: @@ -4865,6 +4958,10 @@ class Mesh(metaclass = MeshMeta): Returns: True in case of success, False otherwise. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ # Pattern: # 5.---------.6 @@ -4929,6 +5026,10 @@ class Mesh(metaclass = MeshMeta): Returns: True in case of success, False otherwise. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ # Pattern: 5.---------.6 # /|# /| @@ -5086,6 +5187,10 @@ class Mesh(metaclass = MeshMeta): Warning: If *theSubMesh* is provided, the mesh can become non-conformal + + Note: + This operation can create gaps in numeration of nodes or elements. + Call :meth:`RenumberElements` to remove the gaps. """ if isinstance( theSubMesh, Mesh ): @@ -5113,6 +5218,10 @@ class Mesh(metaclass = MeshMeta): Warning: If *theSubMesh* is provided, the mesh can become non-conformal + + Note: + This operation can create gaps in numeration of nodes or elements. + Call :meth:`RenumberElements` to remove the gaps. """ if theSubMesh: @@ -5486,6 +5595,8 @@ class Mesh(metaclass = MeshMeta): if isinstance( Elements, list ): if not Elements: raise RuntimeError("Elements empty!") + if isinstance( Elements[0], Mesh ): + Elements = [ Elements[0].GetMesh() ] if isinstance( Elements[0], int ): Elements = self.GetIDSource( Elements, SMESH.ALL ) unRegister.set( Elements ) @@ -6323,6 +6434,10 @@ class Mesh(metaclass = MeshMeta): then the first node in the group is kept. AvoidMakingHoles: prevent merging nodes which cause removal of elements becoming invalid + + Note: + This operation can create gaps in numeration of nodes or elements. + Call :meth:`RenumberElements` to remove the gaps. """ self.editor.MergeNodes( GroupsOfNodes, NodesToKeep, AvoidMakingHoles ) @@ -6372,6 +6487,10 @@ class Mesh(metaclass = MeshMeta): ElementsToKeep: elements to keep in the mesh: a list of groups, sub-meshes or node IDs. If *ElementsToKeep* does not include an element to keep for some group to merge, then the first element in the group is kept. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ unRegister = genObjUnRegister() @@ -6387,6 +6506,10 @@ class Mesh(metaclass = MeshMeta): def MergeEqualElements(self): """ Leave one element and remove all other elements built on the same nodes. + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ self.editor.MergeEqualElements() @@ -6456,6 +6579,10 @@ class Mesh(metaclass = MeshMeta): Returns: a number of successfully sewed groups + + Note: + This operation can create gaps in numeration of nodes or elements. + Call :meth:`RenumberElements` to remove the gaps. """ if freeBorders and isinstance( freeBorders, list ): @@ -6487,6 +6614,10 @@ class Mesh(metaclass = MeshMeta): Returns: :class:`error code ` + + Note: + This operation can create gaps in numeration of nodes or elements. + Call :meth:`RenumberElements` to remove the gaps. """ return self.editor.SewFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1, @@ -6500,6 +6631,10 @@ class Mesh(metaclass = MeshMeta): Returns: :class:`error code ` + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ return self.editor.SewConformFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1, @@ -6512,6 +6647,10 @@ class Mesh(metaclass = MeshMeta): Returns: :class:`error code ` + + Note: + This operation can create gaps in numeration of elements. + Call :meth:`RenumberElements` to remove the gaps. """ return self.editor.SewBorderToSide(FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder, @@ -6530,6 +6669,10 @@ class Mesh(metaclass = MeshMeta): Returns: :class:`error code ` + + Note: + This operation can create gaps in numeration of nodes. + Call :meth:`RenumberElements` to remove the gaps. """ return self.editor.SewSideElements(IDsOfSide1Elements, IDsOfSide2Elements, @@ -6538,7 +6681,7 @@ class Mesh(metaclass = MeshMeta): def ChangeElemNodes(self, ide, newIDs): """ - Set new nodes for the given element. + Set new nodes for the given element. Number of nodes should be kept. Parameters: ide: the element ID @@ -6899,7 +7042,7 @@ class Mesh(metaclass = MeshMeta): def MakeSlot(self, segmentGroup, width ): """ Create a slot of given width around given 1D elements lying on a triangle mesh. - The slot is consrtucted by cutting faces by cylindrical surfaces made + The slot is constructed by cutting faces by cylindrical surfaces made around each segment. Segments are expected to be created by MakePolyLine(). Returns: