Jump to content

Counting function with STL Export


Recommended Posts

Hello all,


I'm trying to create a simple and full digitalization program with export of the final STL to a folder

Just to make an operator switch part on machine on a daily shift  

My program creates the forder and open the same to a easy visualization


                          os.mkdir (r'C:\...') #create the folder 

                          os.startfile(r'C:\...') #open the folder


Then I export the STL to this folder and the objective is to had Part 1, Part 2 ....

I use the export script with record 

            gom.script.sys.export_stl (


On this script I try to add a count function but with no success and after a few try I try to change the exportations stl names on the folder      

            for file_name in os.listdir(folder):
                       source = folder + file_name

                      destination = folder + 'Part_' + str(count) + '.stl'

                      os.rename (source, destination)

                      count =+1

But with this code he creates the Part 1 and Part 2 but on the 3 run he change the names of the parts to Part 3 and Part 4 and had one new export with the name Part 5 for a program while (count < 3)

Is it possible to had the rename process on the export script??




Link to comment
Share on other sites


  • Create New...