+
+
+ # Operations with groups:
+ # ----------------------
+
+ ## Creates an empty mesh group
+ # @param elementType is the type of elements in the group
+ # @param name is the name of the mesh group
+ # @return SMESH_Group
+ def CreateEmptyGroup(self, elementType, name):
+ return self.mesh.CreateGroup(elementType, name)
+
+ ## Creates a mesh group based on geometric object \a grp
+ # and give a \a name, \n if this parameter is not defined
+ # the name is the same as the geometric group name
+ # @param grp is a geometric group, a vertex, an edge, a face or a solid
+ # @param name is the name of the mesh group
+ # @return SMESH_GroupOnGeom
+ def GroupOnGeom(self, grp, name="", type=None):
+ if name == "":
+ name = grp.GetName()
+
+ if type == None:
+ tgeo = str(grp.GetShapeType())
+ if tgeo == "VERTEX":
+ type = NODE
+ elif tgeo == "EDGE":
+ type = EDGE
+ elif tgeo == "FACE":
+ type = FACE
+ elif tgeo == "SOLID":
+ type = VOLUME
+ elif tgeo == "SHELL":
+ type = VOLUME
+ elif tgeo == "COMPOUND":
+ if len( geompy.GetObjectIDs( grp )) == 0:
+ print "Mesh.Group: empty geometric group", GetName( grp )
+ return 0
+ tgeo = geompy.GetType(grp)
+ if tgeo == geompy.ShapeType["VERTEX"]:
+ type = NODE
+ elif tgeo == geompy.ShapeType["EDGE"]:
+ type = EDGE
+ elif tgeo == geompy.ShapeType["FACE"]:
+ type = FACE
+ elif tgeo == geompy.ShapeType["SOLID"]:
+ type = VOLUME
+
+ if type == None:
+ print "Mesh.Group: bad first argument: expected a group, a vertex, an edge, a face or a solid"
+ return 0
+ else:
+ return self.mesh.CreateGroupFromGEOM(type, name, grp)
+
+ ## Create a mesh group by the given ids of elements
+ # @param groupName is the name of the mesh group
+ # @param elementType is the type of elements in the group
+ # @param elemIDs is the list of ids
+ # @return SMESH_Group
+ def MakeGroupByIds(self, groupName, elementType, elemIDs):
+ group = self.mesh.CreateGroup(elementType, groupName)
+ group.Add(elemIDs)
+ return group
+
+ ## Create a mesh group by the given conditions
+ # @param groupName is the name of the mesh group
+ # @param elementType is the type of elements in the group
+ # @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
+ # @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo}
+ # @param Treshold is threshold value (range of id ids as string, shape, numeric)
+ # @param UnaryOp is FT_LogicalNOT or FT_Undefined
+ # @return SMESH_Group
+ def MakeGroup(self,
+ groupName,
+ elementType,
+ CritType=FT_Undefined,
+ Compare=FT_EqualTo,
+ Treshold="",
+ UnaryOp=FT_Undefined):
+ aCriterion = GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined)
+ group = self.MakeGroupByCriterion(groupName, aCriterion)
+ return group
+
+ ## Create a mesh group by the given criterion
+ # @param groupName is the name of the mesh group
+ # @param Criterion is the instance of Criterion class
+ # @return SMESH_Group
+ def MakeGroupByCriterion(self, groupName, Criterion):
+ aFilterMgr = smesh.CreateFilterManager()
+ aFilter = aFilterMgr.CreateFilter()
+ aCriteria = []
+ aCriteria.append(Criterion)
+ aFilter.SetCriteria(aCriteria)
+ group = self.MakeGroupByFilter(groupName, aFilter)
+ return group
+
+ ## Create a mesh group by the given criteria(list of criterions)
+ # @param groupName is the name of the mesh group
+ # @param Criteria is the list of criterions
+ # @return SMESH_Group
+ def MakeGroupByCriteria(self, groupName, theCriteria):
+ aFilterMgr = smesh.CreateFilterManager()
+ aFilter = aFilterMgr.CreateFilter()
+ aFilter.SetCriteria(theCriteria)
+ group = self.MakeGroupByFilter(groupName, aFilter)
+ return group
+
+ ## Create a mesh group by the given filter
+ # @param groupName is the name of the mesh group
+ # @param Criterion is the instance of Filter class
+ # @return SMESH_Group
+ def MakeGroupByFilter(self, groupName, theFilter):
+ anIds = theFilter.GetElementsId(self.mesh)
+ anElemType = theFilter.GetElementType()
+ group = self.MakeGroupByIds(groupName, anElemType, anIds)
+ return group
+
+ ## Pass mesh elements through the given filter and return ids
+ # @param theFilter is SMESH_Filter
+ # @return list of ids
+ def GetIdsFromFilter(self, theFilter):
+ return theFilter.GetElementsId(self.mesh)
+
+ ## Verify whether 2D mesh element has free edges(edges connected to one face only)\n
+ # Returns list of special structures(borders).
+ # @return list of SMESH.FreeEdges.Border structure: edge id and two its nodes ids.
+ def GetFreeBorders(self):
+ aFilterMgr = smesh.CreateFilterManager()
+ aPredicate = aFilterMgr.CreateFreeEdges()
+ aPredicate.SetMesh(self.mesh)
+ aBorders = aPredicate.GetBorders()
+ return aBorders
+
+ ## Remove a group
+ def RemoveGroup(self, group):
+ self.mesh.RemoveGroup(group)
+
+ ## Remove group with its contents
+ def RemoveGroupWithContents(self, group):
+ self.mesh.RemoveGroupWithContents(group)
+
+ ## Get the list of groups existing in the mesh
+ def GetGroups(self):
+ return self.mesh.GetGroups()
+
+ ## Get the list of names of groups existing in the mesh
+ def GetGroupNames(self):
+ groups = self.GetGroups()
+ names = []
+ for group in groups:
+ names.append(group.GetName())
+ return names
+
+ ## Union of two groups
+ # New group is created. All mesh elements that are
+ # present in initial groups are added to the new one
+ def UnionGroups(self, group1, group2, name):
+ return self.mesh.UnionGroups(group1, group2, name)
+
+ ## Intersection of two groups
+ # New group is created. All mesh elements that are
+ # present in both initial groups are added to the new one.
+ def IntersectGroups(self, group1, group2, name):
+ return self.mesh.IntersectGroups(group1, group2, name)
+
+ ## Cut of two groups
+ # New group is created. All mesh elements that are present in
+ # main group but do not present in tool group are added to the new one
+ def CutGroups(self, mainGroup, toolGroup, name):
+ return self.mesh.CutGroups(mainGroup, toolGroup, name)
+
+
+ # Get some info about mesh:
+ # ------------------------
+
+ ## Get the log of nodes and elements added or removed since previous
+ # clear of the log.
+ # @param clearAfterGet log is emptied after Get (safe if concurrents access)
+ # @return list of log_block structures:
+ # commandType
+ # number
+ # coords
+ # indexes
+ def GetLog(self, clearAfterGet):
+ return self.mesh.GetLog(clearAfterGet)
+
+ ## Clear the log of nodes and elements added or removed since previous
+ # clear. Must be used immediately after GetLog if clearAfterGet is false.
+ def ClearLog(self):
+ self.mesh.ClearLog()
+
+ ## Get the internal Id
+ def GetId(self):
+ return self.mesh.GetId()
+
+ ## Get the study Id
+ def GetStudyId(self):
+ return self.mesh.GetStudyId()
+
+ ## Check group names for duplications.
+ # Consider maximum group name length stored in MED file.
+ def HasDuplicatedGroupNamesMED(self):
+ return self.mesh.GetStudyId()
+
+ ## Obtain instance of SMESH_MeshEditor
+ def GetMeshEditor(self):
+ return self.mesh.GetMeshEditor()
+
+ ## Get MED Mesh
+ def GetMEDMesh(self):
+ return self.mesh.GetMEDMesh()
+
+
+ # Get informations about mesh contents:
+ # ------------------------------------
+
+ ## Returns number of nodes in mesh
+ def NbNodes(self):
+ return self.mesh.NbNodes()
+
+ ## Returns number of elements in mesh
+ def NbElements(self):
+ return self.mesh.NbElements()
+
+ ## Returns number of edges in mesh
+ def NbEdges(self):
+ return self.mesh.NbEdges()
+
+ ## Returns number of edges with given order in mesh
+ # @param elementOrder is order of elements:
+ # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
+ def NbEdgesOfOrder(self, elementOrder):
+ return self.mesh.NbEdgesOfOrder(elementOrder)
+
+ ## Returns number of faces in mesh
+ def NbFaces(self):
+ return self.mesh.NbFaces()
+
+ ## Returns number of faces with given order in mesh
+ # @param elementOrder is order of elements:
+ # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
+ def NbFacesOfOrder(self, elementOrder):
+ return self.mesh.NbFacesOfOrder(elementOrder)
+
+ ## Returns number of triangles in mesh
+ def NbTriangles(self):
+ return self.mesh.NbTriangles()
+
+ ## Returns number of triangles with given order in mesh
+ # @param elementOrder is order of elements:
+ # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
+ def NbTrianglesOfOrder(self, elementOrder):
+ return self.mesh.NbTrianglesOfOrder(elementOrder)
+
+ ## Returns number of quadrangles in mesh
+ def NbQuadrangles(self):
+ return self.mesh.NbQuadrangles()
+
+ ## Returns number of quadrangles with given order in mesh
+ # @param elementOrder is order of elements:
+ # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
+ def NbQuadranglesOfOrder(self, elementOrder):
+ return self.mesh.NbQuadranglesOfOrder(elementOrder)
+
+ ## Returns number of polygons in mesh
+ def NbPolygons(self):
+ return self.mesh.NbPolygons()
+
+ ## Returns number of volumes in mesh
+ def NbVolumes(self):
+ return self.mesh.NbVolumes()
+
+ ## Returns number of volumes with given order in mesh
+ # @param elementOrder is order of elements:
+ # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
+ def NbVolumesOfOrder(self, elementOrder):
+ return self.mesh.NbVolumesOfOrder(elementOrder)
+
+ ## Returns number of tetrahedrons in mesh
+ def NbTetras(self):
+ return self.mesh.NbTetras()
+
+ ## Returns number of tetrahedrons with given order in mesh
+ # @param elementOrder is order of elements:
+ # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
+ def NbTetrasOfOrder(self, elementOrder):
+ return self.mesh.NbTetrasOfOrder(elementOrder)
+
+ ## Returns number of hexahedrons in mesh
+ def NbHexas(self):
+ return self.mesh.NbHexas()
+
+ ## Returns number of hexahedrons with given order in mesh
+ # @param elementOrder is order of elements:
+ # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
+ def NbHexasOfOrder(self, elementOrder):
+ return self.mesh.NbHexasOfOrder(elementOrder)
+
+ ## Returns number of pyramids in mesh
+ def NbPyramids(self):
+ return self.mesh.NbPyramids()
+
+ ## Returns number of pyramids with given order in mesh
+ # @param elementOrder is order of elements:
+ # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
+ def NbPyramidsOfOrder(self, elementOrder):
+ return self.mesh.NbPyramidsOfOrder(elementOrder)
+
+ ## Returns number of prisms in mesh
+ def NbPrisms(self):
+ return self.mesh.NbPrisms()
+
+ ## Returns number of prisms with given order in mesh
+ # @param elementOrder is order of elements:
+ # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
+ def NbPrismsOfOrder(self, elementOrder):
+ return self.mesh.NbPrismsOfOrder(elementOrder)
+
+ ## Returns number of polyhedrons in mesh
+ def NbPolyhedrons(self):
+ return self.mesh.NbPolyhedrons()
+
+ ## Returns number of submeshes in mesh
+ def NbSubMesh(self):
+ return self.mesh.NbSubMesh()
+
+ ## Returns list of mesh elements ids
+ def GetElementsId(self):
+ return self.mesh.GetElementsId()
+
+ ## Returns list of ids of mesh elements with given type
+ # @param elementType is required type of elements
+ def GetElementsByType(self, elementType):
+ return self.mesh.GetElementsByType(elementType)
+
+ ## Returns list of mesh nodes ids
+ def GetNodesId(self):
+ return self.mesh.GetNodesId()
+
+ # Get informations about mesh elements:
+ # ------------------------------------
+
+ ## Returns type of mesh element
+ def GetElementType(self, id, iselem):
+ return self.mesh.GetElementType(id, iselem)
+
+ ## Returns list of submesh elements ids
+ # @param shapeID is geom object(subshape) IOR
+ def GetSubMeshElementsId(self, shapeID):
+ return self.mesh.GetSubMeshElementsId(shapeID)
+
+ ## Returns list of submesh nodes ids
+ # @param shapeID is geom object(subshape) IOR
+ def GetSubMeshNodesId(self, shapeID, all):
+ return self.mesh.GetSubMeshNodesId(shapeID, all)
+
+ ## Returns list of ids of submesh elements with given type
+ # @param shapeID is geom object(subshape) IOR
+ def GetSubMeshElementType(self, shapeID):
+ return self.mesh.GetSubMeshElementType(shapeID)
+
+ ## Get mesh description
+ def Dump(self):
+ return self.mesh.Dump()
+
+
+ # Get information about nodes and elements of mesh by its ids:
+ # -----------------------------------------------------------
+
+ ## Get XYZ coordinates of node as list of double
+ # \n If there is not node for given ID - returns empty list
+ def GetNodeXYZ(self, id):
+ return self.mesh.GetNodeXYZ(id)
+
+ ## For given node returns list of IDs of inverse elements
+ # \n If there is not node for given ID - returns empty list
+ def GetNodeInverseElements(self, id):
+ return self.mesh.GetNodeInverseElements(id)
+
+ ## If given element is node returns IDs of shape from position
+ # \n If there is not node for given ID - returns -1
+ def GetShapeID(self, id):
+ return self.mesh.GetShapeID(id)
+
+ ## For given element returns ID of result shape after
+ # FindShape() from SMESH_MeshEditor
+ # \n If there is not element for given ID - returns -1
+ def GetShapeIDForElem(id):
+ return self.mesh.GetShapeIDForElem(id)
+
+ ## Returns number of nodes for given element
+ # \n If there is not element for given ID - returns -1
+ def GetElemNbNodes(self, id):
+ return self.mesh.GetElemNbNodes(id)
+
+ ## Returns ID of node by given index for given element
+ # \n If there is not element for given ID - returns -1
+ # \n If there is not node for given index - returns -2
+ def GetElemNode(self, id, index):
+ return self.mesh.GetElemNode(id, index)
+
+ ## Returns true if given node is medium node
+ # in given quadratic element
+ def IsMediumNode(self, elementID, nodeID):
+ return self.mesh.IsMediumNode(elementID, nodeID)
+
+ ## Returns true if given node is medium node
+ # in one of quadratic elements
+ def IsMediumNodeOfAnyElem(self, nodeID, elementType):
+ return self.mesh.IsMediumNodeOfAnyElem(nodeID, elementType)
+
+ ## Returns number of edges for given element
+ def ElemNbEdges(self, id):
+ return self.mesh.ElemNbEdges(id)
+
+ ## Returns number of faces for given element
+ def ElemNbFaces(self, id):
+ return self.mesh.ElemNbFaces(id)
+
+ ## Returns true if given element is polygon
+ def IsPoly(self, id):
+ return self.mesh.IsPoly(id)
+
+ ## Returns true if given element is quadratic
+ def IsQuadratic(self, id):
+ return self.mesh.IsQuadratic(id)
+
+ ## Returns XYZ coordinates of bary center for given element
+ # as list of double
+ # \n If there is not element for given ID - returns empty list
+ def BaryCenter(self, id):
+ return self.mesh.BaryCenter(id)
+
+
+ # Mesh edition (SMESH_MeshEditor functionality):
+ # ---------------------------------------------
+
+ ## Removes elements from mesh by ids
+ # @param IDsOfElements is list of ids of elements to remove
+ def RemoveElements(self, IDsOfElements):
+ return self.editor.RemoveElements(IDsOfElements)
+
+ ## Removes nodes from mesh by ids
+ # @param IDsOfNodes is list of ids of nodes to remove
+ def RemoveNodes(self, IDsOfNodes):
+ return self.editor.RemoveNodes(IDsOfNodes)
+
+ ## Add node to mesh by coordinates
+ def AddNode(self, x, y, z):
+ return self.editor.AddNode( x, y, z)
+
+
+ ## Create edge both similar and quadratic (this is determed
+ # by number of given nodes).
+ # @param IdsOfNodes List of node IDs for creation of element.
+ # Needed order of nodes in this list corresponds to description
+ # of MED. \n This description is located by the following link:
+ # http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
+ def AddEdge(self, IDsOfNodes):
+ return self.editor.AddEdge(IDsOfNodes)
+
+ ## Create face both similar and quadratic (this is determed
+ # by number of given nodes).
+ # @param IdsOfNodes List of node IDs for creation of element.
+ # Needed order of nodes in this list corresponds to description
+ # of MED. \n This description is located by the following link:
+ # http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
+ def AddFace(self, IDsOfNodes):
+ return self.editor.AddFace(IDsOfNodes)
+
+ ## Add polygonal face to mesh by list of nodes ids
+ def AddPolygonalFace(self, IdsOfNodes):
+ return self.editor.AddPolygonalFace(IdsOfNodes)
+
+ ## Create volume both similar and quadratic (this is determed
+ # by number of given nodes).
+ # @param IdsOfNodes List of node IDs for creation of element.
+ # Needed order of nodes in this list corresponds to description
+ # of MED. \n This description is located by the following link:
+ # http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
+ def AddVolume(self, IDsOfNodes):
+ return self.editor.AddVolume(IDsOfNodes)
+
+ ## Create volume of many faces, giving nodes for each face.
+ # @param IdsOfNodes List of node IDs for volume creation face by face.
+ # @param Quantities List of integer values, Quantities[i]
+ # gives quantity of nodes in face number i.
+ def AddPolyhedralVolume (self, IdsOfNodes, Quantities):
+ return self.editor.AddPolyhedralVolume(IdsOfNodes, Quantities)
+
+ ## Create volume of many faces, giving IDs of existing faces.
+ # @param IdsOfFaces List of face IDs for volume creation.
+ #
+ # Note: The created volume will refer only to nodes
+ # of the given faces, not to the faces itself.
+ def AddPolyhedralVolumeByFaces (self, IdsOfFaces):
+ return self.editor.AddPolyhedralVolumeByFaces(IdsOfFaces)
+
+ ## Move node with given id
+ # @param NodeID id of the node
+ # @param x displacing along the X axis
+ # @param y displacing along the Y axis
+ # @param z displacing along the Z axis
+ def MoveNode(self, NodeID, x, y, z):
+ return self.editor.MoveNode(NodeID, x, y, z)
+
+ ## Replace two neighbour triangles sharing Node1-Node2 link
+ # with ones built on the same 4 nodes but having other common link.
+ # @param NodeID1 first node id
+ # @param NodeID2 second node id
+ # @return false if proper faces not found
+ def InverseDiag(self, NodeID1, NodeID2):
+ return self.editor.InverseDiag(NodeID1, NodeID2)
+
+ ## Replace two neighbour triangles sharing Node1-Node2 link
+ # with a quadrangle built on the same 4 nodes.
+ # @param NodeID1 first node id
+ # @param NodeID2 second node id
+ # @return false if proper faces not found
+ def DeleteDiag(self, NodeID1, NodeID2):
+ return self.editor.DeleteDiag(NodeID1, NodeID2)
+
+ ## Reorient elements by ids
+ # @param IDsOfElements if undefined reorient all mesh elements
+ def Reorient(self, IDsOfElements=None):
+ if IDsOfElements == None:
+ IDsOfElements = self.GetElementsId()
+ return self.editor.Reorient(IDsOfElements)
+
+ ## Reorient all elements of the object
+ # @param theObject is mesh, submesh or group
+ def ReorientObject(self, theObject):
+ return self.editor.ReorientObject(theObject)
+
+ ## Fuse neighbour triangles into quadrangles.
+ # @param IDsOfElements The triangles to be fused,
+ # @param theCriterion is FT_...; used to choose a neighbour to fuse with.
+ # @param MaxAngle is a max angle between element normals at which fusion
+ # is still performed; theMaxAngle is mesured in radians.
+ # @return TRUE in case of success, FALSE otherwise.
+ def TriToQuad(self, IDsOfElements, theCriterion, MaxAngle):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ return self.editor.TriToQuad(IDsOfElements, GetFunctor(theCriterion), MaxAngle)
+
+ ## Fuse neighbour triangles of the object into quadrangles
+ # @param theObject is mesh, submesh or group
+ # @param theCriterion is FT_...; used to choose a neighbour to fuse with.
+ # @param MaxAngle is a max angle between element normals at which fusion
+ # is still performed; theMaxAngle is mesured in radians.
+ # @return TRUE in case of success, FALSE otherwise.
+ def TriToQuadObject (self, theObject, theCriterion, MaxAngle):
+ return self.editor.TriToQuadObject(theObject, GetFunctor(theCriterion), MaxAngle)
+
+ ## Split quadrangles into triangles.
+ # @param IDsOfElements the faces to be splitted.
+ # @param theCriterion is FT_...; used to choose a diagonal for splitting.
+ # @param @return TRUE in case of success, FALSE otherwise.
+ def QuadToTri (self, IDsOfElements, theCriterion):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ return self.editor.QuadToTri(IDsOfElements, GetFunctor(theCriterion))
+
+ ## Split quadrangles into triangles.
+ # @param theObject object to taking list of elements from, is mesh, submesh or group
+ # @param theCriterion is FT_...; used to choose a diagonal for splitting.
+ def QuadToTriObject (self, theObject, theCriterion):
+ return self.editor.QuadToTriObject(theObject, GetFunctor(theCriterion))
+
+ ## Split quadrangles into triangles.
+ # @param theElems The faces to be splitted
+ # @param the13Diag is used to choose a diagonal for splitting.
+ # @return TRUE in case of success, FALSE otherwise.
+ def SplitQuad (self, IDsOfElements, Diag13):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ return self.editor.SplitQuad(IDsOfElements, Diag13)
+
+ ## Split quadrangles into triangles.
+ # @param theObject is object to taking list of elements from, is mesh, submesh or group
+ def SplitQuadObject (self, theObject, Diag13):
+ return self.editor.SplitQuadObject(theObject, Diag13)
+
+ ## Find better splitting of the given quadrangle.
+ # @param IDOfQuad ID of the quadrangle to be splitted.
+ # @param theCriterion is FT_...; a criterion to choose a diagonal for splitting.
+ # @return 1 if 1-3 diagonal is better, 2 if 2-4
+ # diagonal is better, 0 if error occurs.
+ def BestSplit (self, IDOfQuad, theCriterion):
+ return self.editor.BestSplit(IDOfQuad, GetFunctor(theCriterion))
+
+ ## Smooth elements
+ # @param IDsOfElements list if ids of elements to smooth
+ # @param IDsOfFixedNodes list of ids of fixed nodes.
+ # Note that nodes built on edges and boundary nodes are always fixed.
+ # @param MaxNbOfIterations maximum number of iterations
+ # @param MaxAspectRatio varies in range [1.0, inf]
+ # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
+ def Smooth(self, IDsOfElements, IDsOfFixedNodes,
+ MaxNbOfIterations, MaxAspectRatio, Method):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ return self.editor.Smooth(IDsOfElements, IDsOfFixedNodes,
+ MaxNbOfIterations, MaxAspectRatio, Method)
+
+ ## Smooth elements belong to given object
+ # @param theObject object to smooth
+ # @param IDsOfFixedNodes list of ids of fixed nodes.
+ # Note that nodes built on edges and boundary nodes are always fixed.
+ # @param MaxNbOfIterations maximum number of iterations
+ # @param MaxAspectRatio varies in range [1.0, inf]
+ # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
+ def SmoothObject(self, theObject, IDsOfFixedNodes,
+ MaxNbOfIterations, MaxxAspectRatio, Method):
+ return self.editor.SmoothObject(theObject, IDsOfFixedNodes,
+ MaxNbOfIterations, MaxxAspectRatio, Method)
+
+ ## Parametric smooth the given elements
+ # @param IDsOfElements list if ids of elements to smooth
+ # @param IDsOfFixedNodes list of ids of fixed nodes.
+ # Note that nodes built on edges and boundary nodes are always fixed.
+ # @param MaxNbOfIterations maximum number of iterations
+ # @param MaxAspectRatio varies in range [1.0, inf]
+ # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
+ def SmoothParametric(IDsOfElements, IDsOfFixedNodes,
+ MaxNbOfIterations, MaxAspectRatio, Method):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ return self.editor.SmoothParametric(IDsOfElements, IDsOfFixedNodes,
+ MaxNbOfIterations, MaxAspectRatio, Method)
+
+ ## Parametric smooth elements belong to given object
+ # @param theObject object to smooth
+ # @param IDsOfFixedNodes list of ids of fixed nodes.
+ # Note that nodes built on edges and boundary nodes are always fixed.
+ # @param MaxNbOfIterations maximum number of iterations
+ # @param MaxAspectRatio varies in range [1.0, inf]
+ # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
+ def SmoothParametricObject(self, theObject, IDsOfFixedNodes,
+ MaxNbOfIterations, MaxAspectRatio, Method):
+ return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes,
+ MaxNbOfIterations, MaxAspectRatio, Method)
+
+ ## Converts all mesh to quadratic one, deletes old elements, replacing
+ # them with quadratic ones with the same id.
+ def ConvertToQuadratic(self, theForce3d):
+ self.editor.ConvertToQuadratic(theForce3d)
+
+ ## Converts all mesh from quadratic to ordinary ones,
+ # deletes old quadratic elements, \n replacing
+ # them with ordinary mesh elements with the same id.
+ def ConvertFromQuadratic(self):
+ return self.editor.ConvertFromQuadratic()
+
+ ## Renumber mesh nodes
+ def RenumberNodes(self):
+ self.editor.RenumberNodes()
+
+ ## Renumber mesh elements
+ def RenumberElements(self):
+ self.editor.RenumberElements()
+
+ ## Generate new elements by rotation of the elements around the axis
+ # @param IDsOfElements list of ids of elements to sweep
+ # @param Axix axis of rotation, AxisStruct or line(geom object)
+ # @param AngleInRadians angle of Rotation
+ # @param NbOfSteps number of steps
+ # @param Tolerance tolerance
+ def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ if ( isinstance( Axix, geompy.GEOM._objref_GEOM_Object)):
+ Axix = GetAxisStruct(Axix)
+ self.editor.RotationSweep(IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance)
+
+ ## Generate new elements by rotation of the elements of object around the axis
+ # @param theObject object wich elements should be sweeped
+ # @param Axix axis of rotation, AxisStruct or line(geom object)
+ # @param AngleInRadians angle of Rotation
+ # @param NbOfSteps number of steps
+ # @param Tolerance tolerance
+ def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance):
+ if ( isinstance( Axix, geompy.GEOM._objref_GEOM_Object)):
+ Axix = GetAxisStruct(Axix)
+ self.editor.RotationSweepObject(theObject, Axix, AngleInRadians, NbOfSteps, Tolerance)
+
+ ## Generate new elements by extrusion of the elements with given ids
+ # @param IDsOfElements list of elements ids for extrusion
+ # @param StepVector vector, defining the direction and value of extrusion
+ # @param NbOfSteps the number of steps
+ def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
+ StepVector = GetDirStruct(StepVector)
+ self.editor.ExtrusionSweep(IDsOfElements, StepVector, NbOfSteps)
+
+ ## Generate new elements by extrusion of the elements with given ids
+ # @param IDsOfElements is ids of elements
+ # @param StepVector vector, defining the direction and value of extrusion
+ # @param NbOfSteps the number of steps
+ # @param ExtrFlags set flags for performing extrusion
+ # @param SewTolerance uses for comparing locations of nodes if flag
+ # EXTRUSION_FLAG_SEW is set
+ def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance):
+ if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
+ StepVector = GetDirStruct(StepVector)
+ self.editor.AdvancedExtrusion(IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance)
+
+ ## Generate new elements by extrusion of the elements belong to object
+ # @param theObject object wich elements should be processed
+ # @param StepVector vector, defining the direction and value of extrusion
+ # @param NbOfSteps the number of steps
+ def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps):
+ if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
+ StepVector = GetDirStruct(StepVector)
+ self.editor.ExtrusionSweepObject(theObject, StepVector, NbOfSteps)
+
+ ## Generate new elements by extrusion of the elements belong to object
+ # @param theObject object wich elements should be processed
+ # @param StepVector vector, defining the direction and value of extrusion
+ # @param NbOfSteps the number of steps
+ def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps):
+ if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
+ StepVector = GetDirStruct(StepVector)
+ self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps)
+
+ ## Generate new elements by extrusion of the elements belong to object
+ # @param theObject object wich elements should be processed
+ # @param StepVector vector, defining the direction and value of extrusion
+ # @param NbOfSteps the number of steps
+ def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps):
+ if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
+ StepVector = GetDirStruct(StepVector)
+ self.editor.ExtrusionSweepObject2D(theObject, StepVector, NbOfSteps)
+
+ ## Generate new elements by extrusion of the given elements
+ # A path of extrusion must be a meshed edge.
+ # @param IDsOfElements is ids of elements
+ # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion
+ # @param PathShape is shape(edge); as the mesh can be complex, the edge is used to define the sub-mesh for the path
+ # @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion
+ # @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion
+ # @param Angles list of angles
+ # @param HasRefPoint allows to use base point
+ # @param RefPoint point around which the shape is rotated(the mass center of the shape by default).
+ # User can specify any point as the Base Point and the shape will be rotated with respect to this point.
+ def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart,
+ HasAngles, Angles, HasRefPoint, RefPoint):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ if ( isinstance( RefPoint, geompy.GEOM._objref_GEOM_Object)):
+ RefPoint = GetPointStruct(RefPoint)
+ return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh.GetMesh(), PathShape, NodeStart,
+ HasAngles, Angles, HasRefPoint, RefPoint)
+
+ ## Generate new elements by extrusion of the elements belong to object
+ # A path of extrusion must be a meshed edge.
+ # @param IDsOfElements is ids of elements
+ # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion
+ # @param PathShape is shape(edge); as the mesh can be complex, the edge is used to define the sub-mesh for the path
+ # @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion
+ # @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion
+ # @param Angles list of angles
+ # @param HasRefPoint allows to use base point
+ # @param RefPoint point around which the shape is rotated(the mass center of the shape by default).
+ # User can specify any point as the Base Point and the shape will be rotated with respect to this point.
+ def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
+ HasAngles, Angles, HasRefPoint, RefPoint):
+ if ( isinstance( RefPoint, geompy.GEOM._objref_GEOM_Object)):
+ RefPoint = GetPointStruct(RefPoint)
+ return self.editor.ExtrusionAlongPathObject(theObject, PathMesh.GetMesh(), PathShape, NodeStart,
+ HasAngles, Angles, HasRefPoint, RefPoint)
+
+ ## Symmetrical copy of mesh elements
+ # @param IDsOfElements list of elements ids
+ # @param Mirror is AxisStruct or geom object(point, line, plane)
+ # @param theMirrorType is POINT, AXIS or PLANE
+ # If the Mirror is geom object this parameter is unnecessary
+ # @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0)
+ def Mirror(self, IDsOfElements, Mirror, theMirrorType, Copy=0):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ if ( isinstance( Mirror, geompy.GEOM._objref_GEOM_Object)):
+ Mirror = GetAxisStruct(Mirror)
+ self.editor.Mirror(IDsOfElements, Mirror, theMirrorType, Copy)
+
+ ## Symmetrical copy of object
+ # @param theObject mesh, submesh or group
+ # @param Mirror is AxisStruct or geom object(point, line, plane)
+ # @param theMirrorType is POINT, AXIS or PLANE
+ # If the Mirror is geom object this parameter is unnecessary
+ # @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0)
+ def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0):
+ if ( isinstance( Mirror, geompy.GEOM._objref_GEOM_Object)):
+ Mirror = GetAxisStruct(Mirror)
+ self.editor.MirrorObject(theObject, Mirror, theMirrorType, Copy)
+
+ ## Translates the elements
+ # @param IDsOfElements list of elements ids
+ # @param Vector direction of translation(DirStruct or vector)
+ # @param Copy allows to copy the translated elements
+ def Translate(self, IDsOfElements, Vector, Copy):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ if ( isinstance( Vector, geompy.GEOM._objref_GEOM_Object)):
+ Vector = GetDirStruct(Vector)
+ self.editor.Translate(IDsOfElements, Vector, Copy)
+
+ ## Translates the object
+ # @param theObject object to translate(mesh, submesh, or group)
+ # @param Vector direction of translation(DirStruct or geom vector)
+ # @param Copy allows to copy the translated elements
+ def TranslateObject(self, theObject, Vector, Copy):
+ if ( isinstance( Vector, geompy.GEOM._objref_GEOM_Object)):
+ Vector = GetDirStruct(Vector)
+ self.editor.TranslateObject(theObject, Vector, Copy)
+
+ ## Rotates the elements
+ # @param IDsOfElements list of elements ids
+ # @param Axis axis of rotation(AxisStruct or geom line)
+ # @param AngleInRadians angle of rotation(in radians)
+ # @param Copy allows to copy the rotated elements
+ def Rotate (self, IDsOfElements, Axis, AngleInRadians, Copy):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ if ( isinstance( Axis, geompy.GEOM._objref_GEOM_Object)):
+ Axis = GetAxisStruct(Axis)
+ self.editor.Rotate(IDsOfElements, Axis, AngleInRadians, Copy)
+
+ ## Rotates the object
+ # @param theObject object to rotate(mesh, submesh, or group)
+ # @param Axis axis of rotation(AxisStruct or geom line)
+ # @param AngleInRadians angle of rotation(in radians)
+ # @param Copy allows to copy the rotated elements
+ def RotateObject (self, theObject, Axis, AngleInRadians, Copy):
+ self.editor.RotateObject(theObject, Axis, AngleInRadians, Copy)
+
+ ## Find group of nodes close to each other within Tolerance.
+ # @param Tolerance tolerance value
+ # @param list of group of nodes
+ def FindCoincidentNodes (self, Tolerance):
+ return self.editor.FindCoincidentNodes(Tolerance)
+
+ ## Merge nodes
+ # @param list of group of nodes
+ def MergeNodes (self, GroupsOfNodes):
+ self.editor.MergeNodes(GroupsOfNodes)
+
+ ## Remove all but one of elements built on the same nodes.
+ def MergeEqualElements(self):
+ self.editor.MergeEqualElements()
+
+ ## Sew free borders
+ def SewFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1,
+ FirstNodeID2, SecondNodeID2, LastNodeID2,
+ CreatePolygons, CreatePolyedrs):
+ return self.editor.SewFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
+ FirstNodeID2, SecondNodeID2, LastNodeID2,
+ CreatePolygons, CreatePolyedrs)
+
+ ## Sew conform free borders
+ def SewConformFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1,
+ FirstNodeID2, SecondNodeID2):
+ return self.editor.SewConformFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
+ FirstNodeID2, SecondNodeID2)
+
+ ## Sew border to side
+ def SewBorderToSide (self, FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
+ FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs):
+ return self.editor.SewBorderToSide(FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
+ FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs)
+
+ ## Sew two sides of a mesh. Nodes belonging to Side1 are
+ # merged with nodes of elements of Side2.
+ # Number of elements in theSide1 and in theSide2 must be
+ # equal and they should have similar node connectivity.
+ # The nodes to merge should belong to sides borders and
+ # the first node should be linked to the second.
+ def SewSideElements (self, IDsOfSide1Elements, IDsOfSide2Elements,
+ NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge,
+ NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge):
+ return self.editor.SewSideElements(IDsOfSide1Elements, IDsOfSide2Elements,
+ NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge,
+ NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge)
+
+ ## Set new nodes for given element.
+ # @param ide the element id
+ # @param newIDs nodes ids
+ # @return If number of nodes is not corresponded to type of element - returns false
+ def ChangeElemNodes(self, ide, newIDs):
+ return self.editor.ChangeElemNodes(ide, newIDs)
+
+ ## If during last operation of MeshEditor some nodes were
+ # created this method returns list of it's IDs, \n
+ # if new nodes not created - returns empty list
+ def GetLastCreatedNodes(self):
+ return self.editor.GetLastCreatedNodes()
+
+ ## If during last operation of MeshEditor some elements were
+ # created this method returns list of it's IDs, \n
+ # if new elements not creared - returns empty list
+ def GetLastCreatedElems(self):
+ return self.editor.GetLastCreatedElems()