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>#%AttributeTextColor interface (creations/saving/restoring)%
\r
7 #%SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open%
\r
8 #%Attribute methods : SetTextColor TextColor%
\r
11 #--------------------------------------------------------------------------
\r
12 # create AttributeTextColor
\r
13 #===========================================================
\r
14 import SALOMEDS_Attributes_idl
\r
15 color = SALOMEDS_Attributes_idl._0_SALOMEDS.Color(234,345,231)
\r
17 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeTextColor")
\r
20 raise RuntimeError, "Can't create AttributeTextColor attribute"
\r
21 A = A._narrow(SALOMEDS.AttributeTextColor)
\r
24 raise RuntimeError, "Can't create AttributeTextColor attribute"
\r
26 A.SetTextColor(color)
\r
30 if c.R != 234 or c.G != 345 or c.B != 231:
\r
31 print "Error: wrong value of AttributeTextColor"
\r
33 # save / restore study
\r
34 #============================================================
\r
35 str= os.getenv("TmpDir")
\r
37 str = "/tmp"
\r
38 file = str+"/test.hdf"
\r
40 batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
\r
41 openedStudy = batchmode_geompy.myStudyManager.Open(file);
\r
43 if openedStudy == None:
\r
44 raise RuntimeError, "Can't open saved study!"
\r
46 father = openedStudy.FindComponent("GEOM")
\r
48 raise RuntimeError, "Geom component is not found! Wrong study is opened."
\r
51 # find AttributeTextColor
\r
52 #============================================================
\r
54 res,A=father.FindAttribute("AttributeTextColor")
\r
55 if res == 0 or A == None:
\r
56 raise RuntimeError, "Error: not found AttributeTextColor"
\r
58 A = A._narrow(SALOMEDS.AttributeTextColor)
\r
61 raise RuntimeError, "Can't create AttributeTextColor attribute"
\r
64 if c.R != 234 or c.G != 345 or c.B != 231:
\r
65 print "Error: wrong value of AttributeTextColor"
\r