Exemple #1
0
        static public List <ObjectId> PickEnts()
        {
            using (AcadApp.Application.DocumentManager.MdiActiveDocument.LockDocument())
            {
                using (Transaction tr = AcadFuncs.GetActiveDoc().TransactionManager.StartTransaction())
                {
                    PromptSelectionResult prmpt_ret = AcadFuncs.GetEditor().GetSelection();
                    if (PromptStatus.Cancel == prmpt_ret.Status)
                    {
                        tr.Abort();
                        tr.Dispose();
                        return(new List <ObjectId>());
                    }

                    tr.Commit();
                    return(prmpt_ret.Value.GetObjectIds().ToList());
                }
            }
        }
Exemple #2
0
        public List <DataExcel> GetData()
        {
            List <ObjectId>  ids        = AcadFuncs.PickEnts();
            List <DataExcel> data_excel = new List <DataExcel>();

            using (Transaction tr = AcadFuncs.GetActiveDoc().TransactionManager.StartTransaction())
            {
                foreach (var id in ids)
                {
                    Line line = tr.GetObject(id, OpenMode.ForRead) as Line;
                    if (null == line)
                    {
                        continue;
                    }

                    data_excel.Add(new DataExcel(line.StartPoint, line.EndPoint));
                }
            }

            return(data_excel);
        }