5 ####################################################################################
6 # Visualization - Calculation of depth on selection of a wire is not accurate
7 ####################################################################################
9 proc ParseEntityInfo {theInfoString} {
10 set aStringArr [split $theInfoString " "]
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} {
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]]]
25 append aPoint [string trim [lindex $theInfoString [expr $aIdx + 2]]]
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]
33 return [list $isEdgeInfo $aDepth $aPoint $aType]
36 pload VISUALIZATION MODELING
53 set aOut [split [vstate -entities] "\n"]
55 # compare parameters of detected match: depth, distance and point
58 set anInfoList1 [ParseEntityInfo [lindex $aOut $anInfoList1Idx]]
59 if {[string equal [lindex $anInfoList1 0] "1"]} {
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]
70 set aDebugInfo "The values are: "
71 append aDebugInfo [lindex $anInfoList1 $aIdx]
72 append aDebugInfo " and "
73 append aDebugInfo [lindex $anInfoList2 $aIdx]
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]
90 set anEdgeTypeStringNb 5
91 set anEdgeSensitiveType [lindex $anInfoList2 3]
92 set aWireTypeStringNb 2
93 set aWireSensitiveType [lindex $anInfoList1 3]
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)"
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: "
109 puts "Must be: Detected Shape: BRep_TEdge"
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)"
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: "
127 puts "Must be: Detected Shape: TopoDS_TWire"
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"