8e7c8ccf |
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 " "] |
f751596e |
11 | set isEdgeInfo 0 |
8e7c8ccf |
12 | set aDepth "" |
8e7c8ccf |
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] |
f751596e |
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]]] |
8e7c8ccf |
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 | |
f751596e |
33 | return [list $isEdgeInfo $aDepth $aPoint $aType] |
8e7c8ccf |
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 |
f751596e |
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} { |
8e7c8ccf |
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: " |
f751596e |
71 | append aDebugInfo [lindex $anInfoList1 $aIdx] |
8e7c8ccf |
72 | append aDebugInfo " and " |
f751596e |
73 | append aDebugInfo [lindex $anInfoList2 $aIdx] |
8e7c8ccf |
74 | puts $aDebugInfo |
75 | puts "ERROR" |
76 | puts "" |
77 | } |
78 | } |
79 | |
f751596e |
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 | |
8e7c8ccf |
96 | # checks that edge e is represented by correct shape and sensitive entity |
f751596e |
97 | if {[string equal $anEdgeSensitiveType "(Select3D_SensitiveSegment)"] == 0} { |
8e7c8ccf |
98 | puts "Wrong sensitive for segment! Value is: " |
f751596e |
99 | puts $anEdgeSensitiveType |
8e7c8ccf |
100 | puts "Must be: (Select3D_SensitiveSegment)" |
101 | puts "ERROR" |
102 | puts "" |
103 | } |
104 | |
f751596e |
105 | set aEdgeType [string trim [lindex $aOut $anEdgeTypeStringNb]] |
8e7c8ccf |
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 |
f751596e |
115 | if {[string equal $aWireSensitiveType "(Select3D_SensitiveWire)"] == 0} { |
8e7c8ccf |
116 | puts "Wrong sensitive for wire! Value is: " |
f751596e |
117 | puts $aWireSensitiveType |
8e7c8ccf |
118 | puts "Must be: (Select3D_SensitiveWire)" |
119 | puts "ERROR" |
120 | puts "" |
121 | } |
122 | |
f751596e |
123 | set aWireType [string trim [lindex $aOut $aWireTypeStringNb]] |
8e7c8ccf |
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 | |
f751596e |
132 | set aWireChildSensitiveType [string trim [lindex $aOut [expr $aWireTypeStringNb + 1]]] |
133 | if {[string equal $aWireChildSensitiveType "Detected Child: Select3D_SensitiveCurve"] == 0} { |
8e7c8ccf |
134 | puts "Wrong type of wire's inner sensitive! Value is: " |
f751596e |
135 | puts $aWireChildSensitiveType |
8e7c8ccf |
136 | puts "Must be: Detected Child: Select3D_SensitiveCurve" |
137 | puts "ERROR" |
138 | } |