Problem: How to remove Lines (or other entities) from a selection set?

Problem: How to remove Lines (or other entities) from a selection set?

BKSpurgeon
Collaborator Collaborator
492 Views
2 Replies
Message 1 of 3

Problem: How to remove Lines (or other entities) from a selection set?

BKSpurgeon
Collaborator
Collaborator

Couldn't readily discern any methods within the selectionSet class which readily allows one to add and remove items. The current methods within the class are (CopyTo, FromObjectIds, GetEnumerator, GetObjectIds, ToString) - none to add or remove items. My preference is to work with the existing selection set rather than to create a new one.

 

Is there any way of removing Lines from a given selection set?

 

Your assistance is greatly appreciated.

 

BK

 

 

 

0 Likes
493 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant

Hi,

 

AFAIK you cannot change the content of a selection set after the selection ends.

During the selection, you can handle the SelectionAdded event to filter as shown in this thread.

 

But it seems to me, it would be much more simple to convert the selection set into an ObjectIdCollection (or a List<Entity>) to make the changes to the collection, and if you finally really need a SelectionSet object, rebuild one using the SelectionSet.FromObjectIds() method.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 3

BKSpurgeon
Collaborator
Collaborator

Thank you sir, this helps immensely.

 

I was considering doing exactly as you suggested, but this would involve rewriting of some code, which I am lothe to do.

 

regards

 

BK

0 Likes