Returns or modifies the vertex colors of a mesh object.
Rhino.MeshVertexColors (strObject [, arrVertexColors])
Rhino.MeshVertexColors (strObject [, Null])
strObject |
Required. String. The object's identifier. |
arrVertexColors |
Optional. Array. An array of RGB color values. Note, for every vertex, there must be a corresponding vertex color. |
Null |
Optional. Null. Specifying Null will remove, or purge, any existing vertex colors from the mesh. |
Array |
If arrVertexColors is not specified, the current vertex colors if successful. |
Array |
If arrVertexColors is specified, the previous vertex colors if successful. |
Null |
If strObject does not have vertex colors, if not successful, or on error. |
Sub Test
Const rhObjectMesh = 32
Dim strObject, arrColors(), i
strObject = Rhino.GetObject("Select mesh", rhObjectMesh)
If VarType(strObject) = vbString Then
ReDim arrColors( Rhino.MeshVertexCount(strObject)-1 )
For i = 0 To UBound(arrColors)
arrColors(i) = RandomColor
Next
Rhino.MeshVertexColors strObject, arrColors
End If
End Sub
Function RandomColor()
Dim intRed, intGreen, intBlue
Randomize
intRed = Int(255 * Rnd)
intGreen = Int(255 * Rnd)
intBlue = Int(255 * Rnd)
RandomColor = RGB(intRed, intGreen, intBlue)
End Function