0029311: Implementation of the Oriented Bounding Boxes (OBB) functionality
[occt.git] / tests / xml / data / ocaf / B7
1 set aTestName "caf004-B3"
2 puts ${aTestName}
3
4 # Create two new documents Doc1, Doc2
5 set FileFormat "BinOcaf"
6 if { $FileSuffix == "xml" } {
7    set FileFormat "XmlOcaf"
8 }
9 NewDocument Doc1 $FileFormat
10 NewDocument Doc2 $FileFormat
11
12 # Set UndoLimit for them
13 UndoLimit Doc1 100
14 UndoLimit Doc2 100
15
16 # Set a shape in Doc1 to label 'SLabel'
17 set aLabel1 0:2
18 Label Doc1 ${aLabel1}
19 SetName Doc1 ${aLabel1} SLabel
20
21 set aSetX1 10
22 set aSetY1 20
23 set aSetZ1 30
24 set aSetDX1 100
25 set aSetDY1 200
26 set aSetDZ1 300
27
28 box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
29
30 bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
31
32 SetShape Doc1 ${aLabel1} aBox1
33
34 # Create a new label 'TLabel1' in Doc1
35 set aLabel2 0:3
36 Label Doc1 ${aLabel2}
37 SetName Doc1 ${aLabel2} TLabel1
38
39 # Open transaction in Doc1
40 NewCommand Doc1
41
42 # Copy 'SLabel' to the label 'TLabel1' with link
43 CopyWithLink Doc1 ${aLabel2} Doc1 ${aLabel1}
44
45 # Close/Open transaction
46 NewCommand Doc1
47
48 # Save the document
49 set aFile $WorkDirectory/${aTestName}.${FileSuffix}
50
51 SaveToFile Doc1 $aFile
52
53 # Restore the document
54 Close Doc1
55 Open ${aFile} Doc2
56
57 # Get a shape from 'TLabel1' of restoring document
58 set IsDone [catch {GetShape Doc2 ${aLabel2} aBox2} aResult]
59 if { ${IsDone} != 0 } {
60     puts "Error : Get a value of TNaming_NamedShape attribute from restoring document"
61 } else {
62     bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
63
64 if { [dval X1_Box1] != [dval X1_Box2] || 
65      [dval Y1_Box1] != [dval Y1_Box2] || 
66      [dval Z1_Box1] != [dval Z1_Box2] || 
67      [dval X2_Box1] != [dval X2_Box2] || 
68      [dval Y2_Box1] != [dval Y2_Box2] || 
69      [dval Z2_Box1] != [dval Z2_Box2] } {
70         puts "X1_Box1=[dval X1_Box1] X1_Box2=[dval X1_Box2]"
71         puts "Y1_Box1=[dval Y1_Box1] Y1_Box2=[dval Y1_Box2]"
72         puts "Z1_Box1=[dval Z1_Box1] Z1_Box2=[dval Z1_Box2]"
73         puts "X2_Box1=[dval X2_Box1] X2_Box2=[dval X2_Box2]"
74         puts "Y2_Box1=[dval Y2_Box1] Y2_Box2=[dval Y2_Box2]"
75         puts "Z2_Box1=[dval Z2_Box1] Z2_Box2=[dval Z2_Box2]"
76         puts "Error : Get a link between attributes of the same document from restoring document"
77     }
78 }
79