Code: Select all
@echo off
setlocal
rem Specify the paths to the CloudCompare executable and the input directory
set CLOUD_COMPARE_PATH="C:\Program Files\CloudCompare\CloudCompare.exe"
set INPUT_DIR="D:\test_input"
set OUTPUT_DIR="D:\test_output"
rem Specify the number of blocks
set BLOCK_COUNT=9
rem Create the output directory
mkdir %OUTPUT_DIR%
rem Specify Sub Sampling Density
set SubSamplingDensity = 0.1 rem in meters
rem Process each .las file in the input directory
for %%F in ("%INPUT_DIR%\*.las") do (
echo Processing file: %%~nxF
rem Get the file name without extension
set FILENAME=%%~nF
rem Subsample the current file for each block
for /L %%i in (1,1,%BLOCK_COUNT%) do (
echo Subsampling Block %%i
%CLOUD_COMPARE_PATH% -O "%%F" -C_EXPORT_FMT LAS -SS SPATIAL %SubSamplingDensity% -SAVE_CLOUDS %OUTPUT_DIR%\block_%%~nF_%%i.las -C_ALL_ATTRIBS
rem Merge the current block with previous blocks
if %%i gtr 1 (
echo Merging Block %%i with previous blocks
%CLOUD_COMPARE_PATH% -O @%OUTPUT_DIR%\block_files_%%i.txt -C_EXPORT_FMT LAS -SAVE_CLOUDS %OUTPUT_DIR%\merged_blocks_%%i.las -C_ALL_ATTRIBS
) else (
rem Create the block files list for the first block
echo %%F > %OUTPUT_DIR%\block_files_%%i.txt
)
rem Append the current file name to the block files list
echo %%F >> %OUTPUT_DIR%\block_files_%%i.txt
)
)
rem Merge all the block files into one large file
echo Merging all blocks into one file
%CLOUD_COMPARE_PATH% -O %OUTPUT_DIR%\merged_blocks_*.las -C_EXPORT_FMT LAS -SAVE_CLOUDS "D:\test_merged\merged.las" -C_ALL_ATTRIBS
echo Script execution completed.
endlocal
I am getting this error