1496c35bf39ff8eae180bb5afe8f6e8c56282aed
[occt.git] / tests / caf / nam / A5
1 #################### select shape and check selection procedure ####################
2 proc Select {lab shape context} {
3   global D IsDone TestError
4   set res ""
5   if {[string compare $context ""] == 0} {
6     if {[catch {set res [SelectShape D $lab $shape]}]} {
7         set IsDone 0
8         set TestError "$TestError # SelectShape bad result for args: $lab shape"
9     }
10   } else {
11     if {[catch {set res [SelectShape D $lab $shape $context]}]} {
12         set IsDone 0
13         set TestError "$TestError # SelectShape bad result for args: $lab shape"
14     }
15   }
16   return [CenterOfShape $shape]
17 }
18
19 if {[catch {set TestLab}] == 1} {
20         NewDocument D
21         set TestLab 0:1
22 }
23
24 set IsDone 1
25 source ${scriptdir}/A3
26 set Test "TNaming_Selector test"
27 if {$IsDone == 0} {
28         set TestError " # Can't test iterators becouse of Tool errors: # $TestError"
29 } else {
30
31 #################### selection and checking shapes ####################
32
33 ### IDENTIFY NAMING
34 set res1 [Select "[set TestLab]:10:1" f ""]
35 set res2 [Select "[set TestLab]:10:2" e1 f]
36 set res3 [Select "[set TestLab]:10:3" e2 ""]
37 ### INTERSECTION NAMING (complex : with GENERATION and IDENTITY)
38 set res4 [Select "[set TestLab]:10:4" v1 "f"]
39 explode b E
40 set res5 [Select "[set TestLab]:10:5" b_1 "b"]
41 puts [dump $res5]
42 explode b V
43 set res6 [Select "[set TestLab]:10:6" b_1 "b"]
44 explode c E
45 # labels 7-24
46
47 if {0} {
48
49 for {set i 1} {$i <= 18} {incr i} {
50   set res[expr $i+6] [Select "[set TestLab]:10:[expr $i+6]" c_$i "c"]
51 }
52 explode c F
53 # labels 25-32
54 for {set i 1} {$i <= 8} {incr i} {
55   set res[expr $i+24] [Select "[set TestLab]:10:[expr $i+24]" c_$i "c"]
56 }
57 #################### simple GENERATION naming ####################
58 #explode p F
59 ##labels 33-35
60 #for {set i 1} {$i <= 3} {incr i} {
61 #  set res[expr $i+32] [Select "[set TestLab]:10:[expr $i+32]" p_$i "p"]
62 #}
63 explode c So
64 set res33 [Select "[set TestLab]:10:33" c_1 c]
65 set res34 [Select "[set TestLab]:10:34" c_2 c]
66 ####################### simple MODIFUNTIL naming ####################
67 set res35 [Select "[set TestLab]:10:35" c ""]
68
69 #################### solve selection checking with empty valid map ####################
70 for {set i 1} {$i <= 35} {incr i} {
71   if {[catch {SolveSelection D [set TestLab]:10:$i}]} {
72         set IsDone 0
73         set TestError "$TestError # SolveSelection failed for label [set TestLab]:10:$i"
74   } else {
75     GetShape D [set TestLab]:10:$i r
76     if {[string compare [CenterOfShape r] [set res$i]] != 0} {
77         set IsDone 0
78         set TestError "$TestError # SolveSelection result not same for lab $i : [CenterOfShape r] and [set res$i]"
79     }
80   }
81 }
82 #################### with setted valid map ####################
83
84 }
85
86 puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
87
88 if {[catch {SolveSelection D [set TestLab]:10:4 [set TestLab]:1:1}] == 0} {
89   set IsDone 0
90   set TestError "$TestError # SolveSelection is not failed with deficit of valid map (label [set TestLab]:10:4)"
91 }
92 #if {[catch {SolveSelection D [set TestLab]:10:4 [set TestLab]:1:1 [set TestLab]:1:3}] == 1} {
93 #  set IsDone 0
94 #  set TestError "$TestError # SolveSelection failed for good valid map (label [set TestLab]:10:4)"
95 #}
96
97 }