0023087: Upgrade of the OCCT test system
[occt.git] / tests / caf / named_shape / C1
CommitLineData
40093367 1#INTERFACE CAF
2# NamedShape
3#
4# Testing attribute: TNaming_NamedShape
5#
6# Testing command: GetShape
7#
8
9puts "caf002-C1"
10
11# Create a box
12set aSetX1 10
13set aSetY1 20
14set aSetZ1 30
15set aSetDX1 100
16set aSetDY1 200
17set aSetDZ1 300
18
19box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
20
21set aBoundingBox1 [bounding aBox1]
22set X1_Box1 [lindex ${aBoundingBox1} 0]
23set Y1_Box1 [lindex ${aBoundingBox1} 1]
24set Z1_Box1 [lindex ${aBoundingBox1} 2]
25set X2_Box1 [lindex ${aBoundingBox1} 3]
26set Y2_Box1 [lindex ${aBoundingBox1} 4]
27set Z2_Box1 [lindex ${aBoundingBox1} 5]
28
29# Create a label
30set aLabel 0:2
31Label D ${aLabel}
32
33# Close/Open transaction
34NewCommand D
35
36# Set a shape to the label
37SetShape D ${aLabel} aBox1
38
39# Close/Open transaction
40NewCommand D
41
42# Save the document
43set aFile ${WorkDirectory}/caf002-C1.std
44file delete ${aFile}
45SaveAs D ${aFile}
46#catch {exec chmod 777 ${aFile}}
47if { ![file exists ${aFile}] } {
48 puts "There is not ${aFile} file; SaveAs command: Error"
49 return
50}
51
52# Restore the document
53Close D
54Open ${aFile} DD
55
56# Get a shape from the label
57set IsDone [catch {GetShape DD ${aLabel} aBox3} aResult]
58if { ${IsDone} != 0 } {
59 puts ${aResult}
60 puts "Get a value of TNaming_NamedShape attribute from restoring document: Error"
61 return
62}
63
64set aBoundingBox3 [bounding aBox3]
65set X1_Box3 [lindex ${aBoundingBox3} 0]
66set Y1_Box3 [lindex ${aBoundingBox3} 1]
67set Z1_Box3 [lindex ${aBoundingBox3} 2]
68set X2_Box3 [lindex ${aBoundingBox3} 3]
69set Y2_Box3 [lindex ${aBoundingBox3} 4]
70set Z2_Box3 [lindex ${aBoundingBox3} 5]
71
72if { ${X1_Box1} != ${X1_Box3} ||
73 ${Y1_Box1} != ${Y1_Box3} ||
74 ${Z1_Box1} != ${Z1_Box3} ||
75 ${X2_Box1} != ${X2_Box3} ||
76 ${Y2_Box1} != ${Y2_Box3} ||
77 ${Z2_Box1} != ${Z2_Box3} } {
78 puts "X1_Box1=${X1_Box1} X1_Box3=${X1_Box3}"
79 puts "Y1_Box1=${Y1_Box1} Y1_Box3=${Y1_Box3}"
80 puts "Z1_Box1=${Z1_Box1} Z1_Box3=${Z1_Box3}"
81 puts "X2_Box1=${X2_Box1} X2_Box3=${X2_Box3}"
82 puts "Y2_Box1=${Y2_Box1} Y2_Box3=${Y2_Box3}"
83 puts "Z2_Box1=${Z2_Box1} Z2_Box3=${Z2_Box3}"
84 puts "Get a value of TNaming_NamedShape attribute from restoring document: Error"
85 return
86}
87
88puts "Get a value of TNaming_NamedShape attribute from restoring document: OK"