0031304: Configuration - TKACIS building failure due to duplicated symbol GeomFillFus...
[occt.git] / tests / bugs / vis / bug25098
1 puts "============"
2 puts "OCC25098"
3 puts "============"
4 puts ""
5 ####################################################################################
6 # Visualization - Calculation of depth on selection of a wire is not accurate
7 ####################################################################################
8
9 proc ParseEntityInfo {theInfoString} {
10   set aStringArr [split $theInfoString " "]
11   set isEdgeInfo 0
12   set aDepth ""
13   set aPoint ""
14   set aType ""
15   set aSize [llength $aStringArr]
16   for {set aIdx 0} {$aIdx < $aSize} {incr aIdx} {
17     set aItem [lindex $theInfoString $aIdx]
18     if {[string compare $aItem "e"] == 0} {
19       set isEdgeInfo 1
20     } elseif {[string compare $aItem "Depth:"] == 0} {
21         set aDepth [string trim [lindex $theInfoString [expr $aIdx + 1]]]
22     } elseif {[string compare $aItem "Point:"] == 0} {
23         set aPoint [string trim [lindex $theInfoString [expr $aIdx + 1]]]
24         append aPoint " "
25         append aPoint [string trim [lindex $theInfoString [expr $aIdx + 2]]]
26         append aPoint " "
27         append aPoint [string trim [lindex $theInfoString [expr $aIdx + 3]]]
28       } elseif {[string compare [string index $aItem 0] "("] == 0} {
29         set aType [string trim $aItem]
30     }
31   }
32
33   return [list $isEdgeInfo $aDepth $aPoint $aType]
34 }
35
36 pload VISUALIZATION MODELING
37 vinit
38
39 box b 10 10 10
40 vdisplay b
41 vremove b
42
43 explode b w
44 vdisplay b_5
45
46 vertex v1 10 0 0
47 vertex v2 10 10 0
48 edge e v1 v2
49 vdisplay e
50
51 vfit
52 vmoveto 240 300
53 set aOut [split [vstate -entities] "\n"]
54
55 # compare parameters of detected match: depth, distance and point
56 set anInfoList1Idx 1
57 set anInfoList2Idx -1
58 set anInfoList1 [ParseEntityInfo [lindex $aOut $anInfoList1Idx]]
59 if {[string equal [lindex $anInfoList1 0] "1"]} {
60   set anInfoList2Idx 3
61 } else {
62   set anInfoList2Idx 4
63 }
64 set anInfoList2 [ParseEntityInfo [lindex $aOut $anInfoList2Idx]]
65 for {set aIdx 1} {$aIdx < 3} {incr aIdx} {
66   if {[string equal [lindex $anInfoList1 $aIdx] [lindex $anInfoList2 $aIdx]] == 0} {
67     set aDebugInfo "Characteristics are not equal at value nb: "
68     append aDebugInfo [expr $aIdx + 1]
69     puts $aDebugInfo
70     set aDebugInfo "The values are: "
71     append aDebugInfo [lindex $anInfoList1 $aIdx]
72     append aDebugInfo " and "
73     append aDebugInfo [lindex $anInfoList2 $aIdx]
74     puts $aDebugInfo
75     puts "ERROR"
76     puts ""
77   }
78 }
79
80 set anEdgeSensitiveType ""
81 set aWireSensitiveType ""
82 set anEdgeTypeStringNb -1
83 set aWireTypeStringNb -1
84 if {[string equal [lindex $anInfoList1 0] "1"]} {
85   set anEdgeTypeStringNb 2
86   set anEdgeSensitiveType [lindex $anInfoList1 3]
87   set aWireTypeStringNb 4
88   set aWireSensitiveType [lindex $anInfoList2 3]
89 } else {
90   set anEdgeTypeStringNb 5
91   set anEdgeSensitiveType [lindex $anInfoList2 3]
92   set aWireTypeStringNb 2
93   set aWireSensitiveType [lindex $anInfoList1 3]
94 }
95
96 # checks that edge e is represented by correct shape and sensitive entity
97 if {[string equal $anEdgeSensitiveType "(Select3D_SensitiveSegment)"] == 0} {
98   puts "Wrong sensitive for segment! Value is: "
99   puts $anEdgeSensitiveType
100   puts "Must be: (Select3D_SensitiveSegment)"
101   puts "ERROR"
102   puts ""
103 }
104
105 set aEdgeType [string trim [lindex $aOut $anEdgeTypeStringNb]]
106 if {[string equal $aEdgeType "Detected Shape: BRep_TEdge"] == 0} {
107   puts "Wrong type of edge! Value is: "
108   puts $aEdgeType
109   puts "Must be: Detected Shape: BRep_TEdge"
110   puts "ERROR"
111   puts ""
112 }
113
114 # checks that wire b_5 is represented by correct shape and sensitive entity
115 if {[string equal $aWireSensitiveType "(Select3D_SensitiveWire)"] == 0} {
116   puts "Wrong sensitive for wire! Value is: "
117   puts $aWireSensitiveType
118   puts "Must be: (Select3D_SensitiveWire)"
119   puts "ERROR"
120   puts ""
121 }
122
123 set aWireType [string trim [lindex $aOut $aWireTypeStringNb]]
124 if {[string equal $aWireType "Detected Shape: TopoDS_TWire"] == 0} {
125   puts "Wrong type of wire! Value is: "
126   puts $aWireType
127   puts "Must be: Detected Shape: TopoDS_TWire"
128   puts "ERROR"
129   puts ""
130 }
131
132 set aWireChildSensitiveType [string trim [lindex $aOut [expr $aWireTypeStringNb + 1]]]
133 if {[string equal $aWireChildSensitiveType "Detected Child: Select3D_SensitiveCurve"] == 0} {
134   puts "Wrong type of wire's inner sensitive! Value is: "
135   puts $aWireChildSensitiveType
136   puts "Must be: Detected Child: Select3D_SensitiveCurve"
137   puts "ERROR"
138 }