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