+ ## Creates a hole in a mesh by doubling the nodes of some particular elements
+ # @param theElems - the list of elements (edges or faces) to be replicated
+ # The nodes for duplication could be found from these elements
+ # @param theNodesNot - list of nodes to NOT replicate
+ # @param theAffectedElems - the list of elements (cells and edges) to which the
+ # replicated nodes should be associated to.
+ # @return TRUE if operation has been completed successfully, FALSE otherwise
+ # @ingroup l2_modif_edit
+ def DoubleNodeElem(self, theElems, theNodesNot, theAffectedElems):
+ return self.editor.DoubleNodeElem(theElems, theNodesNot, theAffectedElems)
+
+ ## Creates a hole in a mesh by doubling the nodes of some particular elements
+ # @param theElems - the list of elements (edges or faces) to be replicated
+ # The nodes for duplication could be found from these elements
+ # @param theNodesNot - list of nodes to NOT replicate
+ # @param theShape - shape to detect affected elements (element which geometric center
+ # located on or inside shape).
+ # The replicated nodes should be associated to affected elements.
+ # @return TRUE if operation has been completed successfully, FALSE otherwise
+ # @ingroup l2_modif_edit
+ def DoubleNodeElemInRegion(self, theElems, theNodesNot, theShape):
+ return self.editor.DoubleNodeElemInRegion(theElems, theNodesNot, theShape)
+
+ ## Creates a hole in a mesh by doubling the nodes of some particular elements
+ # This method provided for convenience works as DoubleNodes() described above.
+ # @param theElems - group of of elements (edges or faces) to be replicated
+ # @param theNodesNot - group of nodes not to replicated
+ # @param theAffectedElems - group of elements to which the replicated nodes
+ # should be associated to.
+ # @param theMakeGroup forces the generation of a group containing new elements.
+ # @return TRUE or a created group if operation has been completed successfully,
+ # FALSE or None otherwise
+ # @ingroup l2_modif_edit
+ def DoubleNodeElemGroup(self, theElems, theNodesNot, theAffectedElems, theMakeGroup=False):
+ if theMakeGroup:
+ return self.editor.DoubleNodeElemGroupNew(theElems, theNodesNot, theAffectedElems)
+ return self.editor.DoubleNodeElemGroup(theElems, theNodesNot, theAffectedElems)
+
+ ## Creates a hole in a mesh by doubling the nodes of some particular elements
+ # This method provided for convenience works as DoubleNodes() described above.
+ # @param theElems - group of of elements (edges or faces) to be replicated
+ # @param theNodesNot - group of nodes not to replicated
+ # @param theShape - shape to detect affected elements (element which geometric center
+ # located on or inside shape).
+ # The replicated nodes should be associated to affected elements.
+ # @ingroup l2_modif_edit
+ def DoubleNodeElemGroupInRegion(self, theElems, theNodesNot, theShape):
+ return self.editor.DoubleNodeElemGroupInRegion(theElems, theNodesNot, theShape)
+
+ ## Creates a hole in a mesh by doubling the nodes of some particular elements
+ # This method provided for convenience works as DoubleNodes() described above.
+ # @param theElems - list of groups of elements (edges or faces) to be replicated
+ # @param theNodesNot - list of groups of nodes not to replicated
+ # @param theAffectedElems - group of elements to which the replicated nodes
+ # should be associated to.
+ # @param theMakeGroup forces the generation of a group containing new elements.
+ # @return TRUE or a created group if operation has been completed successfully,
+ # FALSE or None otherwise
+ # @ingroup l2_modif_edit
+ def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems, theMakeGroup=False):
+ if theMakeGroup:
+ return self.editor.DoubleNodeElemGroupsNew(theElems, theNodesNot, theAffectedElems)
+ return self.editor.DoubleNodeElemGroups(theElems, theNodesNot, theAffectedElems)
+
+ ## Creates a hole in a mesh by doubling the nodes of some particular elements
+ # This method provided for convenience works as DoubleNodes() described above.
+ # @param theElems - list of groups of elements (edges or faces) to be replicated
+ # @param theNodesNot - list of groups of nodes not to replicated
+ # @param theShape - shape to detect affected elements (element which geometric center
+ # located on or inside shape).
+ # The replicated nodes should be associated to affected elements.
+ # @return TRUE if operation has been completed successfully, FALSE otherwise
+ # @ingroup l2_modif_edit
+ def DoubleNodeElemGroupsInRegion(self, theElems, theNodesNot, theShape):
+ return self.editor.DoubleNodeElemGroupsInRegion(theElems, theNodesNot, theShape)
+
+ ## Double nodes on shared faces between groups of volumes and create flat elements on demand.
+ # The list of groups must describe a partition of the mesh volumes.
+ # The nodes of the internal faces at the boundaries of the groups are doubled.
+ # In option, the internal faces are replaced by flat elements.
+ # Triangles are transformed in prisms, and quadrangles in hexahedrons.
+ # @param theDomains - list of groups of volumes
+ # @param createJointElems - if TRUE, create the elements
+ # @return TRUE if operation has been completed successfully, FALSE otherwise
+ def DoubleNodesOnGroupBoundaries(self, theDomains, createJointElems ):
+ return self.editor.DoubleNodesOnGroupBoundaries( theDomains, createJointElems )
+
+ ## Double nodes on some external faces and create flat elements.
+ # Flat elements are mainly used by some types of mechanic calculations.
+ #
+ # Each group of the list must be constituted of faces.
+ # Triangles are transformed in prisms, and quadrangles in hexahedrons.
+ # @param theGroupsOfFaces - list of groups of faces
+ # @return TRUE if operation has been completed successfully, FALSE otherwise
+ def CreateFlatElementsOnFacesGroups(self, theGroupsOfFaces ):
+ return self.editor.CreateFlatElementsOnFacesGroups( theGroupsOfFaces )
+
+ def _valueFromFunctor(self, funcType, elemId):
+ fn = self.smeshpyD.GetFunctor(funcType)
+ fn.SetMesh(self.mesh)
+ if fn.GetElementType() == self.GetElementType(elemId, True):
+ val = fn.GetValue(elemId)
+ else:
+ val = 0
+ return val
+
+ ## Get length of 1D element.
+ # @param elemId mesh element ID
+ # @return element's length value
+ # @ingroup l1_measurements
+ def GetLength(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Length, elemId)
+
+ ## Get area of 2D element.
+ # @param elemId mesh element ID
+ # @return element's area value
+ # @ingroup l1_measurements
+ def GetArea(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Area, elemId)
+
+ ## Get volume of 3D element.
+ # @param elemId mesh element ID
+ # @return element's volume value
+ # @ingroup l1_measurements
+ def GetVolume(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Volume3D, elemId)
+
+ ## Get maximum element length.
+ # @param elemId mesh element ID
+ # @return element's maximum length value
+ # @ingroup l1_measurements
+ def GetMaxElementLength(self, elemId):
+ if self.GetElementType(elemId, True) == SMESH.VOLUME:
+ ftype = SMESH.FT_MaxElementLength3D
+ else:
+ ftype = SMESH.FT_MaxElementLength2D
+ return self._valueFromFunctor(ftype, elemId)
+
+ ## Get aspect ratio of 2D or 3D element.
+ # @param elemId mesh element ID
+ # @return element's aspect ratio value
+ # @ingroup l1_measurements
+ def GetAspectRatio(self, elemId):
+ if self.GetElementType(elemId, True) == SMESH.VOLUME:
+ ftype = SMESH.FT_AspectRatio3D
+ else:
+ ftype = SMESH.FT_AspectRatio
+ return self._valueFromFunctor(ftype, elemId)
+
+ ## Get warping angle of 2D element.
+ # @param elemId mesh element ID
+ # @return element's warping angle value
+ # @ingroup l1_measurements
+ def GetWarping(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Warping, elemId)
+
+ ## Get minimum angle of 2D element.
+ # @param elemId mesh element ID
+ # @return element's minimum angle value
+ # @ingroup l1_measurements
+ def GetMinimumAngle(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_MinimumAngle, elemId)
+
+ ## Get taper of 2D element.
+ # @param elemId mesh element ID
+ # @return element's taper value
+ # @ingroup l1_measurements
+ def GetTaper(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Taper, elemId)
+
+ ## Get skew of 2D element.
+ # @param elemId mesh element ID
+ # @return element's skew value
+ # @ingroup l1_measurements
+ def GetSkew(self, elemId):
+ return self._valueFromFunctor(SMESH.FT_Skew, elemId)
+