1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
\r
3 <!-- hennerik CVSweb $Revision$ -->
\r
4 <TITLE>Example</TITLE></HEAD>
\r
5 <BODY BGCOLOR="#eeeeee">
\r
6 <HR noshade><PRE>#%AttributePixMap interface (creations/saving/restoring)%
\r
7 #%SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open%
\r
8 #%Attribute methods : SetPixMap, GetPixMap%
\r
10 #--------------------------------------------------------------------------
\r
12 #--------------------------------------------------------------------------
\r
13 # create AttributePixMap
\r
14 #===============================
\r
15 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributePixMap")
\r
17 raise RuntimeError, "Can't create AttributePixMap attribute"
\r
18 aPixmap = A._narrow(SALOMEDS.AttributePixMap);
\r
19 aPixmap.SetPixMap( "ICON_OBJBROWSER_Geometry" );
\r
21 if aPixmap.GetPixMap() != "ICON_OBJBROWSER_Geometry":
\r
22 print "Error: wrong value of AttributePixMap"
\r
25 # save / restore study
\r
26 #============================================================
\r
27 str= os.getenv("TmpDir")
\r
29 str = "/tmp"
\r
30 file = str+"/test.hdf"
\r
32 batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
\r
33 openedStudy = batchmode_geompy.myStudyManager.Open(file);
\r
35 if openedStudy == None:
\r
36 raise RuntimeError, "Can't open saved study!"
\r
38 father = openedStudy.FindComponent("GEOM")
\r
40 raise RuntimeError, "Geom component is not found! Wrong study is opened."
\r
43 # find AttributePixMap
\r
44 #============================================================
\r
46 res,A=father.FindAttribute("AttributePixMap")
\r
47 if res == 0 or A == None:
\r
48 raise RuntimeError, "Error: AttributePixMap not found "
\r
50 A = A._narrow(SALOMEDS.AttributePixMap)
\r
53 raise RuntimeError, "Can't create AttributePixMap attribute"
\r
55 if A.GetPixMap() != "ICON_OBJBROWSER_Geometry":
\r
56 print "Error: wrong value of AttributePixMap"
\r