if errText: errText += ". "
errText += err.comment
if allReasons != "":allReasons += "\n"
- allReasons += '- "%s" failed%s. Error: %s' %(err.algoName, shapeText, errText)
+ if ok:
+ allReasons += '- "%s"%s - %s' %(err.algoName, shapeText, errText)
+ else:
+ allReasons += '- "%s" failed%s. Error: %s' %(err.algoName, shapeText, errText)
pass
# Treat hyp errors
# @param version MED format version(MED_V2_1 or MED_V2_2)
# @param overwrite boolean parameter for overwriting/not overwriting the file
# @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
+ # @param autoDimension: if @c True (default), a space dimension of a MED mesh can be either
+ # - 1D if all mesh nodes lie on OX coordinate axis, or
+ # - 2D if all mesh nodes lie on XOY coordinate plane, or
+ # - 3D in the rest cases.
+ #
+ # If @a autoDimension is @c False, the space dimension is always 3.
# @ingroup l2_impexp
- def ExportMED(self, f, auto_groups=0, version=MED_V2_2, overwrite=1, meshPart=None):
+ def ExportMED(self, f, auto_groups=0, version=MED_V2_2,
+ overwrite=1, meshPart=None, autoDimension=True):
if meshPart:
if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
- self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite )
+ self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite, autoDimension)
else:
- self.mesh.ExportToMEDX(f, auto_groups, version, overwrite)
+ self.mesh.ExportToMEDX(f, auto_groups, version, overwrite, autoDimension)
## Exports the mesh in a file in SAUV format
# @param f is the file name
# @param opt boolean parameter for creating/not creating
# the groups Group_On_All_Nodes, Group_On_All_Faces, ...
# @param overwrite boolean parameter for overwriting/not overwriting the file
+ # @param autoDimension: if @c True (default), a space dimension of a MED mesh can be either
+ # - 1D if all mesh nodes lie on OX coordinate axis, or
+ # - 2D if all mesh nodes lie on XOY coordinate plane, or
+ # - 3D in the rest cases.
+ #
+ # If @a autoDimension is @c False, the space dimension is always 3.
# @ingroup l2_impexp
- def ExportToMED(self, f, version, opt=0, overwrite=1):
- self.mesh.ExportToMEDX(f, opt, version, overwrite)
+ def ExportToMED(self, f, version, opt=0, overwrite=1, autoDimension=True):
+ self.mesh.ExportToMEDX(f, opt, version, overwrite, autoDimension)
# Operations with groups:
# ----------------------
def GetIDSource(self, ids, elemType):
return self.editor.MakeIDSource(ids, elemType)
- ## Gets MED Mesh
- # @return an instance of SALOME_MED::MESH
- # @ingroup l1_auxiliary
- def GetMEDMesh(self):
- return self.mesh.GetMEDMesh()
-
# Get informations about mesh contents:
# ------------------------------------
return self.editor.TriToQuadObject(theObject, Functor, MaxAngle)
## Splits quadrangles into triangles.
- #
# @param IDsOfElements the faces to be splitted.
# @param theCriterion is a numerical functor, in terms of enum SMESH.FunctorType, used to
# choose a diagonal for splitting. If @a theCriterion is None, which is a default
Functor = self.smeshpyD.GetFunctor(theCriterion)
return self.editor.QuadToTriObject(theObject, Functor)
+ ## Splits each of given quadrangles into 4 triangles. A node is added at the center of
+ # a quadrangle.
+ # @param theElements the faces to be splitted. This can be either mesh, sub-mesh,
+ # group or a list of face IDs. By default all quadrangles are split
+ # @ingroup l2_modif_cutquadr
+ def QuadTo4Tri (self, theElements=[]):
+ if isinstance( theElements, Mesh ):
+ theElements = theElements.mesh
+ elif not theElements:
+ theElements = self.mesh
+ elif isinstance( theElements, list ):
+ theElements = self.GetIDSource( theElements, SMESH.FACE )
+ return self.editor.QuadTo4Tri( theElements )
+
## Splits quadrangles into triangles.
# @param IDsOfElements the faces to be splitted
# @param Diag13 is used to choose a diagonal for splitting.
# @param theToBiQuad If True, converts the mesh to bi-quadratic
# @ingroup l2_modif_tofromqu
def ConvertToQuadratic(self, theForce3d, theSubMesh=None, theToBiQuad=False):
+ if isinstance( theSubMesh, Mesh ):
+ theSubMesh = theSubMesh.mesh
if theToBiQuad:
self.editor.ConvertToBiQuadratic(theForce3d,theSubMesh)
else:
self.editor.ConvertToQuadraticObject(theForce3d,theSubMesh)
else:
self.editor.ConvertToQuadratic(theForce3d)
+ error = self.editor.GetLastError()
+ if error and error.comment:
+ print error.comment
## Converts the mesh from quadratic to ordinary,
# deletes old quadratic elements, \n replacing
# @param LinearVariation forces the computation of rotation angles as linear
# variation of the given Angles along path steps
# @param HasRefPoint allows using the reference point
- # @param RefPoint the point around which the shape is rotated (the mass center of the shape by default).
+ # @param RefPoint the point around which the elements are rotated (the mass
+ # center of the elements by default).
# The User can specify any point as the Reference Point.
+ # RefPoint can be either GEOM Vertex, [x,y,z] or SMESH.PointStruct
# @param MakeGroups forces the generation of new groups from existing ones
# @param ElemType type of elements for extrusion (if param Base is a mesh)
# @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
def ExtrusionAlongPathX(self, Base, Path, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups, ElemType):
- if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)):
+ if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
pass
+ elif isinstance( RefPoint, list ):
+ RefPoint = PointStruct(*RefPoint)
+ pass
Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters)
def GetLastCreatedElems(self):
return self.editor.GetLastCreatedElems()
- ## Clear sequences of nodes and elements created by mesh edition oparations
+ ## Clears sequences of nodes and elements created by mesh edition oparations
# @ingroup l1_auxiliary
def ClearLastCreated(self):
self.editor.ClearLastCreated()
- ## Creates a hole in a mesh by doubling the nodes of some particular elements
+ ## Creates Duplicates given elements, i.e. creates new elements based on the
+ # same nodes as the given ones.
+ # @param theElements - container of elements to duplicate. It can be a Mesh,
+ # sub-mesh, group, filter or a list of element IDs.
+ # @param theGroupName - a name of group to contain the generated elements.
+ # If a group with such a name already exists, the new elements
+ # are added to the existng group, else a new group is created.
+ # If \a theGroupName is empty, new elements are not added
+ # in any group.
+ # @return a group where the new elements are added. None if theGroupName == "".
+ # @ingroup l2_modif_edit
+ def DoubleElements(self, theElements, theGroupName=""):
+ if isinstance( theElements, Mesh ):
+ theElements = theElements.mesh
+ elif isinstance( theElements, list ):
+ theElements = self.GetIDSource( theElements, SMESH.ALL )
+ return self.editor.DoubleElements(theElements, theGroupName)
+
+ ## Creates a hole in a mesh by doubling the nodes of some particular elements
# @param theNodes identifiers of nodes to be doubled
# @param theModifiedElems identifiers of elements to be updated by the new (doubled)
# nodes. If list of element identifiers is empty then nodes are doubled but