Salome HOME
This commit was generated by cvs2git to create tag 'V1_4_0b2'.
[modules/kernel.git] / doc / html / INPUT / exemple / Example10.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>\r
2 <HEAD>\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 &nbsp;FindAttribute Open%\r
8 #%Attribute methods : SetExpandable IsExpandable%\r
9 \r
10 # &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;create &nbsp; &nbsp;AttributeExpandable\r
11 #===========================================================\r
12 A = batchmode_geompy.myBuilder.FindOrCreateAttribute( batchmode_geompy.father, &quot;AttributeExpandable&quot;)\r
13 if A == None :\r
14  &nbsp; &nbsp; &nbsp; &nbsp;raise &nbsp;RuntimeError, &quot;Can't create AttributeExpandable attribute&quot;\r
15 A = A._narrow(SALOMEDS.AttributeExpandable)\r
16 \r
17 if A == None :\r
18  &nbsp; &nbsp; &nbsp; &nbsp;raise &nbsp;RuntimeError, &quot;Can't create AttributeExpandable attribute&quot;\r
19 \r
20 A.SetExpandable(1)\r
21 \r
22 if A.IsExpandable() == 0:\r
23  &nbsp; &nbsp; &nbsp; &nbsp;&quot;Error: wrong value of AttributeExpandable&quot;\r
24 \r
25 \r
26 # &nbsp; &nbsp; &nbsp;save / restore study &nbsp; &nbsp; &nbsp;\r
27 #============================================================\r
28 str= os.getenv(&quot;TmpDir&quot;)\r
29 if str == None:\r
30  &nbsp; &nbsp; &nbsp; &nbsp;str = &quot;/tmp&quot;\r
31 file = str+&quot;/test.hdf&quot;\r
32 \r
33 batchmode_geompy.myStudyManager.SaveAs(file, &nbsp;batchmode_geompy.myStudy)\r
34 openedStudy = batchmode_geompy.myStudyManager.Open(file);\r
35 \r
36 if openedStudy == None:\r
37  &nbsp; &nbsp; &nbsp; &nbsp;raise &nbsp;RuntimeError, &quot;Can't open saved study!&quot;\r
38 \r
39 father = openedStudy.FindComponent(&quot;GEOM&quot;)\r
40 if father is None:\r
41  &nbsp; &nbsp; &nbsp; &nbsp; raise &nbsp;RuntimeError, &quot;Geom component is not found! &nbsp;Wrong study is opened.&quot; \r
42 \r
43 \r
44 # &nbsp; &nbsp; find &nbsp; AttributeExpandable\r
45 #============================================================\r
46 \r
47 res,A=father.FindAttribute(&quot;AttributeExpandable&quot;)\r
48 if res == 0 or A == None:\r
49  &nbsp; &nbsp; &nbsp; &nbsp;raise &nbsp;RuntimeError, &quot;Error: &nbsp;not found AttributeExpandable&quot;\r
50 \r
51 A = A._narrow(SALOMEDS.AttributeExpandable)\r
52 \r
53 if A == None :\r
54  &nbsp; &nbsp; &nbsp; &nbsp;raise &nbsp;RuntimeError, &quot;Can't create AttributeExpandable attribute&quot;\r
55 \r
56 if A.IsExpandable() == 0:\r
57  &nbsp; &nbsp; &nbsp; &nbsp;&quot;Error: wrong value of AttributeExpandable&quot;\r
58 \r
59 </PRE>