import StdMeshers
import SALOME
+import SALOMEDS
# import NETGENPlugin module if possible
noNETGENPlugin = 0
Hexotic = 9
BLSURF = 10
GHS3DPRL = 11
+QUARDANGLE = 0
+RADIAL_QUAD = 1
# MirrorType enumeration
POINT = SMESH_MeshEditor.POINT
## Gets object name
def GetName(obj):
+ if isinstance(obj, SALOMEDS._objref_SObject):
+ return obj.GetName()
ior = salome.orb.object_to_string(obj)
- sobj = salome.myStudy.FindObjectIOR(ior)
- if sobj is None:
- return NO_NAME
- else:
- attr = sobj.FindAttribute("AttributeName")[1]
- return attr.Value()
+ studies = salome.myStudyManager.GetOpenStudies()
+ for sname in studies:
+ s = salome.myStudyManager.GetStudyByName(sname)
+ if not s: continue
+ sobj = s.FindObjectIOR(ior)
+ if not sobj: continue
+ return sobj.GetName()
+ raise RuntimeError, "Null or invalid object"
## Prints error message if a hypothesis was not assigned.
def TreatHypoStatus(status, hypName, geomName, isAlgo):
if (isinstance(algo, geompyDC.GEOM._objref_GEOM_Object)):
geom = algo
algo = MEFISTO
-
return Mesh_Triangle(self, algo, geom)
## Creates a quadrangle 2D algorithm for faces.
# If the optional \a geom parameter is not set, this algorithm is global.
# \n Otherwise, this algorithm defines a submesh based on \a geom subshape.
# @param geom If defined, the subshape to be meshed (GEOM_Object)
+ # @param algo values are: smesh.QUARDANGLE || smesh.RADIAL_QUAD
# @return an instance of Mesh_Quadrangle algorithm
# @ingroup l3_algos_basic
- def Quadrangle(self, geom=0):
- return Mesh_Quadrangle(self, geom)
+ def Quadrangle(self, geom=0, algo=QUARDANGLE):
+ if algo==RADIAL_QUAD:
+ return Mesh_RadialQuadrangle1D2D(self,geom)
+ else:
+ return Mesh_Quadrangle(self, geom)
## Creates a tetrahedron 3D algorithm for solids.
# The parameter \a algo permits to choose the algorithm: NETGEN or GHS3D
pass
return ok
+ ## Return submesh objects list in meshing order
+ # @return list of list of submesh objects
+ # @ingroup l2_construct
+ def GetMeshOrder(self):
+ return self.mesh.GetMeshOrder()
+
+ ## Return submesh objects list in meshing order
+ # @return list of list of submesh objects
+ # @ingroup l2_construct
+ def SetMeshOrder(self, submeshes):
+ return self.mesh.SetMeshOrder(submeshes)
+
## Removes all nodes and elements
# @ingroup l2_construct
def Clear(self):
# The replicated nodes should be associated to affected elements.
# @ingroup l2_modif_edit
def DoubleNodeElemGroupInRegion(self, theElems, theNodesNot, theShape):
- return self.editor.DoubleNodeElemGroup(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.
self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers )
self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp )
study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis
+ self.mesh.smeshpyD.SetCurrentStudy( None )
hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so)
self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing
self.distribHyp.SetLayerDistribution( hyp )
Mesh_Algorithm.__init__(self)
self.Create(mesh, geom, "RadialQuadrangle_1D2D")
- self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0)
+ self.distribHyp = None #self.Hypothesis("LayerDistribution2D", UseExisting=0)
self.nbLayers = None
## Return 2D hypothesis holding the 1D one
# hypothesis. Returns the created hypothesis
def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"):
#print "OwnHypothesis",hypType
- if not self.nbLayers is None:
+ if self.nbLayers:
self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers )
+ if self.distribHyp is None:
+ self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0)
+ else:
self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp )
study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis
+ self.mesh.smeshpyD.SetCurrentStudy( None )
hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so)
self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing
self.distribHyp.SetLayerDistribution( hyp )
return hyp
- ## Defines "NumberOfLayers2D" hypothesis, specifying the number of layers
+ ## Defines "NumberOfLayers" hypothesis, specifying the number of layers
# @param n number of layers
# @param UseExisting if ==true - searches for the existing hypothesis created with
# the same parameters, else (default) - creates a new one
- def NumberOfLayers2D(self, n, UseExisting=0):
- self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
+ def NumberOfLayers(self, n, UseExisting=0):
+ if self.distribHyp:
+ self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
self.nbLayers = self.Hypothesis("NumberOfLayers2D", [n], UseExisting=UseExisting,
CompareMethod=self.CompareNumberOfLayers)
self.nbLayers.SetNumberOfLayers( n )