block replace with undefined block

block replace with undefined block

Anonymous
Not applicable
1,845 Views
5 Replies
Message 1 of 6

block replace with undefined block

Anonymous
Not applicable

Is there an efficient way to replace an existing block with a new block that is not defined in the drawing in one command?

 

I am trying to script a title replacement across a big set of drawings.  The current drawing contains "title-old" and I'd like to replace it with "title-new" that is not yet inserted/defined in the drawing.  The names of the blocks are different, I can't change that.  I can do this with a few steps, but it's messy (insert first in some place to the side, then replace, then delete the bogus insert).

 

I would like to simply say "insert path\title-new in place of title-old" somehow.

 

I'm using -INSERT and -BLOCKREPLACE.  Maybe there is a better way?

 

Thanks! 

0 Likes
Accepted solutions (3)
1,846 Views
5 Replies
Replies (5)
Message 2 of 6

john.vellek
Alumni
Alumni
Accepted solution

Hi sdmcfarland,

 

The block substituion is the correct way to go:

 

-INSERT oldblock=newblock

 

Be aware though that if any attributes exist in the block and have already had values input then you will have to run Attsync or battman to get them to update.

 

You could explore running a script to so all of this or use the Action Recorder to make a macro.

 

Please hit the Accept as Solution button if my post fully solves your issue or answers your question.

 

 


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
Message 3 of 6

Anonymous
Not applicable

Thanks John.  I'm sorry I didn't clarify, my problem with this method is that it retains the "oldblock" name, just updating the content of the block.  My requirement is to replace oldblock with newblock, and I need the new block to have its newblock name.

 

 

 

 

0 Likes
Message 4 of 6

pendean
Community Legend
Community Legend
Go ask in the LISP forum for help writing some code to do what you want if you can't find free lisp routines with Google Search (I see about a dozen at the moment with a simple search) http://forums.autodesk.com/t5/autocad-customization/ct-p/AutoCADTopic1
0 Likes
Message 5 of 6

elshawadfy
Collaborator
Collaborator
Accepted solution

@Anonymous wrote:

Thanks John.  I'm sorry I didn't clarify, my problem with this method is that it retains the "oldblock" name, just updating the content of the block.  My requirement is to replace oldblock with newblock, and I need the new block to have its newblock name. 

 


You can add these 2 lines after the insert..

-rename b <old block>

<new block>

0 Likes
Message 6 of 6

elshawadfy
Collaborator
Collaborator
Accepted solution

You may also insert an instance of the block then delete it (just so that autocad fnds it and include it's definition)

then use -blockreplace and purge the unused block when asked..