.NET

Reply
Active Member
6 Posts
0 Kudos
Registered: ‎07-30-2012
Post 1 of 4
Accepted Solution

Replace Block Record

364 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
582 Posts
91 Kudos
Registered: ‎04-11-2010
Post 2 of 4

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*
753 Posts
54 Kudos
Registered: ‎02-13-2008
Post 3 of 4

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
6 Posts
0 Kudos
Registered: ‎07-30-2012
Post 4 of 4

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
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!