Salome HOME
Revert "Synchronize adm files"
[modules/kernel.git] / doc / salome / examples / example14
1
2 #--------------------------------------------------------------------------
3 #   create  AttributePixMap
4 #===============================
5 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributePixMap")
6 if A == None :
7         raise  RuntimeError, "Can't create AttributePixMap attribute"
8 aPixmap = A._narrow(SALOMEDS.AttributePixMap);
9 aPixmap.SetPixMap( "ICON_OBJBROWSER_Geometry" );
10
11 if aPixmap.GetPixMap() != "ICON_OBJBROWSER_Geometry":
12         print "Error: wrong value of AttributePixMap"
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.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
23 openedStudy = batchmode_geompy.myStudyManager.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   AttributePixMap
34 #============================================================
35
36 res,A=father.FindAttribute("AttributePixMap")
37 if res == 0 or A == None:
38         raise  RuntimeError, "Error: AttributePixMap not found "
39
40 A = A._narrow(SALOMEDS.AttributePixMap)
41
42 if A == None :
43         raise  RuntimeError, "Can't create AttributePixMap attribute"
44
45 if A.GetPixMap() != "ICON_OBJBROWSER_Geometry":
46         print "Error: wrong value of AttributePixMap"
47