-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathnozzle_prime.cfg
46 lines (40 loc) · 2.01 KB
/
nozzle_prime.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
[gcode_macro NOZZLE_PRIME_LINE]
description:
Prime the nozzle by laying a strip of plastic along the left side of the bed
gcode:
SAVE_GCODE_STATE NAME=nozzle_prime_state
{% set pi = 3.1415926536 %}
{% set nozzle_diam = printer.configfile.settings.extruder.nozzle_diameter %}
# TODO: try reading the filament diameter from a sensor
{% set filament_diam = printer.configfile.settings.extruder.filament_diameter %}
# TODO: figure out how to recover if firmware retraction isn't defined
{% set retract_len = printer.configfile.settings.firmware_retraction.retract_length %}
{% set layer_height = 0.28 %}
{% set line_width = nozzle_diam * 1.75 %}
{% set x_start = printer.toolhead.axis_minimum.x + 5 %}
{% set x_end = x_start + line_width %}
{% set y_start = printer.toolhead.axis_minimum.y + 20 %}
{% set y_end = y_start + 180 %}
{% if y_end > printer.toolhead.axis_maximum.y - 20 %}
{% set y_end = printer.toolhead.axis_maximum.y - 20 %}
{% endif %}
{% set y_diff = y_end - y_start %}
{% set extrude_cross_section_area = (pi * ((layer_height / 2) ** 2)) + ((line_width - layer_height) * layer_height) %}
{% set extrude_vol = y_diff * extrude_cross_section_area %}
# TODO: figure out why my E math is wrong.
# I'd expect E-vals to be 15, but I'm getting ~8.38
{% set extrude_len = (extrude_vol * 1.75) / (pi * (filament_diam / 2) ** 2) %}
##### end of definitions #####
G90 ;Absolute positionning
M82 ;Absolute extrusion
G92 E0 ;Reset extruder
G1 Z5.0 F3000 ;Move Z axis up
# TODO: consider priming along the front of the bed
G1 X{x_start} Y{y_start} F5000.0 ;Move tool to XY pos
G1 Z{layer_height} F5000.0 ;Move tool down
G1 X{x_start} Y{y_end} Z{layer_height} F1500.0 E{extrude_len} ;Start priming wipe
G1 X{x_end} Y{y_end} Z{layer_height} F5000.0
G1 X{x_end} Y{y_start} Z{layer_height} F1500.0 E{extrude_len * 2} ;Finish priming wipe
G1 Z5.0 E{(extrude_len * 2) - retract_len} F3000 ;Move Z axis up & retract
G92 E0 ;Reset extruder
RESTORE_GCODE_STATE NAME=nozzle_prime_state