Selecting with a Fence is BACKWARDS

Selecting with a Fence is BACKWARDS

mgorecki
Collaborator Collaborator
293 Views
1 Reply
Message 1 of 2

Selecting with a Fence is BACKWARDS

mgorecki
Collaborator
Collaborator
Hello,
This code worked correctly in 2006, but suddenly in 2008 it works backward (which means doesn't work).
I select the objects, in this case 8 horizontal lines one above the other, with a fence from a point above the top line, to a point below the bottom line.
In AutoCAD 2006, the first object picked was the line located at the top.
In AutoCAD 2008, the first object picked was the line located at the bottom.

Has anyone else run into this? Here is the code I'm using. This is not about the code, but answers as to why it's different now. The selection set using a fence can have big repercussions if you expect the fence to pick in the correct order like it has always done in the past.

Sub TEST()
Dim AA As AcadSelectionSet
Dim fencepoints As Variant

For kk = 1 To ThisDrawing.SelectionSets.Count
ThisDrawing.SelectionSets.Item(0).Delete
Next

Set AA = ThisDrawing.SelectionSets.Add("aCCaaf12d")
AA.SelectOnScreen

For kk = 1 To AA.Count
AA.Item(kk - 1).Highlight True
Next

End Sub

Thanks,
Mark
0 Likes
294 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

I never saw some document stated  or heard
someone said that entities in an AcadSelectionSet is sorted in certain order. My
understanding is that AcadSelectSet is not a sorted object collection
(container). Yes, entity is added into the collection in a certain order (i.e
one by one), but the collection (AcadSelectionSet) is not designed as
sorted container. So, one should not expect objects in it must be in certain
order. Even your code works in Acad2006, it just is purely from your
good luck and now you run out of good luck with Acad2008. Assumption of
certain order on unsorted object container isn't something one should
do.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hello,
This code worked correctly in 2006, but suddenly in 2008 it works backward
(which means doesn't work). I select the objects, in this case 8 horizontal
lines one above the other, with a fence from a point above the top line, to a
point below the bottom line. In AutoCAD 2006, the first object picked was the
line located at the top. In AutoCAD 2008, the first object picked was the line
located at the bottom. Has anyone else run into this? Here is the code I'm
using. This is not about the code, but answers as to why it's different now.
The selection set using a fence can have big repercussions if you expect the
fence to pick in the correct order like it has always done in the past. Sub
TEST() Dim AA As AcadSelectionSet Dim fencepoints As Variant For kk = 1 To
ThisDrawing.SelectionSets.Count ThisDrawing.SelectionSets.Item(0).Delete Next
Set AA = ThisDrawing.SelectionSets.Add("aCCaaf12d") AA.SelectOnScreen For kk =
1 To AA.Count AA.Item(kk - 1).Highlight True Next End Sub Thanks,
Mark
0 Likes