- [CommandMethod("t_1")]
- public void Test1()
- {
- var doc = Application.DocumentManager.MdiActiveDocument;
- var ed = doc.Editor;
- var db = doc.Database;
- var res =
- ed.SelectAll(
- new SelectionFilter(
- new TypedValue[]
- {
- new TypedValue(0, "insert"),
- new TypedValue(10, new Point3d(100, 200, 0))
- }));
- if(res.Status != PromptStatus.OK)
- return;
- using (var tr = db.TransactionManager.StartTransaction())
- {
- var id = res.Value.GetObjectIds()[0];
- var ent = tr.GetObject(id, OpenMode.ForWrite);
- ent.Erase();
- tr.Commit();
- }
- }
按点查找可能还是会出些问题 通常是在该点为中心的范围内查找 |