Find and replace text in the layer pane

One of our users made this request this morning. We sometimes have quite extensive layer lists in our projects, and he asked me how he can find and replace text (layer names) in the list. I don’t believe there is currently a way to do this, so I will submit this as a suggestion for V6.

Thanks,

Dan

This is most easily done using scripting I believe.

This example is in RhinoCommon / C#, but should translate fairly easily to e.g. Python.

foreach (Layer l in doc.Layers)
{
    l.Name = l.Name.Replace("Layer", "Laag");
    l.CommitChanges();
}

I agree, it should be easy to script. I was just mentioning this as a possible feature for V6 as I would guess 95% of Rhino users don’t write scripts.

It might be handy to have in the core program.

Thanks,

Dan

By my calculations it’s closer to 99.8735 % :smiley:
–Mitch

I originally wrote 99% but I wanted to give people the benefit of the doubt. :wink:

You’re kinder than I am… :smiling_imp:

This script is actually turning out a bit trickier than I thought if you use sub-layers. Without sub-layers it’s easy. But to maintain the parent/child relationship it’s going to take more effort to maintain that structure if replacing the name of the parent or the child (or both). I’m open to suggestions if anyone has ever tackled this before.

Thanks,

Dan

Some time ago I wrote an extensive script to do exactly that: batch rename layers. See the attached

thanks, Tobias

LayerRenameTools.rhp (56 KB)