mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +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,11 +390,18 @@ def IsEqual(val1, val2, tol=PrecisionConfusion):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
NO_NAME = "NoName"
|
||||||
|
|
||||||
## Gets object name
|
## Gets object name
|
||||||
def GetName(obj):
|
def GetName(obj):
|
||||||
|
if obj:
|
||||||
|
# object not null
|
||||||
if isinstance(obj, SALOMEDS._objref_SObject):
|
if isinstance(obj, SALOMEDS._objref_SObject):
|
||||||
|
# study object
|
||||||
return obj.GetName()
|
return obj.GetName()
|
||||||
ior = salome.orb.object_to_string(obj)
|
ior = salome.orb.object_to_string(obj)
|
||||||
|
if ior:
|
||||||
|
# CORBA object
|
||||||
studies = salome.myStudyManager.GetOpenStudies()
|
studies = salome.myStudyManager.GetOpenStudies()
|
||||||
for sname in studies:
|
for sname in studies:
|
||||||
s = salome.myStudyManager.GetStudyByName(sname)
|
s = salome.myStudyManager.GetStudyByName(sname)
|
||||||
@ -402,6 +409,17 @@ def GetName(obj):
|
|||||||
sobj = s.FindObjectIOR(ior)
|
sobj = s.FindObjectIOR(ior)
|
||||||
if not sobj: continue
|
if not sobj: continue
|
||||||
return sobj.GetName()
|
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"
|
raise RuntimeError, "Null or invalid object"
|
||||||
|
|
||||||
## Prints error message if a hypothesis was not assigned.
|
## Prints error message if a hypothesis was not assigned.
|
||||||
|
Loading…
Reference in New Issue
Block a user