Open and Merge with command line .bat

Any question about the main GUI application (frontend)
Post Reply
adrien72
Posts: 1
Joined: Tue Jan 04, 2022 3:39 pm

Open and Merge with command line .bat

Post 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
daniel
Site Admin
Posts: 7381
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Open and Merge with command line .bat

Post 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.
Daniel, CloudCompare admin
O_Hitsuji_san
Posts: 1
Joined: Fri Jan 14, 2022 3:55 pm

Re: Open and Merge with command line .bat

Post 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
DA523
Posts: 147
Joined: Mon May 25, 2020 4:02 pm

Re: Open and Merge with command line .bat

Post 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.
Post Reply