Page 1 of 1

Open and Merge with command line .bat

Posted: Tue Jan 04, 2022 3:51 pm
by adrien72
Hi,

I try to make a .bat file. I want that this file just :
- open cloudcompare
- charge my .xyz files
- and merge these files automatically

I'm beginner in .bat programation, I found https://www.cloudcompare.org/doc/wiki/i ... d_distance
with comand lines, and I try :

""
start C:\Users\adrie\OneDrive\Documents\CloudCompare_v2.6.1_bin_x64\CloudCompare.exe
CloudCompare.exe -O -GLOBAL_SHIFT AUTO C:\Users\adrie\OneDrive\Bureau\PPP\test\leg001_points.xyz
CloudCompare.exe -O -GLOBAL_SHIFT AUTO C:\Users\adrie\OneDrive\Bureau\PPP\test\leg002_points.xyz
CloudCompare.exe -O -GLOBAL_SHIFT AUTO C:\Users\adrie\OneDrive\Bureau\PPP\test\leg003_points.xyz
CloudCompare.exe -O -GLOBAL_SHIFT AUTO C:\Users\adrie\OneDrive\Bureau\PPP\test\leg004_points.xyz
CloudCompare.exe -MERGE_CLOUDS
exit
""
Only the first line work, others don't work.

If you can help me...

Thx

Re: Open and Merge with command line .bat

Posted: Mon Jan 10, 2022 8:53 pm
by daniel
Actually the correct command line would be:

Code: Select all

CloudCompare.exe -O -GLOBAL_SHIFT AUTO C:\Users\adrie\OneDrive\Bureau\PPP\test\leg001_points.xyz
-O -GLOBAL_SHIFT AUTO C:\Users\adrie\OneDrive\Bureau\PPP\test\leg002_points.xyz
-O -GLOBAL_SHIFT AUTO C:\Users\adrie\OneDrive\Bureau\PPP\test\leg003_points.xyz
-O -GLOBAL_SHIFT AUTO C:\Users\adrie\OneDrive\Bureau\PPP\test\leg004_points.xyz
-MERGE_CLOUDS
You shouldn't call CloudCompare.exe each time, but all in one go.

Re: Open and Merge with command line .bat

Posted: Fri Jan 14, 2022 4:09 pm
by O_Hitsuji_san
Hello.

I've been working on the same thing.
You can try this batch file if you like.

In the same directory as the batch file, create input and output directories and run the batch file.
Also, the path to CloudCompare.exe needs to be overwritten with your path.

Code: Select all

@echo off

setlocal enabledelayedexpansion

rem //Set the path to CloudCompare.exe//
set CloudCompare_Path="D:\User\Documents\_Software\_CloudCompare\CloudCompare_v2.12.beta_bin_x64\CloudCompare.exe"

rem //Set the file path//
set current_dir=%~dp0
set input_path=%current_dir%input
set output_path=%current_dir%output

rem //List the files in the input directory//
for %%f in (%input_path%\*.xyz) do (
 set file_list=!file_list! -o %%f
 )

rem //Write out a filelist if necessary.//
rem echo %file_list% > filelist.txt

rem //Processing with CloudCompare//
 %CloudCompare_Path% ^
  -SILENT^
  -AUTO_SAVE OFF^
  %file_list%^
  -MERGE_CLOUDS^
  -NO_TIMESTAMP^
  -SAVE_CLOUDS FILE "%output_path%\Merged"

endlocal

pause

Re: Open and Merge with command line .bat

Posted: Sat Jan 15, 2022 9:07 pm
by DA523
While I using BAT file to perform simple tasks in cc , I found that using AutoHotkey script is very useful to manage some advanced functions in cc.
AutoHotkey can use mouse and keyboard clicks within CC to do almost everything.