61c421bf |
1 | puts "================" |
2 | puts "OCC2932" |
3 | puts "================" |
4 | puts "" |
5 | ####################################################################################### |
6 | # Create Attribute Delta depending on actual change of the attribute |
7 | ####################################################################################### |
8 | # Case 6 (TDataStd_Geometry) |
9 | ####################################################################################### |
10 | |
11 | # Create a new document and set UndoLimit |
e837410d |
12 | NewDocument D BinOcaf |
61c421bf |
13 | UndoLimit D 100 |
14 | |
15 | # Create a label and set attributes |
16 | NewCommand D |
17 | set Label 0:2 |
18 | |
19 | ############################################ |
20 | # Create a box |
21 | set X 10 |
22 | set Y 20 |
23 | set Z 30 |
24 | set DX 100 |
25 | set DY 200 |
26 | set DZ 300 |
27 | box Box ${X} ${Y} ${Z} ${DX} ${DY} ${DZ} |
28 | ############################################ |
29 | |
30 | set Real1 300. |
31 | set Real2 400. |
32 | set modified_attribute TDataStd_Real |
33 | |
34 | ############################################ |
35 | # Set TDataStd_Geometry |
36 | Label D ${Label} |
37 | SetGeometry D ${Label} "pnt" ${Box} |
38 | ############################################ |
39 | |
40 | SetReal D ${Label} ${Real1} |
41 | set list [DumpCommand D] |
42 | |
43 | # Open a transaction |
44 | NewCommand D |
45 | set list [DumpCommand D] |
46 | |
47 | ############################################ |
48 | # Set old value for TDataStd_Geometry |
49 | SetGeometry D ${Label} "pnt" ${Box} |
50 | ############################################ |
51 | |
52 | # Set new value for TDataStd_Real |
53 | SetReal D ${Label} ${Real2} |
54 | set list [DumpCommand D] |
55 | |
56 | # Open a transaction |
57 | NewCommand D |
58 | set list [DumpCommand D] |
59 | |
60 | # Checking |
61 | if { 1 == 2 } { |
62 | set ll [llength ${list}] |
63 | set good_length 17 |
64 | puts "length = ${ll}" |
65 | puts "good_length = ${good_length}" |
66 | |
67 | if { ${ll} != ${good_length} } { |
68 | puts "OCC2932 Error (case 1)" |
69 | } else { |
70 | set name_attribute [lindex ${list} [expr ${good_length} - 1]] |
71 | puts "name_attribute = ${name_attribute}" |
72 | puts "modified_attribute = ${modified_attribute}" |
73 | if {[string compare ${name_attribute} ${modified_attribute}] == 0} { |
74 | puts "OCC2932 OK" |
75 | } else { |
76 | puts "OCC2932 Error (case 2)" |
77 | } |
78 | } |
79 | } |
80 | |
81 | # NEW VERSION!!!!! |
82 | set ll [llength ${list}] |
83 | set good_length 20 |
84 | puts "length = ${ll}" |
85 | puts "good_length = ${good_length}" |
86 | |
87 | if { ${ll} != ${good_length} } { |
88 | puts "OCC2932 Error (case 1)" |
89 | } else { |
90 | set name_attribute1 [lindex ${list} [expr ${good_length} - 1]] |
91 | set name_attribute2 [lindex ${list} [expr ${good_length} - 4]] |
92 | set modified_attribute2 TNaming_NamedShape |
93 | puts "name_attribute1 = ${name_attribute1}" |
94 | puts "name_attribute2 = ${name_attribute2}" |
95 | puts "modified_attribute = ${modified_attribute}" |
96 | puts "modified_attribute2 = ${modified_attribute2}" |
97 | |
98 | set Is_TDataStd_Real 0 |
99 | set Is_TNaming_NamedShape 0 |
100 | if {[string compare ${name_attribute1} ${modified_attribute}] == 0 || |
101 | [string compare ${name_attribute2} ${modified_attribute}] == 0 } { |
102 | set Is_TDataStd_Real 1 |
103 | } |
104 | if {[string compare ${name_attribute1} ${modified_attribute2}] == 0 || |
105 | [string compare ${name_attribute2} ${modified_attribute2}] == 0 } { |
106 | set Is_TNaming_NamedShape 1 |
107 | } |
108 | |
109 | |
110 | if { ${Is_TDataStd_Real} == 1 && ${Is_TNaming_NamedShape} == 1 } { |
111 | puts "OCC2932 OK" |
112 | } else { |
113 | puts "OCC2932 Error (case 2)" |
114 | } |
115 | |
116 | } |