Hi all! I look for answers on my question 'How I can replace or redefine block record?'.
I tried the following:
1. Get all the block references
2. Clone it
3. Save to new DateBase
4. Erase old Block REferences and Block Record
5. Copy block references from new DataBase
But it doesn't work. Do you have any ideas?
P.S. If you wаnt, then I can write some code
Solved! Go to Solution.
What do You mean with "But it doesn't work"?, you have a workflow with 5 steps, in which one the program fails?, and yes, please post the relevant code.
You're doing a lot of unneccessary work there, with the copying back and forth to a new database. I have a working routine that goes like this.
1. Open the old BlockTableRecord
2. Get the BlockReferenceIds from the BTR
3. Rename the old BTR (I assume you want the new block to have the same name, or this isn't neccessary)
4. Create the new BlockTableRecord.
5. Loop through the BlockReferenceIds and point the BlockTableRecord property to the new ID, and check for attribute aditions or removals.