public static Xline Jig() { XlineJig jigger = null; try { jigger = new XlineJig(new Xline()); PromptResult pr; do { pr = MgdAcApplication.DocumentManager.MdiActiveDocument.Editor.Drag(jigger); if (pr.Status == PromptStatus.Keyword) { // Keyword handling code } else { jigger.mCurJigFactorIndex++; } } while (pr.Status != PromptStatus.Cancel && pr.Status != PromptStatus.Error && jigger.mCurJigFactorIndex <= 2); if (pr.Status == PromptStatus.Cancel || pr.Status == PromptStatus.Error) { if (jigger != null && jigger.Entity != null) { jigger.Entity.Dispose(); } return(null); } else { return(jigger.Entity); } } catch { if (jigger != null && jigger.Entity != null) { jigger.Entity.Dispose(); } return(null); } }
public static void TestEntityJigger1_Method() { try { Entity jigEnt = XlineJig.Jig(); if (jigEnt != null) { Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); btr.AppendEntity(jigEnt); tr.AddNewlyCreatedDBObject(jigEnt, true); tr.Commit(); } } } catch (System.Exception ex) { MgdAcApplication.DocumentManager.MdiActiveDocument.Editor.WriteMessage(ex.ToString()); } }