.NET

Reply
Active Member
EfremenkoDO
Posts: 6
Registered: ‎07-30-2012
Message 1 of 4 (352 Views)
Accepted Solution

Replace Block Record

352 Views, 3 Replies
08-06-2012 06:50 AM

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

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.

Distinguished Mentor
gasty1001
Posts: 533
Registered: ‎04-11-2010
Message 2 of 4 (339 Views)

Re: Replace Block Record

08-06-2012 10:26 AM in reply to: EfremenkoDO

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

*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 3 of 4 (328 Views)

Re: Replace Block Record

08-06-2012 12:28 PM in reply to: EfremenkoDO

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
Active Member
EfremenkoDO
Posts: 6
Registered: ‎07-30-2012
Message 4 of 4 (298 Views)

Re: Replace Block Record

08-06-2012 11:03 PM in reply to: chiefbraincloud

Thank you!

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.