X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_SWIG%2Fsmesh.py;h=2fb7de23f19e59c0fc2f19c5dd4022d183d50514;hb=5e356c3e2c3f58ecba541d647be65193099cd67c;hp=da30bd82a8e6ceeefa3834650ee8cf40f24210c9;hpb=85f8b0f4495dc625b45b44c8c44c4969230d6065;p=modules%2Fsmesh.git 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)