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>#%AttributeDrawable interface(creations/saving/restoring)%
\r
7 #%SALOMEDS methods : FindOrCreateAttribute, SaveAs, FindComponent, FindAttribute, Open%
\r
8 #%Attribute methods : SetDrawable, IsDrawable%
\r
9 #--------------------------------------------------------------------------
\r
11 from batchmode_geompy import *
\r
14 #--------------------------------------------------------------------------
\r
15 # create AttributeDrawable
\r
16 #===========================================================
\r
17 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeDrawable")
\r
19 raise RuntimeError, "Can't create AttributeDrawable attribute"
\r
20 A = A._narrow(SALOMEDS.AttributeDrawable)
\r
23 raise RuntimeError, "Can't create AttributeDrawable attribute"
\r
27 if A.IsDrawable() == 0:
\r
28 "Error: wrong value of AttributeDrawable"
\r
31 # save / restore study
\r
32 #============================================================
\r
33 str= os.getenv("TmpDir")
\r
35 str = "/tmp"
\r
36 file = str+"/test.hdf"
\r
38 batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
\r
39 openedStudy=batchmode_geompy.myStudyManager.Open(file);
\r
41 if openedStudy == None:
\r
42 raise RuntimeError, "Can't open saved study!"
\r
44 father = openedStudy.FindComponent("GEOM")
\r
46 raise RuntimeError, "Geom component is not found! Wrong study is opened."
\r
49 # find AttributeDrawable
\r
50 #============================================================
\r
52 res,A=father.FindAttribute("AttributeDrawable")
\r
53 if res == 0 or A == None:
\r
54 raise RuntimeError, "Error: not found AttributeDrawable"
\r
56 A = A._narrow(SALOMEDS.AttributeDrawable)
\r
59 raise RuntimeError, "Can't create AttributeDrawable attribute"
\r
61 if A.IsDrawable() == 0:
\r
62 "Error: wrong value of AttributeDrawable"
\r