Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Python API reference seems to not match actual experience

Hi all,

I have tried using the following to check if the program has found a successful path because we have had some tools break due to what we believe are problem programs generated. To check this we have tried:

prog_succeeded = prog.MakeProgram(filestr=TEMPORARY_PATH,run_mode=RUNMODE_MAKE_ROBOTPROG)

However the 0th index element is always returning True and the 2nd index is always returning False.

I also trued prog.Update() - according to the docs, the 3rd index returns a ratio of valid instructions.

For us, valid instructions is always 1.0, even when we pass in bogus XYZs -  so to get around this we have had to do a roundabout way of counting the lines of the XYZ file and comparing it to the valid moves (0th index), for some reason there is always a delta of 11 but we don't want to rely on this.

Here is our solution after reading in the file and counting lines, we would prefer to have an easy way to check for valid progs.  

 curve = RDK.AddCurve(data,0)
 path_settings = RDK.Item("PathSettings")
 prog, status = path_settings.setMillingParameters(part=curve)
 prog_succeeded = prog.MakeProgram(filestr=TEMPORARY_PATH,run_mode=RUNMODE_MAKE_ROBOTPROG)
 if (lineCount - resultOfUpdate[0]) == EXTRA_INSTRUCTIONS:


Hi Callum,

The 2nd index returned by MakeProgram is only useful if you want to transfer the program from RoboDK to the robot automatically (for example, you pass the run mode flag: RUNMODE_MAKE_ROBOTPROG_AND_UPLOAD). This is supported for some robots and it is mostly based on an FTP connection with your robot.

Update will give you more information about the feasibility of your program. Update is equivalent to right clicking a program and selecting Check Path (F5). The valid ratio (index 3 of the returned value) is 1.0 if there are no problems with the program. Alternatively, a readable message will be returned if there are any program issues (similar to what you see with the UI when you check the path). Did you have issues with a program where this ratio was equal to 1.0? (make sure to not round the result)

Keep in mind that RoboDK adds additional program instructions based on the approach strategy and program events (tool change, reference change, specific triggers...). I don't recommend you to count the lines of movements as these extra instructions may vary depending on a few settings.


Users browsing this thread:
1 Guest(s)