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>#%AttributeLocalID interface(creations/saving/restoring)%
\r
7 #%SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open%
\r
8 #%Attribute methods : Value, SetValue%
\r
10 # create AttributeLocalID
\r
11 #=================================
\r
12 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeLocalID")
\r
14 raise RuntimeError, "Can't create AttributeLocalID attribute"
\r
15 A = A._narrow(SALOMEDS.AttributeLocalID)
\r
17 A.SetValue(763242882)
\r
19 if A.Value() != 763242882:
\r
20 print "Error: wrong value of AttributeLocalID"
\r
22 # save / restore study
\r
23 #=================================
\r
24 str= os.getenv("TmpDir")
\r
26 str = "/tmp"
\r
27 file = str+"/test.hdf"
\r
29 batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
\r
30 openedStudy = batchmode_geompy.myStudyManager.Open(file);
\r
32 if openedStudy == None:
\r
33 raise RuntimeError, "Can't open saved study!"
\r
35 father = openedStudy.FindComponent("GEOM")
\r
37 raise RuntimeError, "Geom component is not found! Wrong study is opened."
\r
40 # find AttributeLocalID
\r
41 #=================================
\r
43 res,A=father.FindAttribute("AttributeLocalID")
\r
44 if res == 0 or A == None:
\r
45 raise RuntimeError, "Error: not found AttributeLocalID"
\r
47 A = A._narrow(SALOMEDS.AttributeLocalID)
\r
49 if A.Value() != 763242882:
\r
50 print "Error: wrong value of AttributeLocalID"
\r