.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PromptSelectionResult Order

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
624 Views, 2 Replies

PromptSelectionResult Order

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.

2 REPLIES 2
Message 2 of 3
jabowabo
in reply to: Anonymous
Message 3 of 3
ActivistInvestor
in reply to: Anonymous

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.


 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report