Version: 6.5.0
example5

AttributeName interface(creations/saving/restoring)
SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent FindAttribute Open
Attribute methods : SetValue, Value

# create AttributeName
#===========================================================
A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeName")
if A == None :
raise RuntimeError, "Can't create AttributeName attribute"
A = A._narrow(SALOMEDS.AttributeName)
if A == None :
raise RuntimeError, "Can't create AttributeName attribute"
A.SetValue("AttributesTesting")
if A.Value() != "AttributesTesting":
print "Wrong value of AttributeName"
# save / restore study
#=================================
str= os.getenv("TmpDir")
if str == None:
str = "/tmp"
file = str+"/test.hdf"
batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
openedStudy = batchmode_geompy.myStudyManager.Open(file);
if openedStudy == None:
raise RuntimeError, "Can't open saved study!"
father = openedStudy.FindComponent("GEOM")
if father is None:
raise RuntimeError, "Geom component is not found! Wrong study is opened."
# find AttributeName
#======================================
res,A=father.FindAttribute("AttributeName")
if res == 0 or A == None:
raise RuntimeError, "Error: not found AttributeName"
A = A._narrow(SALOMEDS.AttributeName)
if A == None :
raise RuntimeError, "Can't create AttributeName attribute"
if A.Value() != "AttributesTesting":
print "Wrong value of AttributeName"
Copyright © 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS