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>#%AttributeComment interface(creations/saving/restoring)%
\r
7 #%SALOMEDS methods : FindOrCreateAttribute, SaveAs FindComponent FindAttribute Open%
\r
8 #%Attribute methods : Value, SetValue%
\r
10 # create AttributeComment
\r
11 #===========================================================
\r
12 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeComment")
\r
14 raise RuntimeError, "Can't create AttributeComment attribute"
\r
15 A = A._narrow(SALOMEDS.AttributeComment)
\r
18 raise RuntimeError, "Can't create AttributeComment attribute"
\r
20 A.SetValue("GEOM")
\r
23 # save / restore study
\r
24 #============================================================
\r
25 str= os.getenv("TmpDir")
\r
27 str = "/tmp"
\r
28 file = str+"/test.hdf"
\r
30 batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
\r
31 openedStudy = batchmode_geompy.myStudyManager.Open(file);
\r
33 if openedStudy == None:
\r
34 raise RuntimeError, "Can't open saved study!"
\r
36 father = openedStudy.FindComponent("GEOM")
\r
38 raise RuntimeError, "Geom component is not found! Wrong study is opened."
\r
41 # find AttributeComment
\r
42 #============================================================
\r
44 res,A=father.FindAttribute("AttributeComment")
\r
45 if res == 0 or A == None:
\r
46 raise RuntimeError, "Error: not found AttributeComment"
\r
48 A = A._narrow(SALOMEDS.AttributeComment)
\r
51 raise RuntimeError, "Can't create AttributeComment attribute"
\r
53 if A.Value() != "GEOM":
\r
54 "Error: wrong value of AttributeComment"
\r