Salome HOME
Merge V9_dev branch into master
[modules/kernel.git] / doc / salome / examples / example13
1
2 #--------------------------------------------------------------------------
3 #              create    AttributeTextHighlightColor
4 #===========================================================
5
6 import SALOMEDS_Attributes_idl
7 highlightcolor=SALOMEDS_Attributes_idl._0_SALOMEDS.Color(256,256,256)
8
9 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeTextHighlightColor")
10
11 if A == None :
12         raise  RuntimeError, "Can't create AttributeTextHighlightColor attribute"
13 A = A._narrow(SALOMEDS.AttributeTextHighlightColor)
14
15 if A == None :
16         raise  RuntimeError, "Can't create AttributeTextHighlightColor attribute"
17
18 A.SetTextHighlightColor(highlightcolor)
19
20 c = A.TextHighlightColor();
21 if c.R != 256 or c.G != 256 or c.B != 256:
22         print("Error: wrong value of AttributeTextHighlightColor")
23
24
25 #      save / restore study      
26 #============================================================
27 str= os.getenv("TmpDir")
28 if str == None:
29         str = "/tmp"
30 file = str+"/test.hdf"
31
32 batchmode_geompy.myStudy.SaveAs(file)
33 openedStudy=batchmode_geompy.myStudy.Open(file);
34
35 if openedStudy == None:
36         raise  RuntimeError, "Can't open saved study!"
37
38 father = openedStudy.FindComponent("GEOM")
39 if father is None:
40          raise  RuntimeError, "Geom component is not found!  Wrong study is opened." 
41
42
43 #       find   AttributeTextHighlightColor
44 #============================================================
45
46 res, A = father.FindAttribute("AttributeTextHighlightColor")
47 print(res, A)
48 if res == 0 or A == None:
49         raise  RuntimeError, "Error:  not found AttributeTextHighlightColor"
50
51 A = A._narrow(SALOMEDS.AttributeTextHighlightColor)
52
53 if A == None :
54         raise  RuntimeError, "Can't create AttributeTextHighlightColor attribute"
55
56 c = A.TextHighlightColor();
57
58 if c.R != 256 or c.G != 256 or c.B != 256:
59         print("Error: wrong value of AttributeTextTextHighlightColor")
60