示例#1
0
        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>());
                    }
                }
            }
        }
示例#2
0
 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);
 }
示例#3
0
 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;
             }
         }
     }
 }
示例#4
0
 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;
     }
 }
示例#5
0
 public void Dispose()
 {
     AcadFuncs.GetEditor().Rollover -= new RolloverEventHandler(RollOverHandler);
 }