Replace Block Record

Replace Block Record

Anonymous
Not applicable
1,371 Views
4 Replies
Message 1 of 5

Replace Block Record

Anonymous
Not applicable

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

0 Likes
Accepted solutions (1)
1,372 Views
4 Replies
Replies (4)
Message 2 of 5

hgasty1001
Advisor
Advisor

Hi,

 

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.

 

Gaston Nunez

0 Likes
Message 3 of 5

chiefbraincloud
Collaborator
Collaborator
Accepted solution

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.

Dave O.                                                                  Sig-Logos32.png
Message 4 of 5

Anonymous
Not applicable

Thank you!

0 Likes
Message 5 of 5

jokiller70
Advocate
Advocate

Any chance of getting the code for this?

0 Likes