static public List <ObjectId> EntsInsideWindow(AcadGeo.Point3d low_pnt, AcadGeo.Point3d hi_pnt) { using (AcadApp.Application.DocumentManager.MdiActiveDocument.LockDocument()) { using (Transaction tr = AcadFuncs.GetActiveDoc().TransactionManager.StartTransaction()) { PromptSelectionResult prmpt_ret = AcadFuncs.GetEditor().SelectCrossingWindow(low_pnt, hi_pnt); if (PromptStatus.Cancel == prmpt_ret.Status) { tr.Abort(); tr.Dispose(); return(new List <ObjectId>()); } tr.Commit(); if (null != prmpt_ret.Value) { return(prmpt_ret.Value.GetObjectIds().ToList()); } else { return(new List <ObjectId>()); } } } }
public TextJig(DBText entity) : base(entity) { position = new Point3d(0.0, 0.0, 0.0); p1 = new Point3d(0.0, 0.0, 0.0); p2 = new Point3d(0.0, 0.0, 0.0); AcadFuncs.GetEditor().Rollover += new RolloverEventHandler(RollOverHandler); }
private void RollOverHandler(object sender, RolloverEventArgs args) { foreach (var id in args.Picked.GetObjectIds()) { using (Transaction tr = AcadFuncs.GetActiveDb().TransactionManager.StartTransaction()) { Line line = tr.GetObject(id, OpenMode.ForRead) as Line; if (null != line) { //center = line.Center; p1 = line.StartPoint; p2 = line.EndPoint; break; } } } }
public void CreateLayout() { try { DBText text = new DBText(); text.TextString = "abc"; TextJig jig = new TextJig(text); if (PromptStatus.OK == AcadFuncs.GetEditor().Drag(jig).Status) { AcadFuncs.AddNewEnt(text); } } catch { return; } }
public void Dispose() { AcadFuncs.GetEditor().Rollover -= new RolloverEventHandler(RollOverHandler); }