写个简单的代码可以测试一下 [CommandMethod("ttt")] public void TTT() { Database db = HostApplicationServices.WorkingDatabase; Document doc = Application.DocumentManager.GetDocument(db); PromptEntityResult res = doc.Editor.GetEntity("\n请选择:"); if (res.Status == PromptStatus.OK) { using (Transaction tr = db.TransactionManager.StartTransaction()) { Entity ent = (Entity)tr.GetObject(res.ObjectId, OpenMode.ForRead); CadHelper.WriteMessage(ent.GetType().Name); } } }
|