PromptSelectionResult Order

PromptSelectionResult Order

Anonymous
Not applicable
814 Views
2 Replies
Message 1 of 3

PromptSelectionResult Order

Anonymous
Not applicable

Hi All,

 

When using the PromptSelectionResult, the order of entities selected by autocad, seems to be the last item in the window first and the first item last.

 

Using this " For Each psrId As ObjectId In psr.Value.GetObjectIds()", does anyone know of a way to :

a) step through the list backwards, or

b) reverse the order of the selection

 

My only thought is to create a new ObjectID Collection and then step through that, but that seems like more work than is necessary.

0 Likes
Accepted solutions (1)
815 Views
2 Replies
Replies (2)
Message 2 of 3

jabowabo
Mentor
Mentor
0 Likes
Message 3 of 3

ActivistInvestor
Mentor
Mentor
Accepted solution

Why is the order in which the objects appear in the selection result significant?  If objects are being selected using a Window/Crossing box/polygon, you should regard the order as being random or undefined. In almost all cases I've come across, the order in which objects appear in a selection result is only meaningful if the user was required to explicitly pick each one, rather than use a window/crossing box/polygon.

 

In any case, you can use Array.Reverse() on the result of GetObjectIds(), and there's no need to create an ObjectIdCollection since it serves no purpose (you can just operate directly on the array of ObjectIds).

 


@Anonymous wrote:

Hi All,

 

When using the PromptSelectionResult, the order of entities selected by autocad, seems to be the last item in the window first and the first item last.

 

Using this " For Each psrId As ObjectId In psr.Value.GetObjectIds()", does anyone know of a way to :

a) step through the list backwards, or

b) reverse the order of the selection

 

My only thought is to create a new ObjectID Collection and then step through that, but that seems like more work than is necessary.


 

0 Likes