Save Robot Program


Christmas is coming and everyone wants to save their robot programs so they can go and have peaceful Christmas holiday. Well here’s an add-on that lets you save and load robot programs in XML format.

Known limitations:

  • Topology paths (Premium) are loaded without rebuiling properties (select curve, smoothing).

version 1.01:

  • fixed future bugs on ElementTree null checks
version 1.02:
  • fixed bugs with property units (5.92 KB)

Note that this is not a post-processor for real robot programs. This add-on is only used for saving and loading programs on robots in VC environment.



I believe I found an error with the script. On line 463 there is this code:

if unit_string:
    prop.Unit = app.findUnit(unit_string)

But the prop.Unit property appears to be read only so there is an error when it executes. I got it working for my case with this:

if unit_string == 'millimetres' or unit_string == 'inches':
    prop.Quantity = app.findQuantity('Distance')
elif unit_string == 'millimetres per second' or unit_string == 'inches per minute':
    prop.Quantity = app.findQuantity('Velocity')

Its not elegant, it would require quite a large if statement to catch every possibility. Not sure if there is a better way to implement it.



Hi Mike919,

Thanks for the feedback. It was a bug that I didn’t catch in testing. Unit is indeed read only and you have to play with it using Quantity property and setUnitMagnitude method. So now the code is like this:

unit = app.findUnit(unit_string)
if unit:
  prop.Quantity = unit.Group.Name

I fixed it in the OP attachment. Note that property value is always in the so-called canonical form (e.g. millimeters) and magnitude determines how the value is shown in UI. I tested this fix only a little but for distance types it seems to work.