PointCloudPointColors

Returns or modifies the point colors of a point cloud object.

Syntax

Rhino.PointCloudPointColors (strObject [, arrPointColors])

Rhino.PointCloudPointColors (strObject [, Null])

Parameters

strObject

Required.  String.  The object's identifier.

arrPointColors

Optional.  Array.  An array of RGB color values. Note, for every point, there must be a corresponding point color.

Null

Optional.  Null.  Specifying Null will remove, or purge, any existing point colors from the point cloud.

Returns

Array

If arrPointColors is not specified,  the current point colors if successful.

Array

If arrPointColors is specified, the previous point colors if successful.

Null

If strObject does not have point colors, if not successful, or on error.

Example

Sub Test

  Const rhPointCloud = 2  

  Dim strObject, arrColors(), i

  strObject = Rhino.GetObject("Select point cloud", rhPointCloud)

  If VarType(strObject) = vbString Then

    ReDim arrColors( Rhino.PointCloudCount(strObject)-1 )

    For i = 0 To UBound(arrColors)

      arrColors(i) = RandomColor

    Next

    Rhino.PointCloudPointColors 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

Also See

PointCloudHasHiddenPoints

PointCloudHasPointColors

PointCloudHidePoints