07-08-2021, 12:06 PM
I'm generating robot program files via the RoboDK API using "MakeProgram". How do I change the name and the extension of the output file?
The code I use below outputs the program 'myProgram' as the file 'myProgram.py'. I would like to change the filename to e.g. 'myProgram_1.py' or 'myProgram_2.txt', without changing the name of the program itself:
The code I use below outputs the program 'myProgram' as the file 'myProgram.py'. I would like to change the filename to e.g. 'myProgram_1.py' or 'myProgram_2.txt', without changing the name of the program itself:
Code:
from robolink import * # RoboDK API
from robodk import * # Robot toolbox
RDK = Robolink()
myProgramItem = RDK.Item('myProgram',ITEM_TYPE_PROGRAM) # Get the program item named 'myProgram'
myProgramItem.MakeProgram('',RUNMODE_MAKE_ROBOTPROG) # Export 'myProgram' to file.