More out of interest as i have found a work around where i get the status trigger from the elefont bake layers component but is it possible to write the script below using full paths in Rhino Common / Scriptcontext. so my whole code is written in the same way.
Would also be great to understand turning them off without having to also use rs.layervisable.
I have found the IsVisible in Rhino Common Doc Objects but not how to set it for the layer using the layer ID