89da7459890d917961623aac854b8f68b1bf7add
[occt.git] / tests / bugs / modalg_6 / bug27252_3
1 puts "========="
2 puts "OCC24585"
3 puts "========="
4 puts ""
5 ###########################################################
6 # Wrong pcurve of the section curve
7 ###########################################################
8
9 set GoodNbCurv 1
10 set GoodLength 0.9119608849931374
11
12 restore [locate_data_file bug27252_s671.draw] s1
13 restore [locate_data_file bug27252_s672.draw] s2
14
15 set CheckID 0
16
17 foreach Toler { 1.0e-7 1.0e-4 } {
18   incr CheckID
19   
20   intersect result s1 s2 ${Toler}
21
22   set che [whatis result]
23   set ind [string first "3d curve" $che]
24   if {${ind} >= 0} {
25     #Only variable "result" exists
26     renamevar result result_1
27   }
28
29   set clen 0.0
30
31   set ic 1
32   set AllowRepeate 1
33   while { $AllowRepeate != 0 } {
34     set che [whatis result_$ic]
35     set ind [string first "3d curve" $che]
36     if {${ind} < 0} {
37       set AllowRepeate 0
38     } else {
39       display result_$ic
40       
41       bounds result_$ic U1 U2
42       
43       if {[dval U2-U1] < 1.0e-9} {
44         puts "Error: Wrong curve's range!"
45       }
46       
47       xdistcs result_$ic s1 U1 U2 10 1.0e-7
48       xdistcs result_$ic s2 U1 U2 10 1.0e-7
49       
50       for { set ip [expr $ic-1] } { $ip > 0 } { incr ip -1 } {
51         mkedge e1 result_$ic
52         mkedge e2 result_$ip
53
54         set coe [checkoverlapedges e1 e2 5.0e-5]
55
56         puts "result_$ic <-> result_$ip: $coe"
57         if { [regexp "Edges is not overlaped" $coe] != 1 } {
58           puts "Error: result_$ic and result_$ip are overlaped"
59         }
60       }
61       
62       regexp "The length result_$ic is +(\[-0-9.+eE\]+)" [length result_$ic] full ll
63       set clen [expr $clen+$ll]
64        
65       incr ic
66     }
67   }
68
69   if {[expr {$ic - 1}] == $GoodNbCurv} {
70     puts "OK: Number of curves is good!"
71   } else {
72     puts "Error: $GoodNbCurv is expected but [expr {$ic - 1}] is found!"
73   }
74
75   puts "Summary length = $clen"
76   checkreal SumLength $clen $GoodLength 0.0 1.0e-6
77
78   smallview
79   don result*
80   fit
81   clear
82   don s1 s2 result*
83   checkview -screenshot -2d -path ${imagedir}/${test_image}_${CheckID}.png
84 }