Page 1 of 1

[SOLVED] Load commands from file

Posted: Wed Dec 13, 2023 4:44 pm
by HeadLess
Hello Daniel

Here is another issue i'm strugling a little bit and i would go for it and might do something about it, because our process flow would require so much rewrite without it.

So my main issue i've run out of command line arguments.

The easiest way would probably be a list of file to open because that is what taking the majority of the arguments. (Or it might be possible to create an alternative command parser to allow load commands from text file)

I was thinking about to do it inside the -O function, but i don't want any breaking changes, so i think it is probably better to do a new command for that.
For example
-OPEN_LIST_OF_FILE "path_to_a_list.txt"

And i would expect every new line a new cloud. And support the same command arguments as in the normal -O function

Example file:
-O GLOBAL_SHIFT AUTO "file"
-O GLOBAL_SHIFT FIRST "file2"
-O -SKIP 10 GLOBAL_SHIFT 100 100 0 "file"

Do you have something what can cause issues later or ideas for this kind of functionality or know a way to get around command line argument overflow? Because that would be the easiest solution i suppose if it is possible somehow.

What i also came across with the new version las/laz loader in silent mode it creates gui element during load, little bit annoying, but not that much.

Re: Load commands from file

Posted: Wed Dec 13, 2023 8:45 pm
by daniel
That's an interesting idea. Or maybe a more general

Code: Select all

-COMMAND_FILE {file}
that would open a file with all the commands?

And for the LAS I/O plugin, it may be a good idea to create a github 'issue' so that its developer is made aware? (of course if you are able to find a way to fix it on your own, don't hesitate).

Re: Load commands from file

Posted: Thu Dec 14, 2023 4:26 pm
by PablerasBCN
I may be missunderstandig the issue but isn´t that what a .bat can do? like

for %%f in (E:\path\*.las) DO "C:\Program Files\CloudCompare\cloudcompare.exe" -SILENT -O -GLOBAL_SHIFT AUTO %%f -AUTO_SAVE OFF -C_EXPORT_FMT LAS -NO_TIMESTAMP -PCV -180 -N_RAYS 512 -SAVE_CLOUDS

Re: Load commands from file

Posted: Thu Dec 14, 2023 4:40 pm
by HeadLess
PablerasBCN wrote: Thu Dec 14, 2023 4:26 pm I may be missunderstandig the issue but isn´t that what a .bat can do? like

for %%f in (E:\path\*.las) DO "C:\Program Files\CloudCompare\cloudcompare.exe" -SILENT -O -GLOBAL_SHIFT AUTO %%f -AUTO_SAVE OFF -C_EXPORT_FMT LAS -NO_TIMESTAMP -PCV -180 -N_RAYS 512 -SAVE_CLOUDS
yes but what happens if you want to merge 100's/1000's of files, with state coordinates with a given global_shift, you run out of chars to be passed to a single command line :)

you firstly starts to optimize your path with mapped network storage then cutting down chars from files, then after that you can't do a thing about it.

https://github.com/CloudCompare/CloudCompare/pull/1909

last night i've done a quick PR and Daniel merged it today. :) if it will be built with every modul i'll surely transfer everything to file, because that is so much easier to handle in scripts. And i probably don't need to worry about arguments sizes ever again unless i overflow the argument count which is QStringList which i think uses int under the hood, so i'll probably be fine, but after then i can just use multiple commands of command_file.

:)

example

Code: Select all

#!/bin/bash
#iterate over 100-200 files
   LIST2+=('-O' '-GLOBAL_SHIFT' "$cx" "$cy" "0" "$filepath")
#end iterate
..
..
..
"$CC" -SILENT -AUTO_SAVE OFF -NO_TIMESTAMP -C_EXPORT_FMT E57 "${LIST2[@]}" -MERGE_CLOUDS -SS RANDOM $(free |awk '{printf "%i",120000000*14/(128*1024*1024)*$1}') -SS OCTREE "$finalOCTREE" -DROP_GLOBAL_SHIFT -RENAME_ENTITIES "$(echo "$resFileNameSS15" |sed "s|\.[^\.]*$||")" -SAVE_CLOUDS FILE "$resFileNameSS15" -SS RANDOM "$pointCount" -RENAME_ENTITIES "$(echo "$resFileNameRANDOM" |sed "s|\.[^\.]*$||")" -SAVE_CLOUDS FILE "$resFileNameRANDOM"

Re: Load commands from file

Posted: Thu Dec 14, 2023 5:32 pm
by PablerasBCN
wow, awesome.

I did not understand properly that there is even a char limit at first, I'm not handling such mega large scale projects to face theese issues.

It is awesome to see skilled people contribute. I'm more of a lurker due to my skill level. tx!