I'm in need of some help with a command line I use to crop point cloud data. The software I want to use provides a very good command line mode (CloudCompare). So I wrote a little CMD one liner which is almost doing everything I want, but now I want to automate this process.
First I'm going to explain my goal, code and then my issues with it.
In an folder I have my original point cloud files "c:\originals\file_1 .. file_n". I need every file to be cropped at specific coordinates So I used a for loop to do this. I want to crop the files at over 800 positions so an automation is my goal. The cropped point clouds are going to be saved in an folder with an unique ID "c:\originals\id\". I have a list (right now in excel) with my coordinates and ID which I want to feed into the cmd line.
set the id to e.g 1 (given by my excel file) I have to run this line stand alone. Should I use /V:OFF to disable delayed environmental expansion?
Code: Select all
set id=*
Code: Select all
mkdir %id%
Code: Select all
for %f in (./*) do start /w ""
which program should be use to work with the point clouds
Code: Select all
"C:\Program Files\CloudCompare\CloudCompare.exe"
Code: Select all
-O -GLOBAL_SHIFT -312600 -5693000 0 %f
Code: Select all
-AUTO_SAVE OFF -CROP2D z 6
Code: Select all
x1 y2 x2 y2 x3 y3 x4 y4 x5 y5 x6 y6
Code: Select all
-C_EXPORT_FMT BIN
Code: Select all
-SAVE_CLOUDS FILE: "C:\originals\%id%\%f"
I'm struggling to implement the the first to lines of code (set id and mkdir) to work with the rest of my code.
Additionally I don't know how to automatically read out the ID and the vertices from my excel file. I think I can save this excel file as an csv text file and somehow read out the ID and vertices. But how do I do this?
If the text file would be in the folder c:\vertices\vertices.txt (with comma separated).
The form of the text file would be ID,x1,y2,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6.
I guess i need to write a batch or .cmd file for that. But my skills are to low to do that on my own.
So In short:
Is there a way to automatically process my originals and make a batch that would crop the originals using the provided code?
Pseudocode:
Code: Select all
1. read the first ID and vertices from file and store them in variables
2. make output directory using the ID as folder name
3. crop all originals using the code lines above and save them in the right folder
4. read the next ID and vertices
5. make new directory with ID
6. crop .... and so on
If there are any questions don't hesitate to ask me.
Best Tobias