PointCloudPointColors

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

Syntax

rhinoscriptsyntax.PointCloudPointColors (object_id, colors=[])

rhinoscript.geometry.PointCloudPointColors (object_id, colors=[])

Parameters

object_id

Required.  String or Guid.  The object's identifier.

colors

Optional.  List.  A list of RGB color values. Note, for every point, there must be a corresponding point color.

If the list is an empty list, the parameter is ignored and no modifications are made to the point cloud.

If the parameter is None, any existing color information in the point cloud will be removed

Returns

List

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

List

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

None

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

Example

import rhinoscriptsyntax as rs

import random

 

def RandomColor():

    red = random.randint(0,255)

    green = random.randint(0,255)

    blue = random.randint(0,255)

    return rs.coercecolor((red,green,blue))

 

obj = rs.GetObject("Select point cloud", rs.filter.pointcloud)

if obj:

    colors = [RandomColor() for i in range(rs.PointCloudCount(obj))]

    rs.PointCloudColors(obj, colors)

Also See

PointCloudHasHiddenPoints

PointCloudHasPointColors

PointCloudHidePoints