0027974: Visualization, ray tracing - Improve ray tracing engine
[occt.git] / tests / offset / end
CommitLineData
5805221e 1set mist 0
2if { [info exists command] && [string compare $command "mkoffset"] == 0 } {
3 regexp {Mass +: +([-0-9.+eE]+)} [lprops s] full sm
4 regexp {Tolerance +MAX=([-0-9.+eE]+) +AVG=([-0-9.+eE]+) +MIN=[-0-9.+eE]+} [tolerance s] full MaxTol_s AvgTol_s
5 puts "Length of shape a is equal to $sm"
6 set theOff [expr $sm * $off_param ]
7 puts [format "Considered Offset value is %s " $theOff]
8 if { ![catch { mkoffset result s 1 $theOff } catch_res] } {
58cf74e0 9 renamevar result_1 result
10 if { ![catch { set chsh [checkshape result] } catch_chsh] } {
11 puts $chsh
5805221e 12 } else {
58cf74e0 13 puts "Error : $catch_chsh"
14 set mist 1
15 }
5805221e 16 }
58cf74e0 17 checkprops result -l ${length}
5805221e 18}
19
20if { [isdraw result] && $mist == 0} {
21 if { [info exists command] && [string compare $command "mkoffset"] == 0 } {
58cf74e0 22 regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full m
23 set vertex_list [explode result v]
24 set ll_v [llength $vertex_list]
25 set edge_list [explode result e]
26 set ll_e [llength $edge_list]
5805221e 27
58cf74e0 28 set wire_list [explode result w]
29 if { [string compare $wire_list ""] == 0} {
30 set wire_list result
31 }
32 set ll_w [llength $wire_list]
40093367 33
58cf74e0 34 if { $ll_v == 0 } {
35 if { $theOff < 0 } {
36 puts [format "Warning : The resulting shape is an empty COMPOUND"]
37 } else {
38 puts [format "Error : The resulting shape is an empty COMPOUND"]
39 }
40 puts [whatis result]
41 puts [checksection result]
42 } else {
43 puts [format "The resulting shape contains %s wires" $ll_w]
44 foreach wire $wire_list {
45 puts "Info for $wire:"
46 regexp {Tolerance +MAX=([-0-9.+eE]+) +AVG=([-0-9.+eE]+) +MIN=[-0-9.+eE]+} [tolerance $wire] full MaxTol_res AvgTol_res
47 if { $MaxTol_res > $MaxTol_s } {
48 puts "Error : big tolerance of shape $wire"
49 }
50 regexp {nb +alone +Vertices +: +([-0-9.+eE]+)} [checksection $wire] full num
51 if { $num != 0 } {
52 puts [format "Error : $wire is NOT a closed wire"]
53 }
54 mkplane res_plane $wire
55 set chsh_res_plane [checkshape res_plane]
56 if { [regexp {Faulty +shapes +in +variables +faulty_([-0-9.+eE]+) +to +faulty_([-0-9.+eE]+)} $chsh_res_plane full from_faulty to_faulty ] } {
57 puts "Shape $wire has self-intersection"
58 }
59 }
60 }
40093367 61
58cf74e0 62 # check for number of vertexes
63 if { [info exists nbsh_v ] } {
64 if { ($ll_v != $nbsh_v) || ($nbsh_v == 0 && $ll_v != 0) } {
65 puts "Error : The resulting shape is WRONG because it must contain $nbsh_v vertexes instead of $ll_v"
66 } else {
67 puts "The resulting shape contains $ll_v vertexes"
68 }
69 }
70 # check for number of edges
71 if { [info exists nbsh_e ] } {
72 if { ($ll_e != $nbsh_e) || ($nbsh_e == 0 && $ll_e != 0) } {
73 puts "Error : The resulting shape is WRONG because it must contain $nbsh_e edges instead of $ll_e"
74 } else {
75 puts "The resulting shape contains $ll_e edges"
76 }
77 }
78 # check for number of wires
79 if { [info exists nbsh_w ] } {
80 if { ($ll_w != $nbsh_w) || ($nbsh_w == 0 && $ll_w != 0) } {
81 puts "Error : The resulting shape is WRONG because it must contain $nbsh_w wires instead of $ll_w"
82 } else {
83 puts "The resulting shape contains $ll_w wires"
84 }
85 }
e9102e99 86 } elseif {[info exists command] && [string compare $command "withintersect"] == 0} {
58cf74e0 87 regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m
88 checkshape result
5805221e 89 } else {
58cf74e0 90 #check if result is valid
91 puts [checkshape result]
92
93 regexp {Mass +: +([-0-9.+eE]+)} [vprops result] full m
94
95 #check of face's area value
96 foreach ResultFace [ explode result f ] {
97 regexp {Mass +: +([-0-9.+eE]+)} [sprops $ResultFace] full fmass
98 if { $fmass < 0 } {
99 puts "Error : The area of face $ResultFace of the resulting shape is negative."
100 }
101 }
102 #check for bsection
103 if { [info exists GlobFaces] && [llength $GlobFaces] == 0 } {
104 puts [ bsection re result s ]
105 if { [ isdraw re ] } {
106 regexp {Mass +: +([-0-9.+eE]+)} [lprops $re] full remass
107 if { $remass != 0 } {
108 puts "Error: bsection of the result and s is not equal to zero."
109 }
110 }
111 }
5805221e 112 }
113 if { $m > 0 } {
5747059b 114 checkview -display result -2d -path ${imagedir}/${test_image}.png
58cf74e0 115 }
40093367 116} else {
94a57f1f 117 puts "Error : The offset cannot be built."
40093367 118}
119
120# to end a test script
121puts "TEST COMPLETED"