Batch convert .las to .ply

Any question about the main GUI application (frontend)
Post Reply
chc810
Posts: 5
Joined: Tue Jan 17, 2023 12:01 pm

Batch convert .las to .ply

Post 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()
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Batch convert .las to .ply

Post by daniel »

You have to use the -SILENT option
Daniel, CloudCompare admin
chc810
Posts: 5
Joined: Tue Jan 17, 2023 12:01 pm

Re: Batch convert .las to .ply

Post by chc810 »

daniel wrote: Sat Jan 21, 2023 9:22 am You have to use the -SILENT option
Thanks!
Post Reply