Salome HOME
Merge branch 'omu/Launcher9'
[modules/kernel.git] / doc / salome / examples / example6
1
2 #              create     AttributeComment 
3 #===========================================================
4 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeComment")
5 if A == None :
6         raise  RuntimeError, "Can't create AttributeComment attribute"
7 A = A._narrow(SALOMEDS.AttributeComment)
8
9 if A == None :
10         raise  RuntimeError, "Can't create AttributeComment attribute"
11
12 A.SetValue("GEOM")
13
14
15 #      save / restore study      
16 #============================================================
17 str= os.getenv("TmpDir")
18 if str == None:
19         str = "/tmp"
20 file = str+"/test.hdf"
21
22 batchmode_geompy.myStudy.SaveAs(file)
23 openedStudy = batchmode_geompy.myStudy.Open(file);
24
25 if openedStudy == None:
26         raise  RuntimeError, "Can't open saved study!"
27
28 father = openedStudy.FindComponent("GEOM")
29 if father is None:
30          raise  RuntimeError, "Geom component is not found!  Wrong study is opened." 
31
32
33 #      find    AttributeComment
34 #============================================================
35
36 res,A=father.FindAttribute("AttributeComment")
37 if res == 0 or A == None:
38         raise  RuntimeError, "Error:  not found AttributeComment"
39
40 A = A._narrow(SALOMEDS.AttributeComment)
41
42 if A == None :
43         raise  RuntimeError, "Can't create AttributeComment attribute"
44
45 if A.Value() != "GEOM":
46         "Error: wrong value of AttributeComment"
47