Point Colors: Import, Display & Export - How?

I have “x y z r g b” .txt files of points with the “x y z r g b” values separated by spaces. The x y z values import with no problems.

How do I display the color of each point?

How do I keep the color associated with the point?

How do I export a “x y z r g b” file which includes the colors of the points after manipulating the points?

Example file:

SandersonPtTest.txt(377.0 KB)

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)?

Cheers, --Mitch

XYZRGBImport.py(973 Bytes)

You can try this exporter on for size and see if it does what you want…


XYZRGBExport.py(1.6 KB)

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?

OK, new version of importer with .txt files as a possibility (I set that as default for you):

XYZRGBImport.py(1.1 KB)

It should, I think, but doesn’t look like it’s hooked up… pretty sure that too can be scripted until it gets implemented…


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.

Weird, same thing here - it should work, but it’s not… hang on… does the attached work any better?

XYZRGBImport.py(1016 Bytes)


Here is a script to explode a colored point cloud and retain the colors. If a non-colored point cloud is found, it will be exploded into points.


ExplodeColorPointCloud.py(729 Bytes)

Mitch, both revised scripts work as advertised.

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.


ExplodeColorPointCloud.py(881 Bytes)

CreateColorPointCloud.py(696 Bytes)

1 Like

Mitch, it appears that you were correct about the origins of the second point cloud.

My sincere thanks for providing the scripts.

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.

For example.

0 0 0 0 57 207 52
0.8165 0 0.577000000000001 0 81 146 224
1.069 0.7765 1.155 0 56 182 56
1.12 1.591 1.732 0 21 91 40
0.9671 2.393 2.31 0 25 85 253
0.6194 3.132 2.887 0 11 246 188
0.09898 3.761 3.464 0 191 72 199
-0.5616 4.241 4.042 0 25 1 223
-1.321 4.542 4.619 0 73 243 83
-2.131 4.644 5.196 0 22 117 36

Hope this helps.

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 ?

Here is my pts file created.
ptCloud_fauteuil-arne-jacobsen_5.pts (660.5 KB)