Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update primeline so that it runs along the rectangle of the first layer #498

Merged
merged 5 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions macros/helpers/prime_line.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ gcode:
{% set prime_line_y = params.START_Y|default(prime_line_y)|float %}
{% set prime_line_direction = params.LINE_DIRECTION|default(printer["gcode_macro _USER_VARIABLES"].prime_line_direction)|string|upper %}

# Redefine start position from fl_size
{% set fl_size=printer['gcode_macro START_PRINT'].fl_size %}
{% if fl_size != "0_0_0_0" %}
{% set prime_line_margin = params.LINE_MARGIN|default(printer["gcode_macro _USER_VARIABLES"].prime_line_margin|float) %}
elpopo-eng marked this conversation as resolved.
Show resolved Hide resolved
{% set min_x, min_y, max_x, max_y = fl_size.split("_")|map('float') %}
{% set prime_line_x = [[prime_line_x, min_x - prime_line_margin] | max, max_x + prime_line_margin] | min %}
{% set prime_line_y = [[prime_line_y, min_y - prime_line_margin] | max, max_y + prime_line_margin] | min %}
Frix-x marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}

{% set axes_max = printer.toolhead.axis_maximum %}
{% set prime_line_way = -1 if (prime_line_direction == "X" and prime_line_x > axes_max.x/2) or (prime_line_direction == "Y" and prime_line_y > axes_max.y/2) else 1 %}


{% if verbose %}
{action_respond_info("Prime line length: %.4f" % prime_line_length)}
{action_respond_info("Prime line eight: %.4f" % prime_line_height)}
Expand Down Expand Up @@ -92,10 +105,12 @@ gcode:

# Prime line
G92 E0

{% if prime_line_direction == "X" %}
G1 X{prime_line_x + prime_line_length} E{prime_line_purge_distance} F{speed}
G1 X{prime_line_x + prime_line_way*prime_line_length} E{prime_line_purge_distance} F{speed}
{% elif prime_line_direction == "Y" %}
G1 Y{prime_line_y + prime_line_length} E{prime_line_purge_distance} F{speed}
G1 Y{prime_line_y + prime_line_way*prime_line_length} E{prime_line_purge_distance} F{speed}

{% else %}
{ action_respond_error("Prime line direction is not valid. Choose either X or Y in the variables.cfg file!") }
{% endif %}
Expand All @@ -116,3 +131,4 @@ gcode:
{% if filament_sensor_enabled and re_enable_filament_sensor %}
SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1
{% endif %}

1 change: 1 addition & 0 deletions user_templates/variables.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ variable_prime_line_length: 40 # length of the prime line on the bed (in mm)
variable_prime_line_purge_distance: 30 # length of filament to purge (in mm)
variable_prime_line_flowrate: 10 # mm3/s used for the prime line
variable_prime_line_height: 0.6 # mm, used for actual cross section computation
variable_prime_line_margin: 5 # distance of purge line from fl_size rectangle

## Park position used when pause, end_print, etc...
variable_park_position_xy: -1, -1
Expand Down