Replacing blocks in a model using a command line script

I use both Rhino 8 and Cadence Allegro and Allegro exports a board assembly STEP file as a load of blocks and messes up all the nice neat models created for each component model.

I would like to write a script to replace each embedded block in the assembly model (which comes in unlinked) with a new linked embedded block but I can’t find how to do that from a command line, just from the GUI. Since there could be a large number of models in the assembly I need to automate it if possible.

Any suggestions much appreciated. Thanks.