Convert point cloud to regular points?

I am trying to convert a point cloud object (imported from a .ply) to just regular Rhino points. Any insight on how to do this?

(The goal is to substitute each point with a simple mesh cube. I have a script to do this, but it doesn’t recognize point cloud objects as “points” and fails.) Thanks.

Hi Stenrik,

I would use Grasshopper and read the point cloud file as x,y,z coordinates, then create points in Rhino with Grasshopper. But if there’re too many points then it might slow things down.

1 Like

I read online that Grasshopper does not support point cloud objects. Is this supposed to be handled by the Volvox plugin? (

I haven’t touched Grasshopper yet so if you have any tips on how to set up reading the coordinates, volvox or no, I would appreciate it. :slightly_smiling_face:

You can explode it if it isn’t too big.

1 Like

Many thanks, that worked!

Interestingly enough, the points appear to be inheriting the color from the cloud as well. I wonder if there’s a way to transfer that color onto the cube I substitute them with so it can be preserved as vertex color via PLY mesh export… sounds like a Grasshopper thing?

I didn’t know the explode can work, learning new things every day.

I was thinking making point cloud file to excel (open the point cloud file in a text editor and copy /paste into excel, then data to column in excel) and read it in GH as x, y, z and recreate them.

In the image:

Top Left: pts file opened in a text editor
Top Right: copy/paste into excel
Bottom Right: GH script reads the excel file
Bottom Left: points created in Rhino

Hi @Stenrik, try if below helps:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def DoSomething():
    cloud_id = rs.GetObject("Pointcloud", rs.filter.pointcloud, True, False)
    if not cloud_id: return
    cloud  = rs.coercegeometry(cloud_id, True)
    points = cloud.GetPoints()
    colors = cloud.GetColors() 
    box_size = 2.0
    interval = Rhino.Geometry.Interval( -box_size * 0.5, box_size * 0.5)
    n_plane  = Rhino.Geometry.Plane.WorldXY
    attr = Rhino.DocObjects.ObjectAttributes()
    attr.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
    attr.ObjectColor = rs.ObjectColor(cloud_id)
    for i, pt in enumerate(points):
        n_plane.Origin = pt
        box = Rhino.Geometry.Box(n_plane, interval, interval, interval)
        if colors: attr.ObjectColor = colors[i]
        scriptcontext.doc.Objects.AddBox(box, attr)




Many, many thanks, Clement! That worked. :grinning: A lot faster, too! Shows off the power of Python.

Now I just need to figure out how to get the results out of Rhino as vertex colors. (Destination software is 3DS Max.) It appears my .PLY export script in Rhino only works with point cloud objects. The only other format I know that holds vertex color is .fbx. I think there’s a step where I need to transfer object color to vertex color, because exporting as a .fbx directly does not appear to bring that information into Max.

Hi @Stenrik, i guess using PLY or OBJ export my work if you assign the vertex colors to the boxes in Rhino. Here is a slightly changed script which creates vertex colored mesh boxes instead: (1.4 KB)

For faster handling in Rhino you can join all boxes into one mesh. The vertex colors will be preserved.


1 Like

Thank you for making the modification! I finally got a chance to try out the new script. It appeared to have worked in Rhino. The box wireframes were black in the viewport, but showed individual color in shaded mode. I merged and exported as FBX in default settings.

However, the FBX, upon import into Max, showed no vertex colors. I tried both binary and ASCII, and even a 3rd party PLY importer.

What did the trick was another Python script, found on this forum. I had to run it to fix the colors before they could be brought out.
Below is the first successful test, rendered from 3DS Max.

I have attached the colorfix script to aid anyone searching to do this in the future. (235 Bytes)
Also, here is a modification of the cube substitution script, making the per-cube vertex count as small as possible. (1.4 KB)

Thanks again for your aid. (I’m trying to do something kind of unorthodox for my project, so every step taken seems like an uphill battle.)

points(txt) also exports colors.

# X,Y,Z,R,G,B
2.8734617 3.5288126 0 0 255 0
-0.65535091 6.3518627 0 0 255 255
8.4187386 5.4444537 0 255 255 0
5.9989814 0.6049393 0 255 0 0
1.3611134 -4.4362215 0 0 0 255
-1.4619366 -1.411525 0 255 0 255
-6.301451 -3.6296358 0 255 63 63
-5.1923957 2.8230501 0 0 127 0