Version: 8.3.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
example9

AttributeSelectable interface(creations/saving/restoring)
SALOMEDS methods: FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open
Attribute methods: SetSelectable, IsSelectable

# create AttributeSelectable
#===========================================================
A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeSelectable")
if A == None :
raise RuntimeError, "Can't create AttributeSelectable attribute"
A = A._narrow(SALOMEDS.AttributeSelectable)
if A == None :
raise RuntimeError, "Can't create AttributeSelectable attribute"
A.SetSelectable(1)
if A.IsSelectable() == 0:
"Error: wrong value of AttributeSelectable"
# 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 AttributeSelectable
#============================================================
res,A=father.FindAttribute("AttributeSelectable")
if res == 0 or A == None:
raise RuntimeError, "Error: not found AttributeSelectable"
A = A._narrow(SALOMEDS.AttributeSelectable)
if A == None :
raise RuntimeError, "Can't create AttributeSelectable attribute"
if A.IsSelectable() == 0:
"Error: wrong value of AttributeSelectable"