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.
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.
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
Many, many thanks, Clement! That worked. 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:
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. Rhino_MeshColorFix.py (235 Bytes)
Also, here is a modification of the cube substitution script, making the per-cube vertex count as small as possible. PointCloudToColorMeshBoxes-NoSegs.py (1.4 KB)