Hi, i’ve written the following script inside a grasshopper “C# Script” component.
But sometimes it gives this error: "The object cannot be modified because it is controlled by a document"
I not understand why this exception is thrown since my script does not modify any property of the layer.
This error does not appear every time and I’m not able to find a way to reproduce it.
The only way to solve is to restart rhino.
I’m using Grasshopper over a rhino worksession with some files attached.
Any ideas?
private void RunScript(ref object A)
{
List<string> layerList = new List<string>();
RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc;
foreach(Layer l in doc.Layers)
{
if(!l.IsDeleted)
{
layerList.Add(l.FullPath);
}
}
A = layerList;
}