with open(filename, 'w') as f:
     f.write(start_sequence() + "\n")
     object_coords = [(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]
     e = 0.0
     h = 0.3
     w = 0.42
     e, cmd = retract(e, retract_volume=5, filament_d=1.75)
     f.write(cmd + "\n")
     while h <= 10:
         layer_height = 0.3 if h < 0.31 else 0.2
         if h >= 0.31:
             f.write(fan_on() + "\n")
         for overlap_index in range(11):
             f.write(
                 travel((30 + w / 2 + layer_height / 2 +
                         (overlap_index % 4) * 30,
                         30 + w / 2 + layer_height / 2 +
                         (overlap_index // 4) * 30, h)) + "\n")
             e, cmd = resume(e, retract_volume=9, filament_d=1.75)
             f.write(cmd + "\n")
             coords = offset_coords(object_coords,
                                    (30 + (overlap_index % 4) * 30, 30 +
                                     (overlap_index // 4) * 30))
             if h < 0.35:
                 e, commands = print_brim(
                     coords, e, h=h, line_overlap_factor=overlap_index / 10)
                 f.write(commands)
                 # print("e after Brim: {}".format(e))
             e, commands = print_wall(coords, [],
                                      h,
                                      e,
                                      start_point=(0, 0),
#!/usr/bin/python3
# -*- coding: utf-8 -*-
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)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
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")
Esempio n. 4
0
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
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())
Esempio n. 5
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from gcodehelpers import print_move, travel, start_sequence, stop_sequence, fan_on

if __name__ == "__main__":
    filename = "speed_tower.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), (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)
            old_x, old_y = x, y
            f.write(command + "\n")
        f.write("G0 X70 Y70 Z0.3\n")
        speed = 1000
        points = [(70, 70), (100, 70), (100, 100), (70, 100), (70, 70)]
        for i in range(299):
            for x, y in points:
                e, command = print_move((old_x, old_y, h), (x, y, h),
                                        old_e=e,
                                        speed=speed)
                old_x, old_y = x, y
                f.write(command + "\n")
            h += 0.2