Adds a material to a layer and returns the new material's index. If the layer already has a material, then the layer's current material index is returned.
Rhino.AddMaterialToLayer (strLayer)
strObject |
Required. String. The name or identifier of an existing layer. |
Number |
The zero-based material index of the layer if successful. |
Null |
If not successful, or on error. |
Dim strLayer, intIndex
strLayer = Rhino.CurrentLayer
intIndex = Rhino.LayerMaterialIndex(strLayer)
If (intIndex = -1) Then
intIndex = Rhino.AddMaterialToLayer(strLayer)
End If