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 "Depth:"] == 0} {
19 set aDepth [string trim [lindex $theInfoString [expr $aIdx + 1]]]
20 } elseif {[string compare $aItem "Distance:"] == 0} {
21 set aDistance [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 $aDepth $aDistance $aPoint $aType]
36 pload VISUALIZATION MODELING
53 set aOut [split [vstate -entities] "\n"]
55 # compare parameters of detected match: depth, distance and point
56 set aEdgeInfoList [ParseEntityInfo [lindex $aOut 1]]
57 set aWireInfoList [ParseEntityInfo [lindex $aOut 3]]
58 for {set aIdx 0} {$aIdx < 3} {incr aIdx} {
59 if {[string equal [lindex $aEdgeInfoList $aIdx] [lindex $aWireInfoList $aIdx]] == 0} {
60 set aDebugInfo "Characteristics are not equal at value nb: "
61 append aDebugInfo [expr $aIdx + 1]
63 set aDebugInfo "The values are: "
64 append aDebugInfo [lindex $aEdgeInfoList $aIdx]
65 append aDebugInfo " and "
66 append aDebugInfo [lindex $aWireInfoList $aIdx]
73 # checks that edge e is represented by correct shape and sensitive entity
74 if {[string equal [lindex $aEdgeInfoList 3] "(Select3D_SensitiveSegment)"] == 0} {
75 puts "Wrong sensitive for segment! Value is: "
76 puts [lindex $aEdgeInfoList 3]
77 puts "Must be: (Select3D_SensitiveSegment)"
82 set aEdgeType [string trim [lindex $aOut 2]]
83 if {[string equal $aEdgeType "Detected Shape: BRep_TEdge"] == 0} {
84 puts "Wrong type of edge! Value is: "
86 puts "Must be: Detected Shape: BRep_TEdge"
91 # checks that wire b_5 is represented by correct shape and sensitive entity
92 if {[string equal [lindex $aWireInfoList 3] "(Select3D_SensitiveWire)"] == 0} {
93 puts "Wrong sensitive for wire! Value is: "
94 puts [lindex $aWireInfoList 3]
95 puts "Must be: (Select3D_SensitiveWire)"
100 set aWireType [string trim [lindex $aOut 4]]
101 if {[string equal $aWireType "Detected Shape: TopoDS_TWire"] == 0} {
102 puts "Wrong type of wire! Value is: "
104 puts "Must be: Detected Shape: TopoDS_TWire"
109 set aWireSensitiveType [string trim [lindex $aOut 5]]
110 if {[string equal $aWireSensitiveType "Detected Child: Select3D_SensitiveCurve"] == 0} {
111 puts "Wrong type of wire's inner sensitive! Value is: "
112 puts $aWireSensitiveType
113 puts "Must be: Detected Child: Select3D_SensitiveCurve"