VBA selection set only sees lines if they are redrawn
VBA selection set only sees lines if they are redrawn
(OP)
I have a VBA program that selects lines on certain layers in a drawing. It almost always works correctly, but every once in a while it will not select some of the lines. If I delete the lines and redraw them, they then can be selected. Any idea what could cause a line to NOT be selected, but then to later be selected if the line is redrawn on the same layer?





RE: VBA selection set only sees lines if they are redrawn
http://mechcad-insider.blogspot.com/
"The fear of the Lord is the beginning of wisdom"
RE: VBA selection set only sees lines if they are redrawn
RE: VBA selection set only sees lines if they are redrawn
For i = 1 To 8
'''''activate the proper layer
If i = 1 Then Layername = "MESA2_UX1100"
If i = 2 Then Layername = "MESA3_UX1400"
If i = 3 Then Layername = "MESA4_UX1500"
If i = 4 Then Layername = "MESA5_UX1600"
If i = 5 Then Layername = "MESA6_UX1700"
If i = 6 Then Layername = "MESA7_UX1800"
If i = 7 Then Layername = "BX1100"
If i = 8 Then Layername = "BX1200"
intCode(0) = -4: varCodeValue(0) = "<AND"
intCode(1) = 0: varCodeValue(1) = "LINE"
intCode(2) = -4: varCodeValue(2) = "<OR"
intCode(3) = 8: varCodeValue(3) = Layername
intCode(4) = -4: varCodeValue(4) = "OR>"
intCode(5) = 67: varCodeValue(5) = "0"
intCode(6) = -4: varCodeValue(6) = "AND>"
'''''select all lines on current layer above a certain line
'''''that is located at Pt1 to Pt2
On Error Resume Next
ThisDrawing.SelectionSets("TEMP").Delete
Set objSS = ThisDrawing.SelectionSets.Add("TEMP")
objSS.Select 1, Pt1, Pt2, intCode, varCodeValue
If objSS.count > 0 Then
For Each objLine In ThisDrawing.ActiveSelectionSet
LineCount = LineCount + 1
objLine.Highlight True
StPoint = objLine.EndPoint
EndPoint = objLine.StartPoint
Next objLine
End If
Next i
RE: VBA selection set only sees lines if they are redrawn
http://mechcad-insider.blogspot.com/
"The fear of the Lord is the beginning of wisdom"
RE: VBA selection set only sees lines if they are redrawn
Borgie's right, you're using a window which won't see everything until it's regened, or if you're lucky, just redrawn. If you must have the window, you'll need to insert a regen before your selection statement if not, change your select statement from:
CODE
To:
CODE
and see if that doesn't help a bit.
HTH
Todd
RE: VBA selection set only sees lines if they are redrawn
RE: VBA selection set only sees lines if they are redrawn
intCode(0) = -4: varCodeValue(0) = "<AND"
intCode(1) = 0: varCodeValue(1) = "<OR"
intCode(2) = 0: varCodeValue(2) = "LINE"
intCode(3) = 0: varCodeValue(3) = "POLYLINE"
intCode(4) = -4: varCodeValue(4) = "OR>"
intCode(5) = 8: varCodeValue(5) = Layername
intCode(6) = 67: varCodeValue(6) = "0"
intCode(7) = -4: varCodeValue(7) = "AND>"
http://mechcad-insider.blogspot.com/
"The fear of the Lord is the beginning of wisdom"
RE: VBA selection set only sees lines if they are redrawn
RE: VBA selection set only sees lines if they are redrawn
intCode(0) = -4: varCodeValue(0) = "<AND"
intCode(1) = 0: varCodeValue(1) = "LINE,LWPOLYLINE,POLYLINE"
intCode(2) = 8: varCodeValue(2) = "MESA*,BX*"
intCode(3) = -4: varCodeValue(3) = "<NOT"
intCode(4) = 8: varCodeValue(4) = "MESA_UX1200,MESA_UX1300"
intCode(5) = -4: varCodeValue(5) = "NOT>"
intCode(6) = 67: varCodeValue(6) = "0"
intCode(7) = -4: varCodeValue(7) = "AND>"
RE: VBA selection set only sees lines if they are redrawn