Batch number + adding/removing/replacing suffix/prefix to selected layers

hi all,

Large file organization is one of our biggest challenges at work with Rhino. Like many others here, we use layers as our way to manage files, and then we use tools like Spaceclaim to convert those layers to assemblies at import<>export with other software.

So we need a good way to control layers’ names, and their revisions.

For example, we might have a file that when one person is working on it, looks like this:

But when we need to start socializing it, it needs to look like this:


This is now done by hand, carefully, and tediously, and it also has to be updated by hand.

Back in my old days I used to have some tools for that from Sam Rice, this is from 2009, and I think this might be pre-discourse? back when we used the old newsgroup in outlook stuff? But that broke when sublayers came around. (I wonder how many children reading this are now eye-rolling: “…Ok Boomer” by now)

So, now, we have nothing like that. and I’m surprised since now you are so used in Architecture that layer naming tools is not a thing? Do people do all this work by hand? Or they just don’t do it?

I did find one script by @Helvetosaur that brute force adds prefix to all layers, here: Batch Rename ALL Layers + SubLayers - #6 by Helvetosaur

Then @pascal did modernize one of the old pre-sublayer-era scripts to work in the modern system here, about a decade ago: Please Help: layer prefix script doesn't work for v5 sublayer - #4 by pascal

But still nothing out there to have a complete/editable workflow. For us that workflow would be at a minimum get back to what I had back in my early days of heavy production work:

  • add/replace layer prefix on selected layers (LMB/RMB)
  • add / replace layer suffix on selected layers (LMB/RMB)
  • delete / replace layer character on selected layers (LMB/RMB)

here’s a quick video of how Sam’s old script used to work when we didn’t have nested layers, and how it does not work anymore with nested layers:

and here’s the toolbar with all those 6 scripts:
layer_prefix_suffix_old_sam_rice_gf_230124.rui (125.0 KB)

If these 6 scripts could be updated so they work with sublayers that would be so great! ideally also add one more script that adds autonumbering as prefixes: 01, 02, 03, etc.

Or if there’s any other scripts/plugins our there more capable/modern to do this I’d love to hear about them. Or maybe this is useful to consider for future Rhino Development, but I know that pile is pretty big, and I 'd love to find something useful before my retirement.

Thanks!

Gustavo

PS: Some might be thinking: maybe the better way is to pull all layers out of sublayers, make the changes and then put them back. Unfortunately this add a step that can introduce many errors, especially in more complex files, some even with same sublayer names! …We are trying to automate more steps to reduce errors.

BTW, one Thought for the future. All these tools/scripts that require layer selection, old and new, have an extremely frustrating limitation up to V7:

They cannot act on a preselection of layers from the layer palette itself (what we use everyday, and it’s show in blue). Instead we have to deal with this weird, and confusing abstraction:

I hope this is getting addressed by V8 cycle.

Thanks,

G

Hi Gustavo - nothing like this is planned kin V8 - I am willing to have a go at the scripting side, but you’ll have to pester me repeatedly as my plate is pretty full. Getting highlighted layers should be the easy part.

-Pascal

hi Pascal, Thanks for adding to the Pascal’s Pile!

Full disclosure, I asked ChatGPT for help on this, it kept screw up, over and over…








Eventually they sent me back to you, as the last resource of total human + artificial intelligence:

It even told me how to ask you!

:slight_smile:

G

Oh crap, I guess I’ll need to type.

-Pascal

Dear Mr. Golay,

1 Like