40093367 |
1 | #INTERFACE CAF |
2 | puts "================" |
3 | puts "OCC1228" |
4 | puts "================" |
5 | puts "" |
6 | |
7 | # XLink attributes |
8 | # |
9 | # Testing attribute: TDocStd_XLink |
10 | # |
11 | # Testing command: CopyWithLink |
12 | # |
13 | |
14 | # ANALOG: puts "caf004-B3" |
15 | |
16 | # Create two new documents Doc1, Doc2 |
17 | NewDocument Doc1 BinOcaf |
18 | NewDocument Doc2 BinOcaf |
19 | |
20 | # Set UndoLimit for them |
21 | UndoLimit Doc1 100 |
22 | UndoLimit Doc2 100 |
23 | |
24 | # Set a shape in Doc1 to label 'SLabel' |
25 | set aLabel1 0:2 |
26 | Label Doc1 ${aLabel1} |
27 | SetName Doc1 ${aLabel1} SLabel |
28 | |
29 | set aSetX1 10 |
30 | set aSetY1 20 |
31 | set aSetZ1 30 |
32 | set aSetDX1 100 |
33 | set aSetDY1 200 |
34 | set aSetDZ1 300 |
35 | |
36 | box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1} |
37 | |
1f26f80b |
38 | bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1 |
40093367 |
39 | |
40 | SetShape Doc1 ${aLabel1} aBox1 |
41 | |
42 | # Create a new label 'TLabel1' in Doc1 |
43 | set aLabel2 0:3 |
44 | Label Doc1 ${aLabel2} |
45 | SetName Doc1 ${aLabel2} TLabel1 |
46 | |
47 | # Open transaction in Doc1 |
48 | NewCommand Doc1 |
49 | |
50 | # Copy 'SLabel' to the label 'TLabel1' with link |
51 | CopyWithLink Doc1 ${aLabel2} Doc1 ${aLabel1} |
52 | |
53 | # Close/Open transaction |
54 | NewCommand Doc1 |
55 | |
56 | # Save the document |
8418c617 |
57 | set aFile ${imagedir}/OCC1228-[file tail [info script]].cbf |
40093367 |
58 | file delete ${aFile} |
59 | catch {SaveAs Doc1 ${aFile}} |
60 | if { ![file exists ${aFile}] } { |
61 | puts "There is not ${aFile} file; SaveAs command: Error" |
62 | puts "OCC1228: ERROR (case 1)" |
63 | } |
64 | #catch {exec chmod 777 ${aFile}} |
65 | |
66 | # Restore the document |
67 | Close Doc1 |
68 | catch {Open ${aFile} Doc2} |
69 | |
70 | # Get a shape from 'TLabel1' of restoring document |
71 | set IsDone [catch {GetShape Doc2 ${aLabel2} aBox2} aResult] |
72 | if { ${IsDone} != 0 } { |
73 | puts ${aResult} |
74 | puts "Get a value of TNaming_NamedShape attribute from restoring document: Error" |
75 | puts "OCC1228: ERROR (case 2)" |
76 | } |
77 | |
1f26f80b |
78 | bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2 |
1a0339b4 |
79 | |
80 | if { [dval X1_Box1] != [dval X1_Box2] || |
81 | [dval Y1_Box1] != [dval Y1_Box2] || |
82 | [dval Z1_Box1] != [dval Z1_Box2] || |
83 | [dval X2_Box1] != [dval X2_Box2] || |
84 | [dval Y2_Box1] != [dval Y2_Box2] || |
85 | [dval Z2_Box1] != [dval Z2_Box2] } { |
86 | puts "X1_Box1=[dval X1_Box1] X1_Box2=[dval X1_Box2]" |
87 | puts "Y1_Box1=[dval Y1_Box1] Y1_Box2=[dval Y1_Box2]" |
88 | puts "Z1_Box1=[dval Z1_Box1] Z1_Box2=[dval Z1_Box2]" |
89 | puts "X2_Box1=[dval X2_Box1] X2_Box2=[dval X2_Box2]" |
90 | puts "Y2_Box1=[dval Y2_Box1] Y2_Box2=[dval Y2_Box2]" |
91 | puts "Z2_Box1=[dval Z2_Box1] Z2_Box2=[dval Z2_Box2]" |
40093367 |
92 | puts "Get a link between attributes of the same document from restoring document: Error" |
93 | puts "OCC1228: ERROR (case 3)" |
94 | } else { |
95 | puts "Get a link between attributes of the same document from restoring document: OK" |
96 | puts "OCC1228: OK" |
97 | } |