Issue
If I call Editor.SelectAll(), will it return only entities currently visible on the screen?
Solution
No, Editor.SelectAll() returns also entities, which are placed on frozen layers. In our program we need to check whether an entity's layer is frozen. Here is a sample:
[CommandMethod("_SANF")]
public static void SelectAllExceptFrozenLayers()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
PromptSelectionResult selection = ed.SelectAll();
if (selection.Status == PromptStatus.OK)
{
using (Transaction tr =
doc.Database.TransactionManager.StartTransaction())
{
foreach (ObjectId id in selection.Value.GetObjectIds())
{
Entity ent = (Entity)tr.GetObject(id, OpenMode.ForRead);
LayerTableRecord layer = (LayerTableRecord)tr.GetObject(
ent.LayerId, OpenMode.ForRead);
if (!layer.IsFrozen)
ed.WriteMessage("\n{0}", ent.ToString());
}
tr.Commit();
} // using
} // if
} // SelectAllExceptFrozenLayers()