Set of functions to manipulate and modify the G-code fed to a FDM 3D-printer
#How to use
Open the __init__.py file and change the path = "test.gcode" with the name of your G-code file. You can then execute:
python __init__.pyfrom gcodeParser import *
parser = GcodeParser()
model = parser.parseFile( "test.gcode" )model.layers will display all the layers in the G-code as class object.
Use model.layers[i] to check layer i.
model.layers[i].segments will display the number of segments plotted in a layer as segment class object.
model.layers[i].segments[j].coords will display the G-code line corresponding to segment number j of layer i.
model.layers[i].segments[j].layerIdx will display i.
model.layers[i].Z will directly who you the layer heigth Z in millimiters.
Original sources from: https://github.com/jonathanwin/yagv By https://github.com/jonathanwin