Returns or modifies a material's diffuse color. Material colors are represented as RGB colors. An RGB color specifies the relative intensity of red, green, and blue to cause a specific color to be displayed.
rhinoscriptsyntax.MaterialColor (material_index, color=None)
rhinoscript.material.MaterialColor (material_index, color=None)
material_index |
Required. Number. The zero-based source material index. |
color |
Optional. Number. The new color value. If omitted, the current material color is returned. |
Number |
If color is not specified, the current material color if successful. |
Number |
If color is specified, the previous material color 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.MaterialColor( index, (127, 255, 191) )