How does one do a selection set to select all in C#
Solved! Go to Solution.
Solved by _gile. Go to Solution.
Here's one way that I found by searching this forum.
In terms of AutoCAD programming, especially with AutoCAD .NET programming, the question does not make much programming sense without take into account what you intend to do in a concrete situation.
Firstly, "selection" means differently to CAD users and to programmers: for the former, it means AutoCAD VISUALLY shows which entities being selected with highlights and grips, while for the latter, they just want to identify a group of entities in computer's memory, and the entities may or may not be shown highlighted or be noticed by CAD users.
In the VBA age, AcadSelectionSet in COM API is used much more than .NET API's counterpart SelectionSet, because VBA lacks built-in collection/container class. With .NET API, programmer can use one of the many built-in collection/container classes (List/Dictionary/Queue/Stack/...) besides Acad .NET API's SelectionSet. There are many different ways a programmer can identify entities and gather them into a collection class of his/her choice, depending the need at the moment/situation.
But, basically, for short/dirty answer, to select all entities, you either call Editor.SelectAll(), or get the layout/ModelSpace BlockTableRecord, which is a container of all entities (entity IDs) in the layout/ModelSpace. I'd say the latter would be the quickest way. But if you want the entities being highlighted, this is another thing to discuss, unless you post this question as CAD user, not a programmer (then, wrong forum).
Norman Yuan
Can't find what you're looking for? Ask the community or share your knowledge.