X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_SWIG%2FsmeshDC.py;h=cd769182d9988e27209938f9b91fb5cb0518330f;hb=8321c7460e83e7d0ed954fd577e7b26a7d7f025b;hp=4789415c96b2ac875e48a97c99d1d6f60d907771;hpb=2daa321efae3d0c6ce41199fa5a2482630d505d9;p=modules%2Fsmesh.git diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index 4789415c9..cd769182d 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -99,6 +99,7 @@ from SMESH import * import StdMeshers import SALOME +import SALOMEDS # import NETGENPlugin module if possible noNETGENPlugin = 0 @@ -162,6 +163,8 @@ Hexa = 8 Hexotic = 9 BLSURF = 10 GHS3DPRL = 11 +QUARDANGLE = 0 +RADIAL_QUAD = 1 # MirrorType enumeration POINT = SMESH_MeshEditor.POINT @@ -391,13 +394,17 @@ NO_NAME = "NoName" ## 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): @@ -1031,17 +1038,20 @@ class Mesh: 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 @@ -1201,6 +1211,18 @@ class Mesh: 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): @@ -3518,7 +3540,7 @@ class Mesh: # 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. @@ -4912,6 +4934,7 @@ class Mesh_RadialPrism3D(Mesh_Algorithm): 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 ) @@ -4998,7 +5021,7 @@ class Mesh_RadialQuadrangle1D2D(Mesh_Algorithm): 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 @@ -5009,21 +5032,26 @@ class Mesh_RadialQuadrangle1D2D(Mesh_Algorithm): # 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 )