admin 管理员组

文章数量: 887007

C# CAD 开发得到实体、添加实体、添加XDATA等代码

通过ObjectId得到一个实体的代码:

        private DBObject GetObject(ObjectId id){DBObject obj = null;using (Transaction transaction = Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction()){obj = transaction.GetObject(id, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead, true);transaction.Commit();}return obj;}

添加实体的代码 :

 public static void AppendEntity(Entity ent){using (Transaction transaction =HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction()){BlockTableRecord blockTableRecord;//get block table record of current spaceblockTableRecord = (BlockTableRecord)transaction.GetObject(HostApplicationServices.WorkingDatabase.CurrentSpaceId,

本文标签: C CAD 开发得到实体添加实体添加XDATA等代码