40093367 |
1 | #INTERFACE CAF |
2 | # Basic attributes |
3 | # |
4 | # Testing attribute: TDataStd_Plane |
5 | # |
6 | # Testing command: SetPlane |
7 | # Testing command: GetPlane |
8 | # |
9 | |
10 | puts "caf001-I3" |
11 | |
12 | set aTokList { :,} |
13 | |
14 | # Add an attribute to a data framework |
15 | set aSetX1 10 |
16 | set aSetY1 20 |
17 | set aSetZ1 30 |
18 | set aSetDX1 -1 |
19 | set aSetDY1 0 |
20 | set aSetDZ1 0 |
21 | |
22 | plane aPlane1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1} |
23 | |
24 | set aDumpPlane1 [dump aPlane1] |
25 | |
26 | # [llength ${aDumpPlane1}] = 22 |
27 | # Format of ${aDumpPlane1}: |
28 | # *********** Dump of aPlane1 ************* |
29 | # Plane |
30 | # Origin :10, 20, 30 |
31 | # Axis :-1, 0, 0 |
32 | # XAxis :-0, 0, -1 |
33 | # YAxis :-0, -1, 0 |
34 | |
35 | set anOriginX_Plane1 [lindex [split [lindex ${aDumpPlane1} 7] ${aTokList}] 1] |
36 | set anOriginY_Plane1 [lindex [split [lindex ${aDumpPlane1} 8] ${aTokList}] 0] |
37 | set anOriginZ_Plane1 [lindex [split [lindex ${aDumpPlane1} 9] ${aTokList}] 0] |
38 | set anAxisDX_Plane1 [lindex [split [lindex ${aDumpPlane1} 11] ${aTokList}] 1] |
39 | set anAxisDY_Plane1 [lindex [split [lindex ${aDumpPlane1} 12] ${aTokList}] 0] |
40 | set anAxisDZ_Plane1 [lindex [split [lindex ${aDumpPlane1} 13] ${aTokList}] 0] |
41 | |
42 | set aLabel 0:2 |
43 | SetPlane D ${aLabel} aPlane1 |
44 | |
45 | # Close/Open the transaction |
46 | NewCommand D |
47 | |
48 | # Save the document |
49 | set aFile ${WorkDirectory}/caf001-I3.std |
50 | file delete ${aFile} |
51 | SaveAs D ${aFile} |
52 | if { ![file exists ${aFile}] } { |
53 | puts "There is not ${aFile} file; SaveAs command: Error" |
54 | return |
55 | } |
56 | #catch {exec chmod 777 ${aFile}} |
57 | |
58 | # Restore the document |
59 | Close D |
60 | Open ${aFile} DD |
61 | |
62 | # Get a value of the attribute |
63 | set IsDone [catch {GetPlane DD ${aLabel} aPlane5} aResult] |
64 | if { ${IsDone} != 0 } { |
65 | puts ${aResult} |
66 | puts "Get a value of TDataStd_Plane attribute from restoring document: Error" |
67 | return |
68 | } |
69 | |
70 | set aDumpPlane5 [dump aPlane5] |
71 | set anOriginX_Plane5 [lindex [split [lindex ${aDumpPlane5} 7] ${aTokList}] 1] |
72 | set anOriginY_Plane5 [lindex [split [lindex ${aDumpPlane5} 8] ${aTokList}] 0] |
73 | set anOriginZ_Plane5 [lindex [split [lindex ${aDumpPlane5} 9] ${aTokList}] 0] |
74 | set anAxisDX_Plane5 [lindex [split [lindex ${aDumpPlane5} 11] ${aTokList}] 1] |
75 | set anAxisDY_Plane5 [lindex [split [lindex ${aDumpPlane5} 12] ${aTokList}] 0] |
76 | set anAxisDZ_Plane5 [lindex [split [lindex ${aDumpPlane5} 13] ${aTokList}] 0] |
77 | |
78 | if { ${anOriginX_Plane1} != ${anOriginX_Plane5} || |
79 | ${anOriginY_Plane1} != ${anOriginY_Plane5} || |
80 | ${anOriginZ_Plane1} != ${anOriginZ_Plane5} || |
81 | ${anAxisDX_Plane1} != ${anAxisDX_Plane5} || |
82 | ${anAxisDY_Plane1} != ${anAxisDY_Plane5} || |
83 | ${anAxisDZ_Plane1} != ${anAxisDZ_Plane5} } { |
84 | puts "anOriginX_Plane1=${anOriginX_Plane1} anOriginX_Plane5=${anOriginX_Plane5}" |
85 | puts "anOriginY_Plane1=${anOriginY_Plane1} anOriginY_Plane5=${anOriginY_Plane5}" |
86 | puts "anOriginZ_Plane1=${anOriginZ_Plane1} anOriginZ_Plane5=${anOriginZ_Plane5}" |
87 | puts "anAxisDX_Plane1=${anAxisDX_Plane1} anAxisDX_Plane5=${anAxisDX_Plane5}" |
88 | puts "anAxisDY_Plane1=${anAxisDY_Plane1} anAxisDY_Plane5=${anAxisDY_Plane5}" |
89 | puts "anAxisDZ_Plane1=${anAxisDZ_Plane1} anAxisDZ_Plane5=${anAxisDZ_Plane5}" |
90 | puts "Get a value of TDataStd_Plane attribute from restoring document: Error" |
91 | return |
92 | } |
93 | puts "Get a value of TDataStd_Plane attribute from restoring document: OK" |