Can't select all lines on a layer
Can't select all lines on a layer
(OP)
I'm using VBA to select all the lines on a layer. When I select them, every once in a while, they all don't get selected. If I select the line and type LIST, it shows up as a line but I cannot select it with the program unless it is redrawn. If I delete the lines and redraw them, then I can select them. I have a feeling that maybe the lines have been copied or extended which may be causing the problem, but I don't know.
Any ideas on this?
Any ideas on this?





RE: Can't select all lines on a layer
How are selecting the lines with your code (can you post a snippet) - it would help to answer your question.
Todd
RE: Can't select all lines on a layer
Here is the code:
Private Sub cmdCheckGeogridSelect_Click()
intCodes(0) = 8
NewLayer = "MESA4_UX1500": varCodeValues(0) = NewLayer
For Each objLayer In ThisDrawing.Layers
objLayer.LayerOn = False
If objLayer.Name = "MESA2_UX1100" Then objLayer.LayerOn = True
If objLayer.Name = "MESA3_UX1400" Then objLayer.LayerOn = True: ThisDrawing.ActiveLayer = ThisDrawing.Layers("MESA3_UX1400")
If objLayer.Name = "MESA4_UX1500" Then objLayer.LayerOn = True
If objLayer.Name = "MESA5_UX1600" Then objLayer.LayerOn = True
Next objLayer
Call SelectAll
End
End Sub
and
Public Sub SelectAll()
On Error Resume Next
ThisDrawing.SelectionSets("TEMP").Delete
Set objSS = ThisDrawing.SelectionSets.Add("TEMP")
objSS.Select 5, Pt2, Pt1, intCodes, varCodeValues ' 5 = all, 1 = use Pt1 and
End Sub
RE: Can't select all lines on a layer
"Everybody is ignorant, only on different subjects." — Will Rogers
RE: Can't select all lines on a layer
RE: Can't select all lines on a layer
intCode(0) = -4: vntCode(0) = "<AND"
intCode(1) = 0: vntCode(1) = "LINE"
intCode(2) = 8: vntCode(2) = "SOMELAYERNAME"
intCode(3) = -4: vntCode(3) = "AND>"
acSelSet.Select 5, , , intCode, vntCode
"Everybody is ignorant, only on different subjects." — Will Rogers
RE: Can't select all lines on a layer
RE: Can't select all lines on a layer
RE: Can't select all lines on a layer
RE: Can't select all lines on a layer
I think you're missing your varCodeValues value - in other words, you've told your routine to select all entities on a particular layer - but didn't specify your layer.
HTH
Todd
RE: Can't select all lines on a layer
RE: Can't select all lines on a layer
You are specifying some things in one subrotine but are calling them from another. Are these values (intcodes, varcodevalues) global? If not, they do not get called correctly.
Are the lines you want to grab being created during these routines? The app may need to be updated during their creation so the code may "see" them.
"Everybody is ignorant, only on different subjects." — Will Rogers
RE: Can't select all lines on a layer
RE: Can't select all lines on a layer
What do you mean by window?
Can you see them on the screen?
Can you select them manually?
Does a regenall help?
RE: Can't select all lines on a layer
RE: Can't select all lines on a layer
Are the lines true lines or are they Splines or LWPolylines or Polylines or any other type of entity? When you LIST the lines that do not get selected, is there anything different about them as compared to when they are selected by your program?
RE: Can't select all lines on a layer
The layer name is case sensitive but the layers that get selected and the ones that don't are all on the same layer and get selected in the same selection set command. Becasue they are all selected at the same time I would expect them all to be selected. I'm using a Select All, so I would expect them all to be selected. It's only when I redraw them that they get selected. Can copying a line cause this?
There is another line in my drawings that I always have to redraw before the program sees it. I THINK the reason is because it is brought in as part of a block that gets exploded.
RE: Can't select all lines on a layer
Are you saying, in code, you bring in a block, explode it and then try to grab some lines from it and lines elsewhere that are all on the same layer? Have you updated the session while doing this. eg thisdrawing.update Remember, AutoCAD is a database and a screen representation of that database. Select works with the drawing screen per se and sometimes the db and screen don't jive.
"Everybody is ignorant, only on different subjects." — Will Rogers
RE: Can't select all lines on a layer
Dim intCode(0) As Integer
Dim varCodeValue(0) As Variant
intCode(0) = 8
varCodeValue(0) = “ThisLayer”
On Error Resume Next
ThisDrawing.SelectionSets("TEMP").Delete
Set objSS = ThisDrawing.SelectionSets.Add("TEMP")
objSS.Select 5, , , intCodes, varCodeValues
But it seems to work better if I write it like this…..
Dim intCode(7) As Integer
Dim varCodeValue(7) As Variant
intCode(0) = -4: varCodeValue(0) = "<AND"
intCode(1) = 0: varCodeValue(1) = "LINE"
intCode(2) = -4: varCodeValue(2) = "<OR"
intCode(3) = 8: varCodeValue(3) = "ThisLayer"
intCode(4) = 8: varCodeValue(4) = "OtherLayer"
intCode(5) = -4: varCodeValue(5) = "OR>"
intCode(6) = 67: varCodeValue(6) = "0"
intCode(7) = -4: varCodeValue(7) = "AND>"
On Error Resume Next
ThisDrawing.SelectionSets("TEMP").Delete
Set objSS = ThisDrawing.SelectionSets.Add("TEMP")
objSS.Select 5, , , intCodes, varCodeValues
Does it make sense that this change could solve the problem?
RE: Can't select all lines on a layer
"Everybody is ignorant, only on different subjects." — Will Rogers
RE: Can't select all lines on a layer