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>#%AttributeExpandable interface(creations/saving/restoring)%
\r
7 #%SALOMEDS methods : SaveAs FindComponent FindAttribute Open%
\r
8 #%Attribute methods : SetExpandable IsExpandable%
\r
10 # create AttributeExpandable
\r
11 #===========================================================
\r
12 A = batchmode_geompy.myBuilder.FindOrCreateAttribute( batchmode_geompy.father, "AttributeExpandable")
\r
14 raise RuntimeError, "Can't create AttributeExpandable attribute"
\r
15 A = A._narrow(SALOMEDS.AttributeExpandable)
\r
18 raise RuntimeError, "Can't create AttributeExpandable attribute"
\r
22 if A.IsExpandable() == 0:
\r
23 "Error: wrong value of AttributeExpandable"
\r
26 # save / restore study
\r
27 #============================================================
\r
28 str= os.getenv("TmpDir")
\r
30 str = "/tmp"
\r
31 file = str+"/test.hdf"
\r
33 batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
\r
34 openedStudy = batchmode_geompy.myStudyManager.Open(file);
\r
36 if openedStudy == None:
\r
37 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 AttributeExpandable
\r
45 #============================================================
\r
47 res,A=father.FindAttribute("AttributeExpandable")
\r
48 if res == 0 or A == None:
\r
49 raise RuntimeError, "Error: not found AttributeExpandable"
\r
51 A = A._narrow(SALOMEDS.AttributeExpandable)
\r
54 raise RuntimeError, "Can't create AttributeExpandable attribute"
\r
56 if A.IsExpandable() == 0:
\r
57 "Error: wrong value of AttributeExpandable"
\r