本文主要是介绍AutoCAD.NET移动选定对象到指定图层,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
//根据名称获取图层ObjectId,若不存在就创建该图层public static ObjectId GetLayerObjectId(this Database db, string layerName){LayerTable lt = (LayerTable)db.LayerTableId.GetObject(OpenMode.ForRead);if (!lt.Has(layerName)){LayerTableRecord ltr = new LayerTableRecord();ltr.Name = layerName;lt.UpgradeOpen();lt.Add(ltr);db.TransactionManager.AddNewlyCreatedDBObject(ltr, true);lt.DowngradeOpen();}return lt[layerName];}
[CommandMethod("PostInActiveLayer")]public void PostInActiveLayer(){Database db = HostApplicationServices.WorkingDatabase;Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiAc
这篇关于AutoCAD.NET移动选定对象到指定图层的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!