40093367 |
1 | #INTERFACE CAF |
2 | # Basic attributes |
3 | # |
4 | # Testing attribute: TDataStd_Axis |
5 | # |
6 | # Testing command: SetAxis |
7 | # Testing command: GetAxis |
8 | # |
9 | |
10 | puts "caf001-H1" |
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 100 |
19 | set aSetDY1 200 |
20 | set aSetDZ1 300 |
21 | line aLine1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1} |
22 | |
23 | set aDumpLine1 [dump aLine1] |
24 | |
25 | # [llength ${aDumpLine1}] = 14 |
26 | # Format of ${aDumpLine1}: |
27 | # *********** Dump of aLine1 ************* |
28 | # Line |
29 | # Origin :10, 20, 30 |
30 | # Axis :0.267261241912424, 0.534522483824849, 0.801783725737273 |
31 | |
32 | set anOriginX_Line1 [lindex [split [lindex ${aDumpLine1} 7] ${aTokList}] 1] |
33 | set anOriginY_Line1 [lindex [split [lindex ${aDumpLine1} 8] ${aTokList}] 0] |
34 | set anOriginZ_Line1 [lindex [split [lindex ${aDumpLine1} 9] ${aTokList}] 0] |
35 | set anAxisDX_Line1 [lindex [split [lindex ${aDumpLine1} 11] ${aTokList}] 1] |
36 | set anAxisDY_Line1 [lindex [split [lindex ${aDumpLine1} 12] ${aTokList}] 0] |
37 | set anAxisDZ_Line1 [lindex [split [lindex ${aDumpLine1} 13] ${aTokList}] 0] |
38 | |
39 | set aLabel 0:2 |
40 | SetAxis D ${aLabel} aLine1 |
41 | |
42 | # Close/Open the transaction |
43 | NewCommand D |
44 | |
45 | # Forget the attribute |
46 | ForgetAll D ${aLabel} |
47 | |
48 | # Close/Open the transaction |
49 | NewCommand D |
50 | |
51 | # Undo-Redo-Undo |
52 | Undo D |
53 | Redo D |
54 | Undo D |
55 | |
56 | # Get a value of the attribute |
57 | GetAxis D ${aLabel} anAxis1 |
58 | |
59 | # [llength ${aDumpAxis1}] = 14 |
60 | # Format of ${aDumpAxis1}: |
61 | # *********** Dump of anAxis1 ************* |
62 | # Line |
63 | # Origin :10, 20, 30 |
64 | # Axis :0.267261241912424, 0.534522483824849, 0.801783725737273 |
65 | |
66 | set aDumpAxis1 [dump anAxis1] |
67 | set anOriginX_Axis1 [lindex [split [lindex ${aDumpAxis1} 7] ${aTokList}] 1] |
68 | set anOriginY_Axis1 [lindex [split [lindex ${aDumpAxis1} 8] ${aTokList}] 0] |
69 | set anOriginZ_Axis1 [lindex [split [lindex ${aDumpAxis1} 9] ${aTokList}] 0] |
70 | set anAxisDX_Axis1 [lindex [split [lindex ${aDumpAxis1} 11] ${aTokList}] 1] |
71 | set anAxisDY_Axis1 [lindex [split [lindex ${aDumpAxis1} 12] ${aTokList}] 0] |
72 | set anAxisDZ_Axis1 [lindex [split [lindex ${aDumpAxis1} 13] ${aTokList}] 0] |
73 | |
74 | if { ${anOriginX_Line1} != ${anOriginX_Axis1} || |
75 | ${anOriginY_Line1} != ${anOriginY_Axis1} || |
76 | ${anOriginZ_Line1} != ${anOriginZ_Axis1} || |
77 | ${anAxisDX_Line1} != ${anAxisDX_Axis1} || |
78 | ${anAxisDY_Line1} != ${anAxisDY_Axis1} || |
79 | ${anAxisDZ_Line1} != ${anAxisDZ_Axis1} } { |
80 | puts "anOriginX_Line1=${anOriginX_Line1} anOriginX_Axis1=${anOriginX_Axis1}" |
81 | puts "anOriginY_Line1=${anOriginY_Line1} anOriginY_Axis1=${anOriginY_Axis1}" |
82 | puts "anOriginZ_Line1=${anOriginZ_Line1} anOriginZ_Axis1=${anOriginZ_Axis1}" |
83 | puts "anAxisDX_Line1=${anAxisDX_Line1} anAxisDX_Axis1=${anAxisDX_Axis1}" |
84 | puts "anAxisDY_Line1=${anAxisDY_Line1} anAxisDY_Axis1=${anAxisDY_Axis1}" |
85 | puts "anAxisDZ_Line1=${anAxisDZ_Line1} anAxisDZ_Axis1=${anAxisDZ_Axis1}" |
86 | puts "Add TDataStd_Axis attribute: Error" |
87 | return |
88 | } |
89 | puts "Add TDataStd_Axis attribute: OK" |