Running CC from python terminal

Feel free to ask any question here
Post Reply
kalliopikout
Posts: 15
Joined: Fri Jun 21, 2019 12:34 pm

Running CC from python terminal

Post by kalliopikout »

Good afternoon,


I am trying to run c2m distance algorithm using python, with the following command:

C2M=subprocess.Popen(["C:\Program Files\CloudCompare\CloudCompare.exe","-O",input_PC,"-O",input_Mesh,"-c2m_dist","-AUTO_SAVE","OFF","-SAVE_CLOUDS","FILE", "RESULT.LAS"])

My aim is to save the output in a file named RESULT.LAS, but no matter that the process runs correctly and I get back "RESULT.LAS file saved successfully on the CC console that appears, the file is not being created. Only the default file "cloud1_C2M_DIST_YYYY-MM-DD_HHhMM.bin".

Is it something wrong on my command? If I add the full path then I get an error on the CC console.

I would like to ask also if there is a command for running poison surface reconstruction algorithm via your plugin.


Thanks in advance,
Kalliopi
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Running CC from python terminal

Post by daniel »

I think you need to use the 'C_EXPORT_FMT' options to explicitly set 'LAS' as the output format.
Daniel, CloudCompare admin
kalliopikout
Posts: 15
Joined: Fri Jun 21, 2019 12:34 pm

Re: Running CC from python terminal

Post by kalliopikout »

Hi,


Thanks for your reply!

It seems that it doesn't work. And the "AUTO SAVE OFF" option does not make any difference in the output.
All the following options give the same results:

C2M=subprocess.Popen(["C:\Program Files\CloudCompare\CloudCompare.exe","-O",input_PC,"-O",input_Mesh,"-c2m_dist","-AUTO_SAVE","OFF","-C_EXPORT_FMT","LAS","-SAVE_CLOUDS","FILE", "RESULT.LAS","-C_EXPORT_FMT","LAS"])

C2M=subprocess.Popen(["C:\Program Files\CloudCompare\CloudCompare.exe","-O",input_PC,"-O",input_Mesh,"-c2m_dist","-SAVE_CLOUDS","FILE", "RESULT.LAS","-C_EXPORT_FMT","LAS"])

Thanks in advance for any additional help,
Kalliopi
WargodHernandez
Posts: 187
Joined: Tue Mar 05, 2019 3:59 pm

Re: Running CC from python terminal

Post by WargodHernandez »

The order of the commands matters, you are specifying to turn off auto save after the auto save has already occurred. You are also specifying The output format after the save file
kalliopikout
Posts: 15
Joined: Fri Jun 21, 2019 12:34 pm

Re: Running CC from python terminal

Post by kalliopikout »

Hi,



Thanks for your info.
I am running it as following, and everything works fine except for giving to the new file the name I want ''RESULTS''. I have placed this command in different positions but never works:

C2M=subprocess.Popen(["C:\Program Files\CloudCompare\CloudCompare.exe","-O",input_PC,"-O",input_Mesh,"-C_EXPORT_FMT","LAS","-AUTO_SAVE","OFF","-c2m_dist","-SAVE_CLOUDS" ,"FILE","RESULTS"],universal_newlines=True,stdout=subprocess.PIPE)

Thanks,
Kalliopi
WargodHernandez
Posts: 187
Joined: Tue Mar 05, 2019 3:59 pm

Re: Running CC from python terminal

Post by WargodHernandez »

Do you have a log of Cloudcompare output when you run the command you posted?
kalliopikout
Posts: 15
Joined: Fri Jun 21, 2019 12:34 pm

Re: Running CC from python terminal

Post by kalliopikout »

Yes. Here it is what the CC command line shows me:

command line.png
command line.png (18.11 KiB) Viewed 11793 times

And the RESULT.las file is nowhere..
WargodHernandez
Posts: 187
Joined: Tue Mar 05, 2019 3:59 pm

Re: Running CC from python terminal

Post by WargodHernandez »

What is the result if you specify the full path for RESULT?
md2030
Posts: 1
Joined: Wed May 13, 2020 12:14 am

Re: Running CC from python terminal

Post by md2030 »

was this solved? I'm trying to subsampling several point clouds from different meshes, then merge them and save them at once. however, once I turn off the autosave, nothing will be saved afterward. Please help!
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Running CC from python terminal

Post by daniel »

You have to use the 'SAVE_CLOUDS' option explicitly (probably at the end of the command line)
Daniel, CloudCompare admin
Post Reply