I am trying to create a .NET module that allows me to bake objects to specific layers. While the code below works if the layer doesn't exist, it will not set/change the current layer if it already exists. Does anyone know how to solve this?
PS the SetCurrentLayerIndex has no documentation so we're not sure we have correct arguments
If RhUtil.RhinoApp().ActiveDoc().m_layer_table.FindLayer(Layername) = -1 Then
Dim layer As New OnLayer()
layer.SetLayerName(layername)
RhUtil.RhinoApp().ActiveDoc().m_layer_table.SetCurrentLayerIndex(RhUtil.RhinoApp().ActiveDoc().
m_layer_table.AddLayer(Layer))
Else
RhUtil.RhinoApp().ActiveDoc().m_layer_table.SetCurrentLayerIndex(RhUtil.RhinoApp().
ActiveDoc().m_layer_table.FindLayer(Layername))
End If
Tags: