Code for generating gcode