From: jfa Date: Mon, 25 Apr 2005 06:09:31 +0000 (+0000) Subject: PAL8626: do not publish GEOM object, already present in the study. X-Git-Tag: V2_2_3~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b646c942cce556745d2710e6152da9133e7519be;p=modules%2Fsmesh.git PAL8626: do not publish GEOM object, already present in the study. --- diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py index da30bd82a..2fb7de23f 100644 --- a/src/SMESH_SWIG/smesh.py +++ b/src/SMESH_SWIG/smesh.py @@ -46,11 +46,16 @@ smesh.SetCurrentStudy(salome.myStudy) # Private functions # ----------------- +NO_NAME = "NoName" + def GetName(obj): ior = salome.orb.object_to_string(obj) sobj = salome.myStudy.FindObjectIOR(ior) - attr = sobj.FindAttribute("AttributeName")[1] - return attr.Value() + if sobj is None: + return NO_NAME + else: + attr = sobj.FindAttribute("AttributeName")[1] + return attr.Value() def SetName(obj, name): ior = salome.orb.object_to_string(obj) @@ -91,8 +96,10 @@ class Mesh_Algorithm: name = GetName(piece) else: self.geom = geom - name = geompy.SubShapeName(geom, piece) - geompy.addToStudyInFather(piece, geom, name) + name = GetName(geom) + if name==NO_NAME: + name = geompy.SubShapeName(geom, piece) + geompy.addToStudyInFather(piece, geom, name) self.subm = mesh.mesh.GetSubMesh(geom, hypo) algo = smesh.CreateHypothesis(hypo, so)