2 # create AttributePersistentRef
3 #===========================================================
4 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributePersistentRef")
6 raise RuntimeError, "Can't create AttributePersistentRef attribute"
7 A = A._narrow(SALOMEDS.AttributePersistentRef)
10 raise RuntimeError, "Can't create AttributePersistentRef attribute"
12 A.SetValue("/tmp/test;1")
14 # save / restore study
15 #============================================================
16 str= os.getenv("TmpDir")
19 file = str+"/test.hdf"
21 batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
22 openedStudy = batchmode_geompy.myStudyManager.Open(file);
24 if openedStudy == None:
25 raise RuntimeError, "Can't open saved study!"
27 father = openedStudy.FindComponent("GEOM")
29 raise RuntimeError, "Geom component is not found! Wrong study is opened."
32 # find AttributePersistentRef
33 #============================================================
35 res,A=father.FindAttribute("AttributePersistentRef")
36 if res == 0 or A == None:
37 raise RuntimeError, "Error: not found AttributePersistentRef"
39 A = A._narrow(SALOMEDS.AttributePersistentRef)
42 raise RuntimeError, "Can't create AttributePersistentRef attribute"
44 if A.Value() != "/tmp/test;1":
45 "Error: wrong value of AttributePersistentRef"