infill_holes, pattern_lines=line_pattern( d, angle=45 if h % 0.4 > 0.15 else -45)) e, commands = print_layer(infill_lines, e=e, h=h, start_point=(0, 0), layer_height=layer_height) f.write(commands) # print("e after Infill: {}".format(e)) e, cmd = retract(e, retract_volume=9, filament_d=1.75) f.write(cmd + "\n") f.write(travel((30 + 3 * 30, 30 + 2 * 30, h)) + "\n") e, cmd = resume(e, retract_volume=9, filament_d=1.75) f.write(cmd + "\n") e, cmd = print_move((30 + 3 * 30, 30 + 2 * 30, h), (30 + 3 * 30 + 10, 30 + 2 * 30, h), old_e=e, h=layer_height) f.write(cmd + "\n") f.write(travel((30 + 3 * 30 + 10, 30 + 2 * 30 + 10, h)) + "\n") f.write(travel((30 + 3 * 30, 30 + 2 * 30 + 10, h)) + "\n") f.write(travel((30 + 3 * 30, 30 + 2 * 30, h)) + "\n") e, cmd = retract(e, retract_volume=9, filament_d=1.75) f.write(cmd + "\n") print("Height {} sliced.".format(h)) h += 0.2 f.write(stop_sequence()) print("File {0} written.".format(filename))
from __future__ import division, print_function, unicode_literals from gcodehelpers import print_move, travel, retract, resume, start_sequence, stop_sequence, fan_on if __name__ == "__main__": filename = "retract_grid.gcode" with open(filename, 'w') as f: f.write(start_sequence() + "\n") e = 0.0 h = 0.3 f.write(travel((65, 65, h)) + "\n") points = [(65, 65), (175, 65), (175, 175), (65, 175), (65, 65), (64.6, 64.6), (174.6, 64.6), (174.6, 174.6), (64.6, 174.6), (64.6, 64.6)] old_x, old_y = points[0] for x, y in points: e, command = print_move((old_x, old_y, h), (x, y, h), old_e=e) old_x, old_y = x, y f.write(command + "\n") f.write(travel((70, 70, h)) + "\n") for i in range(99): for j in range(10): e, command = print_move((70 + j * 10, 70, h), (70 + j * 10, 80, h), old_e=e) f.write(command + "\n") e, command = retract(old_e=e, retract_volume=j) f.write(command + "\n") f.write(travel((70 + j * 10, 90, h)) + "\n") e, command = resume(old_e=e, retract_volume=j) f.write(command + "\n") e, command = print_move((70 + j * 10, 90, h),
from __future__ import division, print_function, unicode_literals from gcodehelpers import print_move, travel, start_sequence, stop_sequence, fan_on if __name__ == "__main__": filename = "calibration_box.gcode" with open(filename, 'w') as f: f.write(start_sequence() + "\n") e = 0.0 h = 0.3 f.write(travel((65, 65, h)) + "\n") points = [(65, 65), (105, 65), (105, 105), (65, 105), (65, 65), (64.6, 64.6), (105.4, 64.6), (105.4, 105.4), (64.6, 105.4), (64.6, 64.6)] old_x, old_y = points[0] for x, y in points: e, command = print_move((old_x, old_y, h), (x, y, h), old_e=e) old_x, old_y = x, y f.write(command + "\n") f.write(travel((70, 70, h)) + "\n") points = [(70, 70), (100, 70), (100, 100), (70, 100), (70, 70)] for i in range(99): for x, y in points: e, command = print_move((old_x, old_y, h), (x, y, h), old_e=e) old_x, old_y = x, y f.write(command + "\n") h += 0.2 if i == 0: f.write(fan_on() + "\n") f.write(travel((70, 70, h)) + "\n") f.write(stop_sequence()) print("File {0} written.".format(filename))
from gcodehelpers import print_move, travel, start_sequence, stop_sequence, get_line_distance if __name__ == "__main__": filename = "first_layer_carpet.gcode" with open(filename, 'w') as f: f.write(start_sequence() + "\n") e = 0.0 h = 0.3 w = 0.42 x_offset = 65 y_offset = 65 carpet_width = 40 carpet_length = 60 f.write(travel((x_offset, y_offset, h)) + "\n") y = y_offset while y <= y_offset + carpet_length - 2 * get_line_distance(w, h, 0.4): e, command = print_move((x_offset, y, h), (x_offset + carpet_width, y, h), old_e=e) f.write(command + "\n") y = y + get_line_distance(w, h, 0.4) f.write(travel((x_offset + carpet_width, y, h)) + "\n") e, command = print_move((x_offset + carpet_width, y, h), (x_offset, y, h), old_e=e) f.write(command + "\n") y = y + get_line_distance(w, h, 0.4) f.write(travel((x_offset, y, h)) + "\n") f.write(stop_sequence()) print("File {0} written.".format(filename))
if __name__ == "__main__": filename = "acceleration_test.gcode" with open(filename, 'w') as f: f.write(start_sequence() + "\n") e = 0.0 h = 0.3 filament_d = 1.75 f.write(travel((65, 65, h)) + "\n") points = [(65, 65), (105, 65), (105, 105), (65, 105), (65, 65), (64.6, 64.6), (104.6, 64.6), (104.6, 104.6), (64.6, 104.6), (64.6, 64.6)] old_x, old_y = points[0] for x, y in points: e, command = print_move((old_x, old_y, h), (x, y, h), old_e=e, filament_d=filament_d) old_x, old_y = x, y f.write(command + "\n") f.write("G0 X70 Y70 Z0.3\n") speed = 2000 acceleration = 300 f.write("M201 X" + str(acceleration) + " Y" + str(acceleration) + "\n") points = [(70, 70), (100, 70), (100, 100), (70, 100), (70, 70)] for i in range(399): for x, y in points: e, command = print_move((old_x, old_y, h), (x, y, h), old_e=e, filament_d=filament_d, speed=speed) old_x, old_y = x, y