virtual AcRx::AppRetCode On_kUnloadAppMsg(void* pkt){ // TODO: Add your code here // You *must* call On_kUnloadAppMsg here AcRx::AppRetCode retCode = AcRxArxApp::On_kUnloadAppMsg(pkt); // 添加这里 int i = 0; while (g_PEs[i] != NULL) delete g_PEs[i++]; return (retCode); }
using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Runtime; using CLIWrapper; using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
namespaceTestWrapper { publicstaticclassCmds { [CommandMethod("Add")] publicstaticvoidAdd() { var doc = AcadApp.DocumentManager.MdiActiveDocument; var db = doc.Database;
using(var tr = db.TransactionManager.StartTransaction()) { var blockTable = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; var modelSpace = tr.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
CustomEntity1CLIWrapper ent = new CustomEntity1CLIWrapper(); ent.Center = new Autodesk.AutoCAD.Geometry.Point3d(1000,1000,0);
[CommandMethod("Modify")] publicstaticvoidModify() { var doc = AcadApp.DocumentManager.MdiActiveDocument; var db = doc.Database; var ed = doc.Editor;
var res = ed.GetEntity("请选择目标自定义实体"); if (res.Status != Autodesk.AutoCAD.EditorInput.PromptStatus.OK) return; var id = res.ObjectId; using (var tr = db.TransactionManager.StartTransaction()) { var ent = id.GetObject(OpenMode.ForWrite) as CustomEntity1CLIWrapper; ent.Center = new Autodesk.AutoCAD.Geometry.Point3d(2000,2000,0); ent.N = 6;