Hello everyone. I was wondering how to modify the location where programs are saved using the API. With the GUI this is easy as the command "Generate Robot Program (as...)" either opens a VSCodium window or a file dialog which both allow me to choose the directory to save to. For the API however I can't find anything in the documentation, the only explanations given are variations of the following :
Currently the program is neither saved in the default directory that is chosen when using the GUI (C:\Users\UserName\Documents\RoboDK\Programs) nor is it saved in the directory of my station file.
I tried to find the correct way to go about this by using the code provided with the ProgramStart() documentation but it simply doesn't do any saving as far as I can see (see code below). I also looked into the "Offline programming with GUI" example without any success either.
Can I get a minimal example of chosing an existing program inside RoboDK and saving it to a directory of choice?
Quote:Finish()
Stops the communication with RoboDK. If setRunMode is set to RUNMODE_MAKE_ROBOTPROG for offline programming, any programs pending will be generated
Currently the program is neither saved in the default directory that is chosen when using the GUI (C:\Users\UserName\Documents\RoboDK\Programs) nor is it saved in the directory of my station file.
I tried to find the correct way to go about this by using the code provided with the ProgramStart() documentation but it simply doesn't do any saving as far as I can see (see code below). I also looked into the "Offline programming with GUI" example without any success either.
Code:
from robodk.robolink import * # import the robolink library
RDK = Robolink() # connect to the RoboDK API (RoboDK starts if it has not started
RDK.AddFile(path_to_station) # Open desired RoboDK station
robot = RDK.Item('', ITEM_TYPE_ROBOT) # use the first available robot
RDK.ProgramStart('Test_Dir',r'C:\Users\UserName\Documents\RoboDK\Programs', "KUKA_KRC4_DAT", robot) # specify the program name for program generation
# RDK.setRunMode(RUNMODE_MAKE_ROBOTPROG) # redundant
home = RDK.Item('Home')
poseref = home.Pose()
robot.MoveJ(home) # make a simulation
RDK.Finish() # Provokes the program generation (disconnects the API)
Can I get a minimal example of chosing an existing program inside RoboDK and saving it to a directory of choice?