public void filer()
 {
     Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
     PromptEntityOptions opt = new PromptEntityOptions("Select an object to dump");
     PromptEntityResult res ;
     do
     {
         res = ed.GetEntity(opt);
         opt.Message = "\nNo object selected. Select an object to dump";
     }
     while (res.Status == PromptStatus.Error);
     if (res.Status == PromptStatus.OK)
     {
         using (Transaction t = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
         {
             Entity ent = (Entity)t.GetObject(res.ObjectId,OpenMode.ForRead);
             MyFiler filer = new MyFiler();
             ent.DwgOut(filer);
             t.Commit();
         }
     }
 }
示例#2
0
        public void filer()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            PromptEntityOptions opt = new PromptEntityOptions("Select an object to dump");
            PromptEntityResult  res;

            do
            {
                res         = ed.GetEntity(opt);
                opt.Message = "\nNo object selected. Select an object to dump";
            }while (res.Status == PromptStatus.Error);
            if (res.Status == PromptStatus.OK)
            {
                using (Transaction t = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
                {
                    Entity  ent   = (Entity)t.GetObject(res.ObjectId, OpenMode.ForRead);
                    MyFiler filer = new MyFiler();
                    ent.DwgOut(filer);
                    t.Commit();
                }
            }
        }