Returns or modifies a material's user-definable name.
rhinoscriptsyntax.MaterialName (material_index, name=None)
rhinoscript.material.MaterialName (material_index, name=None)
material_index |
Required. Number. The zero-based source material index. |
name |
Optional. String. The new name. If omitted, the current name is returned. |
String |
If name is not specified, the current material name if successful. |
String |
If name is specified, the previous material name if successful. |
None |
It not successful, or on error. |
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select object")
if obj:
index = rs.ObjectMaterialIndex(obj)
if index>-1:
rs.MaterialName( index, "Fancy_Material" )