Returns or changes the color of a layer. Layer 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.
Rhino.LayerColor (strLayer [, lngColor])
strLayer |
Required. String. The name or identifier of an existing layer. |
lngColor |
Optional. Number. The new color value. If omitted, the current layer color is returned. |
Number |
If a color value is not specified, the current color value if successful. |
Number |
If a color value is specified, the previous color value if successful. |
Null |
If not successful, or on error. |
Sub RandomLayerColor()
Dim arrLayers, strLayer
arrLayers = Rhino.LayerNames
If IsArray(arrLayers) Then
Rhino.EnableRedraw False
Randomize
For Each strLayer In arrLayers
Rhino.LayerColor strLayer, RGB(Int(256*Rnd), Int(256*Rnd), Int(256*Rnd))
Next
Rhino.EnableRedraw True
End If
End Sub