Unlock all layers before cleaning it and bake result

Hi

I’am baking a lot of stuff in many different files and in many different layers.
and I always get the same problem :

The tool I use to clean the layer in which I bake my result do not unlock the layer…
So it happens many times that when one of my teammate have lock a layer for some reason, grasshopper do bake the new result but also keep the old one…
any idea how to always unlock all the layers ?

here is the “Human” plug in tool I use to clean the layers :

Here I wrote a simple script to unlock all layers:

foreach(Rhino.DocObjects.Layer layer in RhinoDoc.ActiveDoc.Layers)
    layer.IsLocked = false;

antho2b.gh (12.7 KB)

1 Like

it seems to work great ! thanks !
the best would have to add a false/true output when unlock is done to be able to chain it with the same button that affect my delete layer box… :slight_smile: :slight_smile: but I’am maybe asling too much…

thank you very much Mahdiyar !

A = false;
if(run)
{
  foreach(Rhino.DocObjects.Layer layer in RhinoDoc.ActiveDoc.Layers)
    layer.IsLocked = false;
  A = true;
}

antho2b.gh (13.0 KB)