Point clouds as Grasshopper contextual inputs

Hi,

There is no direct method to select or even reference PointCloud geometry directly into Grasshopper.
You can check out Cockroach Plugin which has a component to select a pointcloud like how you would reference any other geometry.

If you would like to dig a bit deeper, here is a pythonic version of importing point cloud from Rhino into GH.

image

""" Imports all pointclouds in the current Rhino Document.

    Input:
        select <bool> : ItemAccess
    Output:
        clouds <list[Rhino.Geometry.PointCloud]>
"""
__author__ = 'Kaushik LS'

import Rhino

clouds = []
if select:
    for obj in Rhino.RhinoDoc.ActiveDoc.Objects:
        if isinstance(obj, Rhino.DocObjects.PointCloudObject):
            clouds.append(obj.Geometry)

If you’re looking to select a specific point cloud, use this then

""" Implementation of Get PointCloud(s). Imports selected PointCloud.
    
    Input:
        select <bool> : ItemAccess
    Output:
        clouds <list[Rhino.Geometry.PointCloud]>
"""
__author__ = 'Kaushik LS'

import Rhino

clouds = []
if select:
    result, ref_obj = Rhino.Input.RhinoGet.GetMultipleObjects('Select PointCloud(s)', False, Rhino.DocObjects.ObjectType.PointSet)
    if isinstance(result, Rhino.Commands.Result.Success):
        clouds = [obj.Geometry() for obj in ref_obj]

Edit:

Check attached file to use it in Grasshopper Player.
FIle: select_pointclouds.gh (3.9 KB)

image


HTH

~ ~ ~ ~ ~ ~ ~ ~
Kaushik LS
Chennai, IN

2 Likes