标签:record 遮罩 method mdi mode rtt block dia ica
[CommandMethod("mywipeout")] public static void mywipeout() { // 获取当前文档和数据库 Document acDoc = Application.DocumentManager.MdiActiveDocument; Database acCurDb = acDoc.Database; // 启动事务 using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction()) { // 以读模式打开Block表 BlockTable acBlkTbl; acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable; // 以写模式打开Block表记录Model空间 BlockTableRecord acBlkTblRec; acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; Point2dCollection pt2dArray = new Point2dCollection(); pt2dArray.Add(new Point2d(0, 0)); pt2dArray.Add(new Point2d(100, 0)); pt2dArray.Add(new Point2d(100, 100)); pt2dArray.Add(new Point2d(0, 100)); pt2dArray.Add(new Point2d(0, 0));//必须闭合 Wipeout wipeoutEnt = new Wipeout(); wipeoutEnt.SetFrom(pt2dArray, new Vector3d(0, 0, 1)); acBlkTblRec.AppendEntity(wipeoutEnt); acTrans.AddNewlyCreatedDBObject(wipeoutEnt, true); acTrans.Commit(); } }
标签:record 遮罩 method mdi mode rtt block dia ica
原文地址:https://www.cnblogs.com/edata/p/10105336.html