Batch block relinking

Hello,

would there be a way to batch relink blocks?

I have 34 3DMs linked as reference blocks. I like to copy paste their folder and then edit them individually for newer versions.

It would then be super useful to tell the block manager just the new path, and have it auto-relink wherever it finds the same 3DM filename. Right now I’m having to do this manually, and since the files are all network based, the block manager is very slow.

Thanks for any ideas.

Elefront has a import link blocks component. Be wary putting the file path in, the default block name is *.

image

Hello - it may be possible to script this, I’ll take a look later in the day - the idea is that all the linked files are moved en masse to the same new folder, correct?

-Pascal

Yes exactly.

I would suggest a “Relink” button in the BlockManager, that can take more than one block as input. It then asks for a folder, and only relinks blocks where the filenames match.

Hi Duncan - see if this helps for now - it seems to work as long as there are no name conflicts - but as always, test first…

BatchRelink.py (1.2 KB)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

-Pascal

Wow Pascal, it was pretty magical to see my big field of different linked blocks update definition by definition. This just saved me a lot of time. Thank you so much. I would very much like to plea for this to have a place in future versions of the block manager.

It goes in line with commands like ImportAnnotationStyles or importing Named Views, where here you are similarly importing blocks from, not a file, although this would also be interesting, but a folder. In this case the step where it would ask you which definition of the same name you want to use is already set to the given source.

Not sure how relevant you think this functionality would be, but for larger projects in offices like ours, with lots of linked blocks following a strict naming syntax, and which are being worked on by different people in a team, I feel this would be tremendously useful.

Thank you, Pascal! I’m late to the thread but this was a tremendous time saver for large file management (dozens of linked blocks) with folder structures in flux as the project developed.

Do you know if this is something that McNeel is working on addressing in subsequent releases of Rhino? linking blocks in our architectural practice is part of our standard workflow and we require batch functionality on a regular basis. We do use Elefront but we haven’t been able to get it to reproduce what your script was able to accomplish.

Thanks again for the great solution.

Cheers!

Hello - do you mean,

will it be part of Rhino as a native feature? There are no plans that I know of for this - but assuming there might be, is the functionality in the script what you would expect? If not, what should be different?

-Pascal

Yes, the script functions as desired. We generally keep block names consistent so being able to simply redefine the folder for multiple blocks is great for our workflow.

Thank you!