I seem to be running into a bit of snag with adding layers to a model. I am using the .NET library provided on NuGet
Problem: Whenever I try to add a layer to a model, my model’s Layer Table shows a SystemException that "index was outside the bounds of the array"
This is the code I am using…
File3dm m_model = new File3dm(); Rhino.DocObjects.Layer m_defaultlayer = new Rhino.DocObjects.Layer(); m_defaultlayer.Name = "Default"; m_defaultlayer.LayerIndex = 0; m_defaultlayer.IsVisible = true; m_defaultlayer.IsLocked = false; m_defaultlayer.Color = System.Drawing.Color.FromArgb(0, 0, 0); m_model.Layers.Add(m_defaultlayer);
I’ve tried different values for “LayerIndex” as well as not specifying one… the results are the same. Any help would be greatly appreciated.