I bumped my nose on a couple issues with the script -
Not totally down with python command-line use, I couldn’t get to first base until I eliminated the commas after the input and output filenames as shown in the README.md.
python gcode_mover.py [/path/to/infile.gcode /path/to/outfile.gcode X-coordinates(float) Y-coordinates(float) Z-coordinates(float)
Issuing the command with only spaces between the parameters made it work, but an error stopped me:
File "gcode_mover.py", line 61, in <module>
print "BRIDGEKEEPER: " + bk_phrases[random.randomint(0, len(bk_phrases))]
AttributeError: 'module' object has no attribute 'randomint'
Should this be randint instead of randomint? Making that change gets me to the next issue:
File "gcode_mover.py", line 118, in <module>
outputFile.write('Z'+str(float(linePart[1:]) + z_amount))
TypeError: unsupported operand type(s) for +: 'float' and 'str'
Since x_amount, y_amount and z_amount are strings, the addition inside the str() call works if I convert them to floats:
outputFile.write('X'+str(float(linePart[1:]) + float(x_amount)))
elif linePart.startswith('Y'):
outputFile.write('Y'+str(float(linePart[1:]) + float(y_amount)))
elif linePart.startswith('Z'):
outputFile.write('Z'+str(float(linePart[1:]) + float(z_amount)))
With those changes, the script does a nifty job of relocating a file on the workarea. Thanks for posting it!