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>#%AttributeName interface(creations/saving/restoring)%
\r
7 #%SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent FindAttribute Open%
\r
8 #%Attribute methods : SetValue, Value%
\r
10 # create AttributeName
\r
11 #===========================================================
\r
12 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeName")
\r
14 raise RuntimeError, "Can't create AttributeName attribute"
\r
15 A = A._narrow(SALOMEDS.AttributeName)
\r
18 raise RuntimeError, "Can't create AttributeName attribute"
\r
19 A.SetValue("AttributesTesting")
\r
21 if A.Value() != "AttributesTesting":
\r
22 print "Wrong value of AttributeName"
\r
25 # save / restore study
\r
26 #=================================
\r
27 str= os.getenv("TmpDir")
\r
29 str = "/tmp"
\r
30 file = str+"/test.hdf"
\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 AttributeName
\r
45 #======================================
\r
47 res,A=father.FindAttribute("AttributeName")
\r
48 if res == 0 or A == None:
\r
49 raise RuntimeError, "Error: not found AttributeName"
\r
51 A = A._narrow(SALOMEDS.AttributeName)
\r
54 raise RuntimeError, "Can't create AttributeName attribute"
\r
56 if A.Value() != "AttributesTesting":
\r
57 print "Wrong value of AttributeName"
\r