如何将已有块加入到当前图纸中?
大侠们好,请问如何将已有的块加入到当前的图纸中呢,我写了一些代码,是加上来了,但是我的块本来是增强属性块,可以用增强属性编辑器打开,但是插入进来之后就只能用编辑块定义打开了,请大侠们指点,多谢! ObjectId id = ObjectId.Null; using (Database sourceDatabase = GetDatabaseFromFile("d:\\arx\\bplead_title.dwg")){
id = HostApplicationServices.WorkingDatabase.Insert("BPLEAD_TITLE", sourceDatabase, true);
} Autodesk..ApplicationServices.Document doc = Application.DocumentManager.MdiActiveDocument; Point3d point = new Point3d(bx, by, bz); BlockReference br = null; using (Transaction trans = doc.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)trans.GetObject(doc.Database.BlockTableId, OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt, OpenMode.ForWrite);
using (br = new BlockReference(point, id))
{
btr.AppendEntity(br);
trans.AddNewlyCreatedDBObject(br, true);
}
trans.Commit();
} 复制代码 先收藏,后续学习。。。
页:
[1]