40093367 |
1 | #INTERFACE CAF |
2 | puts "================" |
3 | puts "OCC1228" |
4 | puts "================" |
5 | puts "" |
6 | |
7 | # Basic attributes |
8 | # |
9 | # Testing attribute: TDataStd_Shape |
10 | # |
11 | # Testing command: SetShape |
12 | # Testing command: GetShape |
13 | # |
14 | |
15 | # ANALOG: puts "caf001-K3" |
16 | |
17 | # Create a new document and set UndoLimit |
18 | NewDocument Doc BinOcaf |
19 | UndoLimit Doc 100 |
20 | |
21 | # Open a transaction |
22 | NewCommand Doc |
23 | |
24 | # Add an attribute to a data framework |
25 | set aSetX1 10 |
26 | set aSetY1 20 |
27 | set aSetZ1 30 |
28 | set aSetDX1 100 |
29 | set aSetDY1 200 |
30 | set aSetDZ1 300 |
31 | |
32 | box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1} |
33 | |
1f26f80b |
34 | bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1 |
40093367 |
35 | |
36 | set aLabel 0:2 |
37 | SetShape Doc ${aLabel} aBox1 |
38 | |
39 | # Close/Open the transaction |
40 | NewCommand Doc |
41 | |
42 | # Save the document |
8418c617 |
43 | set aFile ${imagedir}/OCC1228-[file tail [info script]].cbf |
40093367 |
44 | file delete ${aFile} |
45 | catch {SaveAs Doc ${aFile}} |
46 | if { ![file exists ${aFile}] } { |
47 | puts "There is not ${aFile} file; SaveAs command: Error" |
48 | puts "OCC1228: ERROR (case 1)" |
49 | } |
50 | #catch {exec chmod 777 ${aFile}} |
51 | |
52 | # Restore the document |
53 | Close Doc |
54 | catch {Open ${aFile} DDoc} |
55 | |
56 | # Get a value of the attribute |
57 | set IsDone [catch {GetShape DDoc ${aLabel} aBox5} aResult] |
58 | if { ${IsDone} != 0 } { |
59 | puts ${aResult} |
60 | puts "Get a value of TDataStd_Shape attribute from restoring document: Error" |
61 | puts "OCC1228: ERROR (case 2)" |
62 | } |
63 | |
1f26f80b |
64 | bounding aBox5 -save X1_Box5 Y1_Box5 Z1_Box5 X2_Box5 Y2_Box5 Z2_Box5 |
40093367 |
65 | |
1a0339b4 |
66 | if { [dval X1_Box1] != [dval X1_Box5] || |
67 | [dval Y1_Box1] != [dval Y1_Box5] || |
68 | [dval Z1_Box1] != [dval Z1_Box5] || |
69 | [dval X2_Box1] != [dval X2_Box5] || |
70 | [dval Y2_Box1] != [dval Y2_Box5] || |
71 | [dval Z2_Box1] != [dval Z2_Box5] } { |
72 | puts "X1_Box1=[dval X1_Box1] X1_Box5=[dval X1_Box5]" |
73 | puts "Y1_Box1=[dval Y1_Box1] Y1_Box5=[dval Y1_Box5]" |
74 | puts "Z1_Box1=[dval Z1_Box1] Z1_Box5=[dval Z1_Box5]" |
75 | puts "X2_Box1=[dval X2_Box1] X2_Box5=[dval X2_Box5]" |
76 | puts "Y2_Box1=[dval Y2_Box1] Y2_Box5=[dval Y2_Box5]" |
77 | puts "Z2_Box1=[dval Z2_Box1] Z2_Box5=[dval Z2_Box5]" |
40093367 |
78 | puts "Get a value of TDataStd_Shape attribute from restoring document: Error" |
79 | puts "OCC1228: ERROR (case 3)" |
80 | } else { |
81 | puts "Get a value of TDataStd_Shape attribute from restoring document: OK" |
82 | puts "OCC1228: OK" |
83 | } |