AddMaterialToLayer

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.

Syntax

Rhino.AddMaterialToLayer (strLayer)

Parameters

strObject

Required.  String.  The name or identifier of an existing layer.

Returns

Number

The zero-based material index of the layer if successful.

Null

If not successful, or on error.

Example

Dim strLayer, intIndex

strLayer = Rhino.CurrentLayer

intIndex = Rhino.LayerMaterialIndex(strLayer)

If (intIndex = -1) Then

intIndex = Rhino.AddMaterialToLayer(strLayer)

End If

Also See

LayerMaterialIndex

IsMaterialDefault