Partial progress. I created a PLY file with the same points and colors. I can import it into Rhino with the points displaying their colors.
But if I try to export the same set of points as a PLY file I get a failure message. And if I export them as a .txt file only the x,y,z coordinates are exported.
Attached is an XYZRGB importer I wrote awhile back (Python script). I will try to hack out an exporter for you in a bit. You want the same format (space separated)?
Thanks! Both scripts work for me. One minor improvement if convenient would be to add the option of importing .txt files in addition to .xyz files. But only if convenient. I change the file extension on a .txt file to .xyz and it imported successfully.
Colors of points in a point cloud are lost when the point cloud is exploded.
I can now successfully import and display a point cloud with each point having an individual color using Mitch’s script or as a PLY file.
However if I explode the point cloud so that I can work with individual points the colors are lost and the points take on the color of the layer. Is / Should it be possible to explode the point cloud and retain the colors of the individual points?
Thanks, much appreciated. Unfortunately the revised XYZRGBImport script isn’t working. It opens the file import dialog box but doesn’t see the .txt or .xyz files which are there.
However I found a new glitch. Use ExplodeColorPointCloud to explode a colored point cloud. Then use PointCloud to create a cloud with some of the points. The result of PointCloud is two point clouds, one has points with the original colors, the other has points with the layer color. I checked and PointCloud when used with ordinary points creates only one point cloud. That sounds like a Rhino problem, not a problem with your scripts.
Maybe, maybe not… There was one problem with the original ExplodeColorPointCloud script, it left the original as well. It was late last night and I didn’t repost the correction. So maybe you didn’t realize the original pc was still there and included it with the new one… Attached is the revised version that deletes the original.
@pascal Although Rhino supports color point clouds in both opening and export, there is no direct way to create them without scripting. Also, for example if you have a colored point cloud and you use the “add” option in -PointCloud to add a point, it removes all the colors. (This is because under the hood it is creating a new point cloud, I think) So I hope that V6 will have color options added as command line switches to the PointCloud command. In the meantime, I also “reversed” the Explode script to allow you to directly create a color point cloud without having to export/import.
If you want to import a “point cloud with colors” file, you might consider writing a Leica-style PTS file (which is just a text file).
Rhino can read PTS files natively.
A Leica PTS file has the following criteria:
1.) The file extension is .pts.
2.) The first line of the file contains the number of points in the point cloud.
3.) The rest of the lines contain X Y Z I R G B values separated by spaces. The “I” value is an intensity value, which Rhino does not use. So just set this value to zero.
Thanks for the reply. PhotoScan, the software I’m using to generate the point clouds, does not create PTS format clouds. However it does create PLY format files which I can use to import the point cloud coordinates and colors.
Apologies for reopening an old thread. Still having OPs problem when attempting to import .xyz files with colour values. All points show as one colour. Attempted running this .py importer but it seems to not detect any files to import, so I assume maybe it is incompatible for Rhino 7.
It seems okay opening .pts with colour but most of my working files are .xyz so I’m looking for a way to make this work. Any suggestions?
I have a script that imports .xyz files with color. Can you send me a link so I can see if it works for your case? You could message me the link if you do not want to post it here. If it works and you have a Windows machine, I can give you the script and help you get it working.
Dale, Hi,
Sorry for digging up this old post.
I created a file in the pts format example you provided.
This said, despite deactivating the Point Cloud option when importing, I obtain a Pt Cloud object which once exploded looses it’s pt color.
Am I missing something in the import options or in the file format created ?