Batch Block Replace with Spreadsheet

Batch Block Replace with Spreadsheet

Anonymous
Not applicable
2,165 Views
3 Replies
Message 1 of 4

Batch Block Replace with Spreadsheet

Anonymous
Not applicable

Long story short...is there a way to replace all of the blocks in a drawing at one time. I have a list of the blocks in the drawing and a list of replacement blocks.

 

From example, would it be possible to create a spreadsheet, in one column have all the names of the blocks that need to be replaced, and in the second column have the replacement block name, run a program or lisp routine, and have all of them replaced at one time.

 

Basically block replace on steroids. Any help would be greatly appreciated.

0 Likes
Accepted solutions (1)
2,166 Views
3 Replies
Replies (3)
Message 2 of 4

TheCADnoob
Mentor
Mentor

This sounds totally doable, but its outside of my capabilities. 

 

You may get a better response in the customization forum :https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130

CADnoob

EESignature

0 Likes
Message 3 of 4

leeminardi
Mentor
Mentor
Accepted solution

In column A of your Excel worksheet place the name of the original block and in column B place the name of the block that will replace it.

 

In  column C of the first row of blocks you have listed write this expression:

 

=CONCATENATE("blockreplace "," ", A2," ",B2," n")

( I have assumed that the first row is row 2)

 

Be sure to have a space after blockreplace, between the " ", and before the n). 

 

Next, fill down the expression from cell C2.

 

blockreplace.JPG

 

Open Notepad and then copy and paste the contents of column C into Notepad. 

 

Use Save As and save the Notepad file as a Text Document but give it the file extension of .scr (not .txt).  For example, MyBlockReplace.scr.

 

 

Back in AutoCAD give the script command and reference your .scr file.

 

 

 

~Lee

lee.minardi
Message 4 of 4

TheCADnoob
Mentor
Mentor

Nice!


@lminardigmail wrote:

In column A of your Excel worksheet place the name of the original block and in column B place the name of the block that will replace it.

 

In  column C of the first row of blocks you have listed write this expression:

 

=CONCATENATE("blockreplace "," ", A2," ",B2," n")

( I have assumed that the first row is row 2)

 

Be sure to have a space after blockreplace, between the " ", and before the n). 

 

Next, fill down the expression from cell C2.

 

blockreplace.JPG

 

Open Notepad and then copy and paste the contents of column C into Notepad. 

 

Use Save As and save the Notepad file as a Text Document but give it the file extension of .scr (not .txt).  For example, MyBlockReplace.scr.

 

 

Back in AutoCAD give the script command and reference your .scr file.

 

 

 

~Lee


 

CADnoob

EESignature

0 Likes