40093367 |
1 | #INTERFACE CAF |
2 | # Basic attributes |
3 | # |
4 | # Testing attribute: TDataStd_Point |
5 | # |
6 | # Testing command: SetPoint |
7 | # Testing command: GetPoint |
8 | # |
9 | |
10 | puts "caf001-G2" |
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 | point aPoint1 ${aSetX1} ${aSetY1} ${aSetZ1} |
19 | |
20 | set aDumpPoint1 [dump aPoint1] |
21 | |
22 | # [llength ${aDumpPoint1}] = 10 |
23 | # Format of ${aDumpPoint1}: |
24 | # *********** Dump of aPoint1 ************* |
25 | # Point : 1.000000000000000e+01, 2.000000000000000e+01, 3.000000000000000e+01 |
26 | |
27 | set X_Point1 [lindex [split [lindex ${aDumpPoint1} 7] ${aTokList}] 0] |
28 | set Y_Point1 [lindex [split [lindex ${aDumpPoint1} 8] ${aTokList}] 0] |
29 | set Z_Point1 [lindex [split [lindex ${aDumpPoint1} 9] ${aTokList}] 0] |
30 | |
31 | set aLabel 0:2 |
32 | SetPoint D ${aLabel} aPoint1 |
33 | |
34 | # Close/Open the transaction |
35 | NewCommand D |
36 | |
37 | # Set a new value of the attribute |
38 | set aSetX3 110 |
39 | set aSetY3 120 |
40 | set aSetZ3 130 |
41 | point aPoint3 ${aSetX3} ${aSetY3} ${aSetZ3} |
42 | SetPoint D ${aLabel} aPoint3 |
43 | |
44 | # Close/Open the transaction |
45 | NewCommand D |
46 | |
47 | # Undo |
48 | Undo D |
49 | |
50 | # Get a value of the attribute |
51 | GetPoint D ${aLabel} aPoint4 |
52 | |
53 | set aDumpPoint4 [dump aPoint4] |
54 | set X_Point4 [lindex [split [lindex ${aDumpPoint4} 7] ${aTokList}] 0] |
55 | set Y_Point4 [lindex [split [lindex ${aDumpPoint4} 8] ${aTokList}] 0] |
56 | set Z_Point4 [lindex [split [lindex ${aDumpPoint4} 9] ${aTokList}] 0] |
57 | |
58 | if { ${X_Point1} != ${X_Point4} || |
59 | ${Y_Point1} != ${Y_Point4} || |
60 | ${Z_Point1} != ${Z_Point4} } { |
61 | puts "X_Point1=${X_Point1} X_Point4=${X_Point4}" |
62 | puts "Y_Point1=${Y_Point1} Y_Point4=${Y_Point4}" |
63 | puts "Z_Point1=${Z_Point1} Z_Point4=${Z_Point4}" |
64 | puts "Set a value of TDataStd_Point attribute: Error" |
65 | return |
66 | } |
67 | puts "Set a value of TDataStd_Point attribute: OK" |