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 | |
40093367 |
42 | # Collect TODO for area |
43 | if { [string compare $bug_area ""] != 0 } { |
94a57f1f |
44 | # The difference between the area of a geometry surface and the area of mesh triangles should be less than rel_tol value. |
45 | # If rel_tol is 100 we suppose that the mesh cannot be created. |
40093367 |
46 | if { $rel_tol == 100 } { |
6aac585a |
47 | puts "TODO $bug_area All:^\\s*Error : The meshing algo cannot create mesh.\\s*$" |
40093367 |
48 | } else { |
7bd071ed |
49 | puts "TODO ?$bug_area All: Error: area difference = .* is not equal to expected" |
40093367 |
50 | } |
51 | } |
52 | |
53 | # Collect TODO for number of triangles without mesh |
54 | if { [string compare $bug_withouttri ""] != 0 } { |
55 | # It may be different for different OS |
56 | foreach os_withouttri [array names nbwithouttri] { |
57 | if { $nbwithouttri($os_withouttri) != 0 } { |
58 | puts "TODO $bug_withouttri $os_withouttri:^\\s*Error: Faces without triangulation: $nbwithouttri($os_withouttri)\\b\\s*" |
59 | } |
60 | } |
61 | } |
62 | |
63 | # Collect TODO for number of free links |
64 | if { [string compare $bug_freelinks ""] != 0 } { |
65 | # It may be different for different OS |
66 | foreach os_freelinks [array names nbfree] { |
67 | if { $nbfree($os_freelinks) != 0 } { |
4b445d18 |
68 | puts "TODO $bug_freelinks $os_freelinks:^\\s*Error: Free links" |
40093367 |
69 | } |
70 | } |
71 | } |
72 | |
73 | # Collect TODO for number of cross faces |
74 | if { [string compare $bug_cross ""] != 0 } { |
75 | # It may be different for different OS |
76 | foreach os_cross [array names nbcross] { |
77 | if { $nbcross($os_cross) != 0 } { |
74f764ba |
78 | puts "TODO $bug_cross $os_cross:Error: Cross face errors" |
40093367 |
79 | } |
80 | } |
81 | } |
82 | |
83 | # Collect TODO for number of async edges |
84 | if { [string compare $bug_async ""] != 0 } { |
85 | # It may be different for different OS |
86 | foreach os_async [array names nbasync] { |
87 | if { $nbasync($os_async) != 0 } { |
88 | puts "TODO $bug_async $os_async:^\\s*Error: Async edges: $nbasync($os_async)\\b\\s*" |
89 | } |
90 | } |
91 | } |
92 | |
93 | # Collect TODO for number of free nodes |
94 | if { [string compare $bug_freenodes ""] != 0 } { |
95 | # It may be different for different OS |
96 | foreach os_freenodes [array names nbfreenodes] { |
97 | if { $nbfreenodes($os_freenodes) != 0 } { |
74f764ba |
98 | puts "TODO $bug_freenodes $os_freenodes:Error: Free nodes" |
40093367 |
99 | } |
100 | } |
101 | } |
102 | |
103 | # Number of triangles |
104 | set tri 0 |
105 | # Number of nodes |
106 | set nod 0 |
107 | # Deflection |
108 | set def 0 |
109 | |
94a57f1f |
110 | # Collect number of triangles, number of nodes and deflection. |
4006ca98 |
111 | |
112 | set full [trinfo res] |
113 | regexp "(\[0-9\]+) +triangles.*\[^0-9]\(\[0-9\]+) +nodes.*deflection +(\[0-9\]|\.+)" $full reg_out tri nod def |
40093367 |
114 | |
115 | if { $tri == 0 || $nod == 0 } { |
116 | puts " " |
94a57f1f |
117 | puts "Error : The meshing algo cannot create mesh." |
40093367 |
118 | } |
119 | |
120 | puts " " |
121 | puts "XML property: triangles $tri" |
122 | puts "XML property: nodes $nod" |
123 | puts " " |
124 | |
125 | # Check if area of triangles is valid |
126 | proc CheckTriArea {shape {eps 0}} { |
191082ac |
127 | upvar #0 $shape a |
128 | set area [triarea a $eps] |
40093367 |
129 | set t_area [lindex $area 0] |
130 | set g_area [expr abs([lindex $area 1])] |
131 | puts "area by triangles: $t_area" |
132 | puts "area by geometry: $g_area" |
133 | expr ($t_area - $g_area) / $g_area * 100 |
134 | } |
135 | |
136 | puts "\nChecking triangulation area (triarea command)..." |
137 | set rel_err [expr abs([CheckTriArea res $area_eps])] |
7bd071ed |
138 | if { [info exists max_rel_tol_diff] && $max_rel_tol_diff > 0 } { |
139 | checkreal "area difference" $rel_err $rel_tol $max_rel_tol_diff 0 |
40093367 |
140 | } |
141 | |
142 | # Check if topology of mesh is valid |
143 | puts "\nChecking mesh topology (tricheck command)..." |
144 | set l [tricheck res] |
145 | if {$l != ""} { |
146 | puts $l |
147 | set withouttri [regsub -all "face \[0-9\]+ has no triangulation" $l "FOUND" ll] |
148 | if { $withouttri != 0 } { |
149 | puts "Error: Faces without triangulation: $withouttri" |
150 | } |
151 | 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] } { |
152 | if { $freelinks != 0 } { |
153 | puts "Error: Free links: $freelinks" |
154 | } |
155 | if { $crossfaces != 0 } { |
156 | puts "Error: Cross face errors: $crossfaces" |
157 | } |
158 | if { $asyncedges != 0 } { |
159 | puts "Error: Async edges: $asyncedges" |
160 | } |
161 | if { $freenodes != 0 } { |
162 | puts "Error: Free nodes: $freenodes" |
163 | } |
164 | } |
165 | } |
166 | |
167 | if { [info exists imagedir] == 0 } { |
168 | set imagedir . |
169 | } |
170 | if { [info exists test_image ] == 0 } { |
171 | set test_image photo |
172 | } |
173 | |
174 | if { [string compare $command "shading"] == 0 } { |
b86bb3df |
175 | vglinfo |
88f8fc81 |
176 | vdump $imagedir/${test_image}.png |
40093367 |
177 | } else { |
178 | isos 0 |
179 | smallview |
180 | donly res |
181 | fit |
182 | triangles res |
88f8fc81 |
183 | xwd $imagedir/${test_image}.png |
40093367 |
184 | } |
185 | |
186 | puts "" |
187 | puts "TEST COMPLETED" |
188 | puts "" |