40093367 |
1 | #INTERFACE CAF |
2 | puts "================" |
3 | puts "OCC1228" |
4 | puts "================" |
5 | puts "" |
6 | |
7 | # Basic attributes |
8 | # |
9 | # Testing attribute: TDataStd_Point |
10 | # |
11 | # Testing command: SetPoint |
12 | # Testing command: GetPoint |
13 | # |
14 | |
15 | # ANALOG: puts "caf001-G3" |
16 | |
17 | # Create a new document and set UndoLimit |
18 | NewDocument Doc BinOcaf |
19 | UndoLimit Doc 100 |
20 | |
21 | # Open a transaction |
22 | NewCommand Doc |
23 | |
24 | set aTokList { :,} |
25 | |
26 | # Add an attribute to a data framework |
27 | set aSetX1 10 |
28 | set aSetY1 20 |
29 | set aSetZ1 30 |
30 | point aPoint1 ${aSetX1} ${aSetY1} ${aSetZ1} |
31 | |
32 | set aDumpPoint1 [dump aPoint1] |
33 | |
34 | # [llength ${aDumpPoint1}] = 10 |
35 | # Format of ${aDumpPoint1}: |
36 | # *********** Dump of aPoint1 ************* |
37 | # Point : 1.000000000000000e+01, 2.000000000000000e+01, 3.000000000000000e+01 |
38 | |
39 | set X_Point1 [lindex [split [lindex ${aDumpPoint1} 7] ${aTokList}] 0] |
40 | set Y_Point1 [lindex [split [lindex ${aDumpPoint1} 8] ${aTokList}] 0] |
41 | set Z_Point1 [lindex [split [lindex ${aDumpPoint1} 9] ${aTokList}] 0] |
42 | |
43 | set aLabel 0:2 |
44 | SetPoint Doc ${aLabel} aPoint1 |
45 | |
46 | # Close/Open the transaction |
47 | NewCommand Doc |
48 | |
49 | # Save the document |
8418c617 |
50 | set aFile ${imagedir}/OCC1228-[file tail [info script]].cbf |
40093367 |
51 | file delete ${aFile} |
52 | catch {SaveAs Doc ${aFile}} |
53 | if { ![file exists ${aFile}] } { |
54 | puts "There is not ${aFile} file; SaveAs command: Error" |
55 | puts "OCC1228: ERROR (case 1)" |
56 | } |
57 | #catch {exec chmod 777 ${aFile}} |
58 | |
59 | # Restore the document |
60 | Close Doc |
61 | catch {Open ${aFile} DDoc} |
62 | |
63 | # Get a value of the attribute |
64 | set aGetAttr3 "" |
65 | set IsDone [catch {set aGetAttr3 [GetPoint DDoc ${aLabel}]} aResult] |
66 | if { ${IsDone} != 0 } { |
67 | puts ${aResult} |
68 | puts "Get a value of TDataStd_Point attribute from restoring document: Error" |
69 | puts "OCC1228: ERROR (case 2)" |
70 | } |
71 | catch {GetPoint DDoc ${aLabel} aPoint5} |
72 | |
73 | set aDumpPoint5 [dump aPoint5] |
74 | set X_Point5 [lindex [split [lindex ${aDumpPoint5} 7] ${aTokList}] 0] |
75 | set Y_Point5 [lindex [split [lindex ${aDumpPoint5} 8] ${aTokList}] 0] |
76 | set Z_Point5 [lindex [split [lindex ${aDumpPoint5} 9] ${aTokList}] 0] |
77 | |
78 | if { ${X_Point1} != ${X_Point5} || |
79 | ${Y_Point1} != ${Y_Point5} || |
80 | ${Z_Point1} != ${Z_Point5} } { |
81 | puts "X_Point1=${X_Point1} X_Point5=${X_Point5}" |
82 | puts "Y_Point1=${Y_Point1} Y_Point5=${Y_Point5}" |
83 | puts "Z_Point1=${Z_Point1} Z_Point5=${Z_Point5}" |
84 | puts "Get a value of TDataStd_Point attribute from restoring document: Error" |
85 | puts "OCC1228: ERROR (case 3)" |
86 | } else { |
87 | puts "Get a value of TDataStd_Point attribute from restoring document: OK" |
88 | puts "OCC1228: OK" |
89 | } |