Module voxelfuse_examples.gcode_modification.gcode_modification
Demonstrates removing the header generated by the slicer and replacing it with a header from a template file.
Copyright 2019 - Cole Brauer, Dan Aukes
Expand source code
"""
Demonstrates removing the header generated by the slicer and replacing it with a header from a template file.
----
Copyright 2019 - Cole Brauer, Dan Aukes
"""
import voxelfuse.gcode_tools as gcode
if __name__=='__main__':
gc1 = gcode.import_gcode('flex.gcode') # Cura
# gc1 = gcode.import_gcode('flex2.gcode') # Slic3r
header = gcode.import_gcode('header-template.gcode')
# Insert tags at the start of each voxel layer
gcode.find_voxels(gc1)
# Remove initialization commands
gcode.remove_to_string(gc1, 'V0')
# Insert pause before voxel layer 2
gcode.pause_before_voxel(gc1, 2)
# Insert header template
gc1[0:0] = header
gcode.export('new-file.gcode', gc1)
print("Finished")