马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Editor.SelectAll with entity and layer selection filter By Virupaksha Aithal
While using “Editor.SelectAll” API, you can provide “SelectionFilter” to filter out the unwanted entities. Below code shows a simple example which only gets the Lines and circles from a specified layer only (0, Layer1, Layer2).
- [CommandMethod("LayerSelection")]
- public void LayerSelection()
- {
- Document doc = Application.DocumentManager.MdiActiveDocument;
- Database db = doc.Database;
- Editor ed = doc.Editor;
- TypedValue[] filterlist = new TypedValue[2];
- //select circle and line
- filterlist[0] = new TypedValue(0, "CIRCLE,LINE");
- //8 = DxfCode.LayerName
- filterlist[1] = new TypedValue(8, "0,Layer1,Layer2");
- SelectionFilter filter =
- new SelectionFilter(filterlist);
- PromptSelectionResult selRes = ed.SelectAll(filter);
- if (selRes.Status != PromptStatus.OK)
- {
- ed.WriteMessage(
- "\nerror in getting the selectAll");
- return;
- }
- ObjectId[] ids = selRes.Value.GetObjectIds();
- ed.WriteMessage("No entity found: "
- + ids.Length.ToString() + "\n");
- }
|