马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
When using Editor.SelectAll(), how can I filter entities on frozen layers out? (.NET)
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()
|