大侠们好,请问如何将已有的块加入到当前的图纸中呢,我写了一些代码,是加上来了,但是我的块本来是增强属性块,可以用增强属性编辑器打开,但是插入进来之后就只能用编辑块定义打开了,请大侠们指点,多谢!
- 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[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
-
- using (br = new BlockReference(point, id))
- {
- btr.AppendEntity(br);
- trans.AddNewlyCreatedDBObject(br, true);
- }
- trans.Commit();
- }
|