40093367 |
1 | # Get name of shape |
2 | |
3 | if { [string compare ${TheFileName} ""] != 0 } { |
4 | set is_brep [regexp "\.brep" $TheFileName] |
b725d7c5 |
5 | if {$is_brep == 0} { |
6 | set is_brep [regexp "\.rle" $TheFileName] |
7 | } |
40093367 |
8 | if {$is_brep == 1} { |
b725d7c5 |
9 | puts [brestore [locate_data_file $TheFileName] res] |
40093367 |
10 | } else { |
11 | if { [array get Draw_Groups "DE: STEP"] == "" } { |
12 | pload XDE |
13 | } |
14 | |
8418c617 |
15 | stepread [locate_data_file ${TheFileName}] a * |
40093367 |
16 | tpcompound res |
17 | } |
18 | } |
19 | |
20 | puts [checkshape res] |
21 | |
22 | tclean res |
23 | |
24 | if { [string compare $command "shading"] == 0 } { |
a1954302 |
25 | vinit View1 |
26 | vdisplay -noupdate -redisplay res |
40093367 |
27 | vsetdispmode res 1 |
28 | vfit |
29 | } |
30 | |
31 | if { [string compare $command "incmesh"] == 0 } { |
49cfd13d |
32 | if { [string compare $parallel "-parallel"] != 0 || [info exists count_parallel] == 0 } { |
40093367 |
33 | set count_parallel 1 |
34 | } |
35 | for {set i 1} {$i <= $count_parallel} {incr i} { |
36 | tclean res |
37 | puts "i = $i" |
38 | incmesh res ${Deflection} ${parallel} |
39 | } |
40 | } |
41 | |
42 | if { [string compare $command "mesh"] == 0 } { |
43 | set ResultList [mesh res_mesh res ${Deflection}] |
44 | } |
45 | |
46 | # Collect TODO for area |
47 | if { [string compare $bug_area ""] != 0 } { |
94a57f1f |
48 | # The difference between the area of a geometry surface and the area of mesh triangles should be less than rel_tol value. |
49 | # If rel_tol is 100 we suppose that the mesh cannot be created. |
40093367 |
50 | if { $rel_tol == 100 } { |
6aac585a |
51 | puts "TODO $bug_area All:^\\s*Error : The meshing algo cannot create mesh.\\s*$" |
40093367 |
52 | } else { |
74f764ba |
53 | puts "TODO ?$bug_area All:^\\s*Error : area by triangles differs from the actual area by \[-.0-9\]+ %\\s*$" |
40093367 |
54 | } |
55 | } |
56 | |
57 | # Collect TODO for number of triangles without mesh |
58 | if { [string compare $bug_withouttri ""] != 0 } { |
59 | # It may be different for different OS |
60 | foreach os_withouttri [array names nbwithouttri] { |
61 | if { $nbwithouttri($os_withouttri) != 0 } { |
62 | puts "TODO $bug_withouttri $os_withouttri:^\\s*Error: Faces without triangulation: $nbwithouttri($os_withouttri)\\b\\s*" |
63 | } |
64 | } |
65 | } |
66 | |
67 | # Collect TODO for number of free links |
68 | if { [string compare $bug_freelinks ""] != 0 } { |
69 | # It may be different for different OS |
70 | foreach os_freelinks [array names nbfree] { |
71 | if { $nbfree($os_freelinks) != 0 } { |
4b445d18 |
72 | puts "TODO $bug_freelinks $os_freelinks:^\\s*Error: Free links" |
40093367 |
73 | } |
74 | } |
75 | } |
76 | |
77 | # Collect TODO for number of cross faces |
78 | if { [string compare $bug_cross ""] != 0 } { |
79 | # It may be different for different OS |
80 | foreach os_cross [array names nbcross] { |
81 | if { $nbcross($os_cross) != 0 } { |
74f764ba |
82 | puts "TODO $bug_cross $os_cross:Error: Cross face errors" |
40093367 |
83 | } |
84 | } |
85 | } |
86 | |
87 | # Collect TODO for number of async edges |
88 | if { [string compare $bug_async ""] != 0 } { |
89 | # It may be different for different OS |
90 | foreach os_async [array names nbasync] { |
91 | if { $nbasync($os_async) != 0 } { |
92 | puts "TODO $bug_async $os_async:^\\s*Error: Async edges: $nbasync($os_async)\\b\\s*" |
93 | } |
94 | } |
95 | } |
96 | |
97 | # Collect TODO for number of free nodes |
98 | if { [string compare $bug_freenodes ""] != 0 } { |
99 | # It may be different for different OS |
100 | foreach os_freenodes [array names nbfreenodes] { |
101 | if { $nbfreenodes($os_freenodes) != 0 } { |
74f764ba |
102 | puts "TODO $bug_freenodes $os_freenodes:Error: Free nodes" |
40093367 |
103 | } |
104 | } |
105 | } |
106 | |
107 | # Number of triangles |
108 | set tri 0 |
109 | # Number of nodes |
110 | set nod 0 |
111 | # Deflection |
112 | set def 0 |
113 | |
94a57f1f |
114 | # Collect number of triangles, number of nodes and deflection. |
40093367 |
115 | if { [string compare $command "mesh"] != 0 } { |
116 | set full [trinfo res] |
117 | regexp "(\[0-9\]+) +triangles.*\[^0-9]\(\[0-9\]+) +nodes.*deflection +(\[0-9\]|\.+)" $full reg_out tri nod def |
118 | } else { |
119 | set full [split $ResultList "()"] |
120 | set tri [lindex [lindex $full 2] 0] |
121 | set lin [lindex [lindex $full 4] 0] |
122 | set nod [lindex [lindex $full 6] 0] |
123 | } |
124 | |
125 | if { $tri == 0 || $nod == 0 } { |
126 | puts " " |
94a57f1f |
127 | puts "Error : The meshing algo cannot create mesh." |
40093367 |
128 | } |
129 | |
130 | puts " " |
131 | puts "XML property: triangles $tri" |
132 | puts "XML property: nodes $nod" |
133 | puts " " |
134 | |
135 | # Check if area of triangles is valid |
136 | proc CheckTriArea {shape {eps 0}} { |
191082ac |
137 | upvar #0 $shape a |
138 | set area [triarea a $eps] |
40093367 |
139 | set t_area [lindex $area 0] |
140 | set g_area [expr abs([lindex $area 1])] |
141 | puts "area by triangles: $t_area" |
142 | puts "area by geometry: $g_area" |
143 | expr ($t_area - $g_area) / $g_area * 100 |
144 | } |
145 | |
146 | puts "\nChecking triangulation area (triarea command)..." |
147 | set rel_err [expr abs([CheckTriArea res $area_eps])] |
148 | if { $rel_err > $rel_tol } { |
94a57f1f |
149 | puts "Error : area by triangles differs from the actual area by $rel_err %" |
40093367 |
150 | } else { |
7856b126 |
151 | if { [info exists max_rel_tol_diff] && $max_rel_tol_diff > 0 } { |
152 | checkreal "area difference" $rel_err $rel_tol $max_rel_tol_diff 0 |
153 | } else { |
154 | if { $rel_tol > 1 && $rel_tol < 100 } { |
155 | puts "Error: Improvement: The current area difference is $rel_err instead of $rel_tol" |
156 | } |
40093367 |
157 | } |
158 | } |
159 | |
160 | # Check if topology of mesh is valid |
161 | puts "\nChecking mesh topology (tricheck command)..." |
162 | set l [tricheck res] |
163 | if {$l != ""} { |
164 | puts $l |
165 | set withouttri [regsub -all "face \[0-9\]+ has no triangulation" $l "FOUND" ll] |
166 | if { $withouttri != 0 } { |
167 | puts "Error: Faces without triangulation: $withouttri" |
168 | } |
169 | if { [regexp "Free_links +(\[0-9\]+) +Cross_face_errors +(\[0-9\]+) +Async_edges +(\[0-9\]+) +Free_nodes +(\[0-9\]+)" $l full freelinks crossfaces asyncedges freenodes] } { |
170 | if { $freelinks != 0 } { |
171 | puts "Error: Free links: $freelinks" |
172 | } |
173 | if { $crossfaces != 0 } { |
174 | puts "Error: Cross face errors: $crossfaces" |
175 | } |
176 | if { $asyncedges != 0 } { |
177 | puts "Error: Async edges: $asyncedges" |
178 | } |
179 | if { $freenodes != 0 } { |
180 | puts "Error: Free nodes: $freenodes" |
181 | } |
182 | } |
183 | } |
184 | |
185 | if { [info exists imagedir] == 0 } { |
186 | set imagedir . |
187 | } |
188 | if { [info exists test_image ] == 0 } { |
189 | set test_image photo |
190 | } |
191 | |
192 | if { [string compare $command "shading"] == 0 } { |
b86bb3df |
193 | vglinfo |
88f8fc81 |
194 | vdump $imagedir/${test_image}.png |
40093367 |
195 | } else { |
196 | isos 0 |
197 | smallview |
198 | donly res |
199 | fit |
200 | triangles res |
88f8fc81 |
201 | xwd $imagedir/${test_image}.png |
40093367 |
202 | } |
203 | |
204 | puts "" |
205 | puts "TEST COMPLETED" |
206 | puts "" |