Merge file list in batch

Feel free to ask any question here
Post Reply
skarab
Posts: 12
Joined: Wed Mar 22, 2017 9:42 am

Merge file list in batch

Post by skarab »

Hello,

It's the my first try in batch on CC and I'm asking if it's possible to merge some files wich path is store in a .txt file.

I try the command

Code: Select all

for /f "delims=" %%i in (Files_list.txt) do cloudcompare.exe -o %%i -merge_clouds
But it seem that it doesn't work. Files are well opened but not merged.

Do you have an idea ?
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Merge file list in batch

Post by daniel »

Indeed, this is clearly not supported by the command line mode. You would need to be able to expand the list of filenames as a string first and then insert it in the command line (I just don't know if it's possible ;).

You need something that generates the command like this:
CloudCompare -o file1 -o file2 -o file3 -merge_clouds
Daniel, CloudCompare admin
DimitriDimitri
Posts: 1
Joined: Fri Sep 22, 2017 9:58 am

Re: Merge file list in batch

Post by DimitriDimitri »

Hi,

Using the below command line:

CloudCompare -C_EXPORT_FMT PCD -O C:\Users\user\Desktop\ToMerge\frame_0002.pts -O C:\Users\user\Desktop\ToMerge\frame_0079.pts -MERGE_CLOUDS

Both files open correctly, but they do not merge.

Am I doing anything wrong?

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

Re: Merge file list in batch

Post by daniel »

Do you have a screen capture of the console output? The merge cloud should be automatically saved by default.
Daniel, CloudCompare admin
skarab
Posts: 12
Joined: Wed Mar 22, 2017 9:42 am

Re: Merge file list in batch

Post by skarab »

daniel wrote:You need something that generates the command like this:
CloudCompare -o file1 -o file2 -o file3 -merge_clouds
You're right. I finally found with something like that. I set the -o file1 -o file2 -o file3 in a variable and i call him into the command. It work fine and it avoid me to overload my memory
framed
Posts: 13
Joined: Wed Feb 25, 2015 1:23 am

Re: Merge file list in batch

Post by framed »

Hi skarab, can you please share how you set the file name list as a variable for use in the CloudCompare command?
skarab
Posts: 12
Joined: Wed Mar 22, 2017 9:42 am

Re: Merge file list in batch

Post by skarab »

It's probably not the cleanest way but I create a .txt file with a dir and then i did this :

Code: Select all

for /f "delims=" %%i in (%fdir%\Files_list.txt) do call :concat %%i
cloudcompare.exe %file_list% -merge_clouds -SS spatial 0.005
del %fdir%\Files_list.txt
goto :eof

:concat
set file_list=%file_list% -o %1
rem echo %file_list%
swiss_knight
Posts: 28
Joined: Sun Aug 30, 2015 12:11 pm

Re: Merge file list in batch

Post by swiss_knight »

In *Nix systems, one can first append files names in a variable, let call it 'files':

Code: Select all

$ for f in folder_name/*.ply; do files+="-O ${f} "; done
Then pass this variable to CloudCompare:

Code: Select all

$ CloudCompare -SILENT -NO_TIMESTAMP -C_EXPORT_FMT PLY ${files} -MERGE_CLOUDS

That's it.
Post Reply