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>#%AttributeSequenceOfInteger interface(creations/saving/restoring)%
\r
7 #%SALOMEDS methods : FindOrCreateAttribute FindComponent FindAttribute Open Add SaveAs%
\r
8 #%AttributeSequenceOfInteger methods : Value, Remove, Length%
\r
10 # create AttributeSequenceOfInteger
\r
11 #==========================================
\r
12 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeSequenceOfInteger")
\r
14 raise RuntimeError, "Can't create AttributeSequenceOfInteger attribute"
\r
15 A = A._narrow(SALOMEDS.AttributeSequenceOfInteger)
\r
17 raise RuntimeError, "Can't create AttributeSequenceOfInteger attribute"
\r
26 A.ChangeValue(4,500)
\r
30 print "Wrong length of SequenceOfInteger"
\r
31 if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) != 700:
\r
32 print "Wrong value of AttributeSequenceOfInteger"
\r
35 # save / restore study
\r
36 #=================================
\r
37 str= os.getenv("TmpDir")
\r
39 str = "/tmp"
\r
40 file = str+"/test.hdf"
\r
41 batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
\r
42 openedStudy=batchmode_geompy.myStudyManager.Open(file);
\r
44 if openedStudy == None:
\r
45 raise RuntimeError, "Can't open saved study!"
\r
48 father = openedStudy.FindComponent("GEOM")
\r
50 raise RuntimeError, "Geom component is not found! Wrong study is opened."
\r
53 # find AttributeSequenceOfInteger
\r
54 #======================================
\r
56 res,A=father.FindAttribute("AttributeSequenceOfInteger")
\r
57 if res == 0 or A == None:
\r
58 raise RuntimeError, "Error: not found AttributeSequenceOfInteger"
\r
60 A = A._narrow(SALOMEDS.AttributeSequenceOfInteger)
\r
63 print "Wrong length of SequenceOfInteger"
\r
64 if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) != 700:
\r
65 print "Wrong value of AttributeSequenceOfInteger"
\r