Page 1 of 1

Batch convert .las to .ply

Posted: Tue Jan 17, 2023 12:19 pm
by chc810
I wrote a script to batch convert las files to ply files in python using cloudcompare's command line tool. When I actually use it, I find that every time I successfully convert a las file, a window pops up saying "Job Done" and then stays there if I don't press OK. This was obviously very cumbersome when I was batching hundreds of las files. How do I change this, thanks!
This is my code:

Code: Select all

import os
import sys

if __name__ == '__main__':

    if len(sys.argv) > 2:
        print("Please enter the correct folder path parameter")
        print("Wrong number of parameters")
        sys.exit()
    else:
        if os.path.isdir(sys.argv[1]):
            print("Analysis in progress...")
            print(sys.argv[1])
            for file in os.listdir(sys.argv[1]):        
                if file.endswith(".las"):
                    filepath = os.path.join(sys.argv[1], file)
                    if os.path.isfile(filepath):
                        filepath = os.path.join(sys.argv[1], file)
                        command = "cloudcompare.CloudCompare -O {0} -C_EXPORT_FMT PLY -SAVE_CLOUDS".format(filepath)
                        os.system(command)
                else:
                    continue
        else:
            print("Wrong number of parameters")
            sys.exit()

Re: Batch convert .las to .ply

Posted: Sat Jan 21, 2023 9:22 am
by daniel
You have to use the -SILENT option

Re: Batch convert .las to .ply

Posted: Tue Jan 24, 2023 9:37 am
by chc810
daniel wrote: Sat Jan 21, 2023 9:22 am You have to use the -SILENT option
Thanks!