- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to get the Editor class to select all entities in model space not on locked layers, and despite the documentation stating "Selects all objects in the current space in which are not locked or frozen."....it will always return the object IDs from all layers regardless of if they are locked, frozen, or even turned off. I need it to return a selection set without entities on locked layers. For most of my classes I am using TypedValue to define the entities I want to filter and then creating a SelectionFilter to pass as an argument to Editor.SelectAll(SelectionFilter). Since SelectAll is selecting all entities regardless of the layer state, is it possible to create a TypedValue to use as a filter for the selection? Again, my end goal is to select all entities of certain types on only unlocked layers.
Here is what I'm doing now. Would be great if SelectAll actually ignored locked layers or if I could just add a new TypedValue to get entities on only unlocked layers. Any help is appreciated.
TypedValue[] tvArr = new TypedValue[] { new TypedValue(-4, "<OR") new TypedValue(0, "LINE") new TypedValue(0, "LWPOLYLINE") new TypedValue(0, "POLYLINE") new TypedValue(0, "SPLINE") new TypedValue(-4, "OR>") } PromptSelectionResult psr = editor.SelectAll(new SelectionFilter(tvArr)); ObjectId[] objectIdArr = psr.Value.GetObjectIds();
EDIT: I can create a list of all objects and then open each one for read to see if the layer it is on is locked, but that seems ridiculous I should have to include all the locked and unlocked objects in the same list and then check the layer state after the list is already made. It works, but ideally this is not the way it should be done. It's not very efficient. If I don't want objects on locked layers I should disclude them before the list is finalized.
Solved! Go to Solution.