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

rhinoscriptsyntax.AddMaterialToLayer (layer)

rhinoscript.material.AddMaterialToLayer (layer)

Parameters

layer

Required.  String.  The name of an existing layer.

Returns

Number

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

None

If not successful, or on error.

Example

import rhinoscriptsyntax as rs

layer = rs.CurrentLayer()

index = rs.LayerMaterialIndex(layer)

if index==-1: index = rs.AddMaterialToLayer(layer)

Also See

LayerMaterialIndex

IsMaterialDefault