[CommandMethod("CTest")] public void test() {
Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; Database db = doc.Database;
PromptEntityOptions opts = new PromptEntityOptions("\n选择一个对象:"); PromptEntityResult res = ed.GetEntity(opts); if (res.Status != PromptStatus.OK) return;
using (Transaction tr = db.TransactionManager.StartTransaction()) { Entity ent = tr.GetObject(res.ObjectId, OpenMode.ForWrite) as Entity; ent.Modified += new EventHandler(ent_Modified); tr.Commit(); }
}
void ent_Modified(object sender, EventArgs e) { //throw new NotImplementedException(); } |