mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 08:50:35 +05:00
0020702: [CEA] Problem with Segment function of SMESH module
0020701: EDF SMESH : GetName Method of smeshDC.py Additional fix
This commit is contained in:
parent
68b6c38588
commit
97a2f52e50
@ -390,18 +390,36 @@ def IsEqual(val1, val2, tol=PrecisionConfusion):
|
||||
return True
|
||||
return False
|
||||
|
||||
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)
|
||||
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()
|
||||
if obj:
|
||||
# object not null
|
||||
if isinstance(obj, SALOMEDS._objref_SObject):
|
||||
# study object
|
||||
return obj.GetName()
|
||||
ior = salome.orb.object_to_string(obj)
|
||||
if ior:
|
||||
# CORBA object
|
||||
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()
|
||||
if hasattr(obj, "GetName"):
|
||||
# unknown CORBA object, having GetName() method
|
||||
return obj.GetName()
|
||||
else:
|
||||
# unknown CORBA object, no GetName() method
|
||||
return NO_NAME
|
||||
pass
|
||||
if hasattr(obj, "GetName"):
|
||||
# unknown non-CORBA object, having GetName() method
|
||||
return obj.GetName()
|
||||
pass
|
||||
raise RuntimeError, "Null or invalid object"
|
||||
|
||||
## Prints error message if a hypothesis was not assigned.
|
||||
|
Loading…
Reference in New Issue
Block a user