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.
rhinoscriptsyntax.AddMaterialToLayer (layer)
rhinoscript.material.AddMaterialToLayer (layer)
layer |
Required. String. The name of an existing layer. |
Number |
The zero-based material index of the layer if successful. |
None |
If not successful, or on error. |
import rhinoscriptsyntax as rs
layer = rs.CurrentLayer()
index = rs.LayerMaterialIndex(layer)
if index==-1: index = rs.AddMaterialToLayer(layer)