Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to create a block version of a block in my drawing so that I can edit it.
I thought I could do this with anonymous blocks and I learned that I could make a block anonymous by the method shown below.
The unexpected result of doing this was that it change all blocks in the drawing to anonymous too. I did not want that, I want a version of the original block that I can edit independently without redefining the original.
What's the correct way to create a version of an existing block.
Here is how I created the Anonymous block.
using (BlockReference blockRef = new BlockReference(original.Position, blockDef.ObjectId)) { //SET THE LAYER blockRef.Layer = original.Layer; BlockTableRecord blkTblRcd = trans.GetObject(blockRef.AnonymousBlockTableRecord, OpenMode.ForWrite) as BlockTableRecord; blkTblRcd.Name = "*U"; //Add the block reference to modelspace TypedValue tv = new TypedValue((int)DxfCode.ExtendedDataAsciiString); blockRef.XData = new ResultBuffer { new TypedValue((int)DxfCode.ExtendedDataRegAppName, TestAppName), //1001 new TypedValue((int)DxfCode.ExtendedDataAsciiString, "Test") }; modelSpaceBtr.AppendEntity(blockRef); trans.AddNewlyCreatedDBObject(blockRef, true);
Solved! Go to Solution.