2 puts "================"
4 puts "================"
9 # Testing attribute: TDocStd_XLink
11 # Testing command: CopyWithLink
14 # ANALOG: puts "caf004-B3"
16 # Create two new documents Doc1, Doc2
17 NewDocument Doc1 BinOcaf
18 NewDocument Doc2 BinOcaf
20 # Set UndoLimit for them
24 # Set a shape in Doc1 to label 'SLabel'
27 SetName Doc1 ${aLabel1} SLabel
36 box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
38 set aBoundingBox1 [bounding aBox1]
39 set X1_Box1 [lindex ${aBoundingBox1} 0]
40 set Y1_Box1 [lindex ${aBoundingBox1} 1]
41 set Z1_Box1 [lindex ${aBoundingBox1} 2]
42 set X2_Box1 [lindex ${aBoundingBox1} 3]
43 set Y2_Box1 [lindex ${aBoundingBox1} 4]
44 set Z2_Box1 [lindex ${aBoundingBox1} 5]
46 SetShape Doc1 ${aLabel1} aBox1
48 # Create a new label 'TLabel1' in Doc1
51 SetName Doc1 ${aLabel2} TLabel1
53 # Open transaction in Doc1
56 # Copy 'SLabel' to the label 'TLabel1' with link
57 CopyWithLink Doc1 ${aLabel2} Doc1 ${aLabel1}
59 # Close/Open transaction
63 set aFile ${WorkDirectory}/OCC1228-[file tail [info script]].cbf
65 catch {SaveAs Doc1 ${aFile}}
66 if { ![file exists ${aFile}] } {
67 puts "There is not ${aFile} file; SaveAs command: Error"
68 puts "OCC1228: ERROR (case 1)"
70 #catch {exec chmod 777 ${aFile}}
72 # Restore the document
74 catch {Open ${aFile} Doc2}
76 # Get a shape from 'TLabel1' of restoring document
77 set IsDone [catch {GetShape Doc2 ${aLabel2} aBox2} aResult]
78 if { ${IsDone} != 0 } {
80 puts "Get a value of TNaming_NamedShape attribute from restoring document: Error"
81 puts "OCC1228: ERROR (case 2)"
84 catch {set aBoundingBox2 [bounding aBox2]}
91 catch {set X1_Box2 [lindex ${aBoundingBox2} 0]}
92 catch {set Y1_Box2 [lindex ${aBoundingBox2} 1]}
93 catch {set Z1_Box2 [lindex ${aBoundingBox2} 2]}
94 catch {set X2_Box2 [lindex ${aBoundingBox2} 3]}
95 catch {set Y2_Box2 [lindex ${aBoundingBox2} 4]}
96 catch {set Z2_Box2 [lindex ${aBoundingBox2} 5]}
98 if { ${X1_Box1} != ${X1_Box2} ||
99 ${Y1_Box1} != ${Y1_Box2} ||
100 ${Z1_Box1} != ${Z1_Box2} ||
101 ${X2_Box1} != ${X2_Box2} ||
102 ${Y2_Box1} != ${Y2_Box2} ||
103 ${Z2_Box1} != ${Z2_Box2} } {
104 puts "X1_Box1=${X1_Box1} Y1_Box1=${Y1_Box1} Z1_Box1=${Z1_Box1} X2_Box1=${X2_Box1} Y2_Box1=${Y2_Box1} Z2_Box1=${Z2_Box1}"
105 puts "X1_Box2=${X1_Box2} Y1_Box2=${Y1_Box2} Z1_Box2=${Z1_Box2} X2_Box2=${X2_Box2} Y2_Box2=${Y2_Box2} Z2_Box2=${Z2_Box2}"
106 puts "Get a link between attributes of the same document from restoring document: Error"
107 puts "OCC1228: ERROR (case 3)"
109 puts "Get a link between attributes of the same document from restoring document: OK"