Skip to content

Commit

Permalink
fix: make prime line height a variable parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
arcadien committed Feb 10, 2024
1 parent a1e7214 commit 6380465
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions macros/helpers/prime_line.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ gcode:
{% set prime_line_length = params.LINE_LENGTH|default(printer["gcode_macro _USER_VARIABLES"].prime_line_length)|float %}
{% set prime_line_purge_distance = params.PURGE_LENGTH|default(printer["gcode_macro _USER_VARIABLES"].prime_line_purge_distance)|float %}
{% set prime_line_flowrate = params.FLOWRATE|default(printer["gcode_macro _USER_VARIABLES"].prime_line_flowrate)|float %}
{% set line_height = params.LINE_HEIGHT|default(printer["gcode_macro _USER_VARIABLES"].prime_line_height)|float %}

# Set internal macro vars
{% set prime_line_x, prime_line_y = printer["gcode_macro _USER_VARIABLES"].prime_line_xy|map('float') %}
Expand All @@ -19,13 +20,17 @@ gcode:
{% set max_extrude_cross_section = printer["configfile"].config["extruder"]["max_extrude_cross_section"]|float %}
{% set filament_diameter = printer["configfile"].config["extruder"]["filament_diameter"]|float %}

{% set line_height = 0.6 %}

# some more Macro parameters after retrieving defaults
{% set prime_line_x = params.START_X|default(prime_line_x)|float %}
{% 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 %}

{% if verbose %}
{action_respond_info("Prime line length: %" % prime_line_length)}
{action_respond_info("Prime line eight: %" % prime_line_height)}
{action_respond_info("prime line extrusion length: %" % prime_line_purge_distance)}
{% endif %}

# We first compute the width of the prime line
{% set purge_volume = prime_line_purge_distance * 3.14159 * (filament_diameter / 2)**2 %}
{% set line_width = purge_volume / (line_height * prime_line_length) %}
Expand Down
1 change: 1 addition & 0 deletions user_templates/variables.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ variable_prime_line_direction: "X" # can also be set to "Y"
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

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

0 comments on commit 6380465

Please sign in to comment.