Cancel
Showing results for 
Search instead for 
Did you mean: 

[Draft] Replace block on hundreds of drawings

A customer wants me to modify a block in hundreds of drawings already finished.

May be the best  option is to replace the old block "A" with the new block "B". Is there a code to obtain this via a macro?

I found similar discussions in the archive, but no solution (I cannot use the macro by Klaus Dalenburg to replace the whole template).

 

Thanks for help.

2 REPLIES 2

Re: [Draft] Replace block on hundreds of drawings

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi,

 

the Blocks collection of a DraftDocument offers the method ReplaceBlock(...). The API help is not very helpful, it seems you can give as argument a Block object from another DraftDocument and the replacement will happen on the block's Name property. But not sure, I didn't try it on myself so far.

Kind regards,
Wolfgang Kunert - www.wksyspro.de
Highlighted

Re: [Draft] Replace block on hundreds of drawings

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

Agree with @wku 

 

As @Ale_Marchetti  has expected, there should be ideally just two arguments Block A - block to replace, Block B - block to replace with, but the function call apparently looks like this:

 

ReplaceBlockAPI.png

 

Perhaps, the implied meaning is replacing a block in the current document with a block from another document with a similar name, so the next question is where's the document name argument?

 

I don't even want to give it a try, it looks so ugly and unfriendly, no sample or meaningful description.