- 积分
- 166
- 明经币
- 个
- 注册时间
- 2010-9-1
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
大侠们好,请问如何将已有的块加入到当前的图纸中呢,我写了一些代码,是加上来了,但是我的块本来是增强属性块,可以用增强属性编辑器打开,但是插入进来之后就只能用编辑块定义打开了,请大侠们指点,多谢!- ObjectId id = ObjectId.Null;
- using (Database sourceDatabase = GetDatabaseFromFile("d:\\arx\\bplead_title.dwg"))
- {
- id = HostApplicationServices.WorkingDatabase.Insert("BPLEAD_TITLE", sourceDatabase, true);
- }
- Autodesk.AutoCAD.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();
- }
|
|