Hi.
I'm working with autocad 2015. I want to replace one obejct with other one.
Using guidence of overruling on through-the-interface, I can overrule WorldDraw. Inside, I'm replacing block - replace one block by another.
Problem is, that replaced object can not be selected and file can't be saved (AutoCAD Message (error): "One or more objects in this drawing cannot be saved to the specified format. The operation was not completed and no file was created."). Everything start working after "AUDIT" command - it fixes all problems.
code :
public override bool WorldDraw(Drawable drawable, WorldDraw wd) { BlockReference br = drawable as BlockReference; . . . // using (Database db = HostApplicationServices.WorkingDatabase) { using (Transaction tr = db.TransactionManager.StartTransaction()) { BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable; var brIOd = bt["sampleObjectName"]; BlockReference br4 = new BlockReference(new Point3d(0,0,0), brIOd); var btr2 = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); br4.TransformBy(br.BlockTransform); tr.Commit(); return base.WorldDraw(br4, wd); return true; } } } return true; }
Everything is placed correctly, except fact that drawing is some kind of damaged.
Anyone knew something about such problem?