From: vsr Date: Fri, 12 Feb 2010 06:07:26 +0000 (+0000) Subject: Issue 0020701: EDF SMESH : GetName Method of smeshDC.py X-Git-Tag: V5_1_4a1~92 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8321c7460e83e7d0ed954fd577e7b26a7d7f025b;p=modules%2Fsmesh.git Issue 0020701: EDF SMESH : GetName Method of smeshDC.py --- diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index dafa111b0..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 @@ -393,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):