Page 1 of 1

Scripting CloudCompare - Choose which parts of the cloud to load

Posted: Fri Oct 18, 2019 3:43 pm
by sguinard
Hello CloudCompare community,

I have a few hundreds of point clouds (ASCII ply) that I want to convert to .xyz files.
These clouds contain a lot of informations (points, colors, normals etc), and I want to keep only the points and normals while converting them.

A simple and nice way I found to do it, is, while loading the point cloud on CC, to keep only the points and normals, and then export it as an ASCII .xyz file. However, I'm not going to do that for hundreds of clouds.

So, as I know that CC is scriptable (http://www.cloudcompare.org/doc/wiki/in ... _line_mode), my question is:
How, in command line, can I choose to load only the points and normals, and not the whole cloud?

Thanks in advance!

Re: Scripting CloudCompare - Choose which parts of the cloud to load

Posted: Fri Oct 18, 2019 7:57 pm
by daniel
Hum, that's not possible directly via the command line. Maybe one trick would be to use the 'PN' format as intermediate format (as it only contains points + normals). Save your cloud to PN, reload it from PN, and save it to xyz? (use the -C_EXPORT_FMT option).

Re: Scripting CloudCompare - Choose which parts of the cloud to load

Posted: Mon Oct 21, 2019 8:09 am
by sguinard
Thank you very much for the trick!

However, I have a problem while storing files via command line,
I want to specify the name of the stored file, but when I use the "FILE" option of the "SAVE_CLOUDS" command, I have the following error:
"Command expected (commands start with '-'). Found 'FILE'"

The command I used are:
CloudCompare -O myFile.ply
CloudCompare -C_EXPORT_FMT pn
CloudCompare -SAVE_CLOUDS FILE "/my/path/to/file.pn" <--- error is here

The command seemed ok from the documentation pov, but maybe I misunderstood something,
Do you have any idea why this occurs?

PS: I forgot to precise that I'm working with CC 2.9 beta

Re: Scripting CloudCompare - Choose which parts of the cloud to load

Posted: Mon Oct 21, 2019 8:11 pm
by daniel
Oh, this version is too old indeed. Why not moving to 2.10 or even 2.11.alpha?

Re: Scripting CloudCompare - Choose which parts of the cloud to load

Posted: Mon Oct 28, 2019 10:42 am
by sguinard
Thanks daniel, I upgraded to v2.11.alpha, but now I keep getting "[ERROR] Unhandled format specifier (PN)" errors,
Is it that pn is not supported anymore?

Re: Scripting CloudCompare - Choose which parts of the cloud to load

Posted: Mon Oct 28, 2019 8:57 pm
by daniel
Hum should be... Do you have the "Additional IO" plugin? (Help > About plugins)