0023987: 2D fillets
[occt.git] / tests / fillet2d / end
CommitLineData
8b7c5e47 1if { [info exists square] } {
2 set prop "square"
3 set mass $square
4 if { [info exists tol_square] } {
5 regexp {Mass +: +([-0-9.+eE]+)} [sprops result $tol_square] full m
6 } else {
7 regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m
8 }
9}
10if { [info exists length] } {
11 set prop "length"
12 set mass $length
13 regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full m
14
15 puts "checksection"
16 puts [checksection result]
17}
18
19#if mass (length or square) is empty in test case then result should be an empty shape.
20if { [info exists mass] } {
21 puts "checkshape"
22 checkshape result
23
24 if { [string compare "$mass" "empty"] != 0 } {
25 if { $m == 0 } {
26 puts "Error : The command is not valid. The $prop is 0."
27 }
28 if { $mass > 0 } {
29 puts "The expected $prop is $mass"
30 }
31 #check of change of square is < 1%
32 if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } {
33 puts "Error : The $prop of result shape is $m"
34 }
35 } else {
36 if { $m != 0 } {
37 puts "Error : The command is not valid. The $prop is $m"
38 }
39 }
40}
41
42set glob_inf [info global nb_*_good]
43if { [regexp "nb_.*_good" $glob_inf] == 1 } {
44 if { [info exists nbsh_t] } {
45 set nb_info [nbshapes result -t]
46 } else {
47 set nb_info [nbshapes result]
48 }
49}
50
51if { [info exists nb_v_good] } {
52 regexp {VERTEX +: +([-0-9.+eE]+)} $nb_info full nb_v
53 if { ${nb_v} != ${nb_v_good} } {
54 puts "Error : Result shape is WRONG because it must contains ${nb_v_good} vertices instead of ${nb_v}"
55 } else {
56 puts "Result shape contains ${nb_v} vertices"
57 }
58}
59
60if { [info exists nb_e_good] } {
61 regexp {EDGE +: +([-0-9.+eE]+)} $nb_info full nb_e
62 if { ${nb_e} != ${nb_e_good} } {
63 puts "Error : Result shape is WRONG because it must contains ${nb_e_good} edges instead of ${nb_e}"
64 } else {
65 puts "Result shape contains ${nb_e} edges"
66 }
67}
68
69if { [info exists nb_w_good] } {
70 regexp {WIRE +: +([-0-9.+eE]+)} $nb_info full nb_w
71 if { ${nb_w} != ${nb_w_good} } {
72 puts "Error : Result shape is WRONG because it must contains ${nb_w_good} wires instead of ${nb_w}"
73 } else {
74 puts "Result shape contains ${nb_w} wires"
75 }
76}
77
78if { [info exists nb_f_good] } {
79 regexp {FACE +: +([-0-9.+eE]+)} $nb_info full nb_f
80 if { ${nb_f} != ${nb_f_good} } {
81 puts "Error : Result shape is WRONG because it must contains ${nb_f_good} faces instead of ${nb_f}"
82 } else {
83 puts "Result shape contains ${nb_f} faces"
84 }
85}
86
87if { [info exists nb_sh_good] } {
88 regexp {SHELL +: +([-0-9.+eE]+)} $nb_info full nb_sh
89 if { ${nb_sh} != ${nb_sh_good} } {
90 puts "Error : Result shape is WRONG because it must contains ${nb_sh_good} shells instead of ${nb_sh}"
91 } else {
92 puts "Result shape contains ${nb_sh} shells"
93 }
94}
95
96if { [info exists nb_sol_good] } {
97 regexp {SOLID +: +([-0-9.+eE]+)} $nb_info full nb_sol
98 if { ${nb_sol} != ${nb_sol_good} } {
99 puts "Error : Result shape is WRONG because it must contains ${nb_sol_good} solids instead of ${nb_sol}"
100 } else {
101 puts "Result shape contains ${nb_sol} solids"
102 }
103}
104
105if { [info exists nb_compsol_good] } {
106 regexp {COMPSOLID +: +([-0-9.+eE]+)} $nb_info full nb_compsol
107 if { ${nb_compsol} != ${nb_compsol_good} } {
108 puts "Error : Result shape is WRONG because it must contains ${nb_compsol_good} compsolids instead of ${nb_compsol}"
109 } else {
110 puts "Result shape contains ${nb_compsol} compsolids"
111 }
112}
113
114if { [info exists nb_compound_good] } {
115 regexp {COMPOUND +: +([-0-9.+eE]+)} $nb_info full nb_compound
116 if { ${nb_compound} != ${nb_compound_good} } {
117 puts "Error : Result shape is WRONG because it must contains ${nb_compound_good} compounds instead of ${nb_compound}"
118 } else {
119 puts "Result shape contains ${nb_compound} compounds"
120 }
121}
122
123if { [info exists nb_shape_good] } {
124 regexp {SHAPE +: +([-0-9.+eE]+)} $nb_info full nb_shape
125 if { ${nb_shape} != ${nb_shape_good} } {
126 puts "Error : Result shape is WRONG because it must contains ${nb_shape_good} shapes instead of ${nb_shape}"
127 } else {
128 puts "Result shape contains ${nb_shape} shapes"
129 }
130}
131
132if { [info exists nb_fe_good] && [info exists nb_fe] } {
133 if { ${nb_fe} != ${nb_fe_good} } {
134 puts "Error : Result shape is WRONG because it must contains ${nb_shape_good} shapes instead of ${nb_shape}"
135 } else {
136 puts "Result shape contains ${nb_fe} free edges"
137 }
138}
139
140if { [info exists rel_tol] } {
141 puts "\nChecking triangulation area (triarea command)..."
142 set rel_err [expr abs([CheckTriArea result $area_eps])]
143 if { $rel_err > $rel_tol } {
144 puts "Error : area by triangles differs from the actual area by $rel_err %"
145 } else {
146 if { $rel_tol > 1 && $rel_tol < 100 } {
147 puts "Error: Improvement: The current area difference is $rel_err instead of $rel_tol"
148 }
149 }
150}
151
152if { [isdraw result] } {
153 if { [info exists 2dviewer] } {
154 clear
155 smallview
156 donly result
157 fit
158 xwd $imagedir/${test_image}.png
159 }
160 if { [info exists 3dviewer] } {
161 #for multiview support: dump result from all opened views
162 set view_str [vviewlist long]
163 set view_list [regexp -all -inline {\S+} $view_str]
164 foreach {view_name} $view_list {
165 vactivate $view_name
166 vclear
167 vdisplay result
168 vsetdispmode 1
169 vfit
170 vzfit
171 vdump $imagedir/${test_image}_[regsub -all {/} $view_name {_}].png
172 }
173 }
174}
175
176if { [info exists only_screen] } {
177 #for multiview support: dump result from all opened views
178 set view_str [vviewlist long]
179 set view_list [regexp -all -inline {\S+} $view_str]
180 foreach {view_name} $view_list {
181 vactivate $view_name
182 vdump $imagedir/${test_image}_[regsub -all {/} $view_name {_}].png
183 }
184}
185
186if { [info exists only_screen_axo] } {
187 xwd $imagedir/${test_image}.png
188}
189
190# to end a test script
191puts "TEST COMPLETED"