1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
\r
3 <!-- hennerik CVSweb $Revision$ -->
\r
4 <TITLE>Exemple</TITLE></HEAD>
\r
5 <BODY BGCOLOR="#eeeeee">
\r
6 <HR noshade><PRE>#%AttributeReal interface (creations/saving/restoring)%
\r
7 #%Methods : FindOrCreateAttribute, Value, SaveAs, SetValue, FindComponent, FindAttribute, Open%
\r
10 # create AttributeReal
\r
11 #=================================
\r
12 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeReal")
\r
14 raise RuntimeError, "Can't create AttributeReal attribute"
\r
15 A = A._narrow(SALOMEDS.AttributeReal)
\r
17 if A.Value() != 0.0001:
\r
18 raise RuntimeError, "Error : wrong value of AttributeReal"
\r
20 # save / restore study
\r
21 #=================================
\r
23 str= os.getenv("TmpDir")
\r
25 str = "/tmp"
\r
26 file = str+"/test.hdf"
\r
28 #file = "/tmp/ggg.hdf"
\r
30 print " ------- We will save to", file, "-----------"
\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
39 father = openedStudy.FindComponent("GEOM")
\r
41 raise RuntimeError, "Geom component is not found! Wrong study is opened."
\r
44 # find AttributeReal
\r
45 #=================================
\r
47 res,A=father.FindAttribute("AttributeReal")
\r
48 if res == 0 or A == None:
\r
49 raise RuntimeError, "Error: not found AttributeReal"
\r
51 A = A._narrow(SALOMEDS.AttributeReal)
\r
52 if A.Value() != 0.0001:
\r
53 raise RuntimeError, "Error : wrong value of AttributeReal"
\r