printer.cfg modified - 03.02.2025 - 23:20:55

This commit is contained in:
klipper committed 2025-02-03 23:21:03 +01:00
1 parent 7d238f6a42
commit 5d21061f37
1 file changed
+68
+68
View File
@@ -823,6 +823,74 @@ gcode:
SET_IDLE_TIMEOUT TIMEOUT=43200 ; set timeout to 12 hours
{% endif %}
[gcode_macro LINE_PURGE]
description: A purge macro that adapts to be near your actual printed objects
variable_adaptive_enable: True # Change to False if you'd like the purge to be in the same spot every print
variable_z_height: 10 # Height above the bed to purge
variable_purge_amount: 40 # Amount of filament in millimeters to purge
variable_line_length: 50 # Overall desired length of purge line in millimeters, around 1/5th of X axis length is a good starting value
variable_flow_rate: 35 # Desired flow rate in mm3/s (Around 12 for standard flow hotends, around 24 for high flow hotends)
variable_x_default: 115 # Default X location to purge. If adaptive_enable is True, this is overwritten
variable_y_default: 251 # Default Y location to purge. If adaptive_enable is True, this is overwritten
variable_distance_to_object_y: 10 # Y distance in millimeters away from the print area for purging. Must be less than or equal to y_default if adaptive_enable is False
### This section is for those who are using Moonraker's Update Manager for KAMP, or want a more verbose macro. ###
variable_display_parameters: True # Display macro paramters in the console, useful for debugging the SETUP_LINE_PURGE call, or more verbosity.
gcode:
{% if display_parameters == True %}
{ action_respond_info("adaptive_enable : %d" % (adaptive_enable)) }
{ action_respond_info("z_height : %f" % (z_height)) }
{ action_respond_info("purge_amount : %f" % (purge_amount)) }
{ action_respond_info("line_length : %f" % (line_length)) }
{ action_respond_info("flow_rate : %f" % (flow_rate)) }
{ action_respond_info("x_default : %f" % (x_default)) }
{ action_respond_info("y_default : %f" % (y_default)) }
{ action_respond_info("distance_to_object_y : %f" % (distance_to_object_y)) }
{% endif %}
{% if adaptive_enable == True %}
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %}
{% set x_origin = (all_points | map(attribute=0) | min | default(x_default)) %}
{% set y_origin = (all_points | map(attribute=1) | min | default(y_default)) %}
{% set x_origin = ([x_origin, 0] | max) %}
{% set y_origin = ([y_origin, 0] | max) %}
{% else %}
{% set x_origin = x_default | float %}
{% set y_origin = y_default | float %}
{% endif %}
{% set nozzle_dia = printer.configfile.config.extruder.nozzle_diameter | float %}
{% set cross_section = nozzle_dia * z_height | float %}
{% set purge_move_speed = (cross_section * flow_rate) * 60 | float %}
{% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %}
G92 E0 # Reset extruder
G0 F{travel_speed} # Set travel speed
G90 # Absolute positioning
G0 X{x_origin} Y{y_origin - distance_to_object_y} # Move to purge position
G0 Z{z_height} # Move to purge Z height
M83 # Relative extrusion mode
G1 X{x_origin + line_length} E{purge_amount} F{purge_move_speed} # Purge line
G1 E-.5 F2100 # Retract
G92 E0 # Reset extruder distance
M82 # Absolute extrusion mode
G0 Z{z_height * 2} F{travel_speed} # Z hop
[gcode_macro SETUP_LINE_PURGE]
gcode:
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=display_parameters VALUE={params.DISPLAY_PARAMETERS|default(True)|int}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=adaptive_enable VALUE={params.ADAPTIVE_ENABLE|default(True)|int}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=z_height VALUE={params.Z_HEIGHT|default(0.4)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=purge_amount VALUE={params.PURGE_AMOUNT|default(40)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=line_length VALUE={params.LINE_LENGTH|default(50)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=flow_rate VALUE={params.FLOW_RATE|default(12)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=x_default VALUE={params.X_DEFAULT|default(10)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=y_default VALUE={params.Y_DEFAULT|default(10)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=distance_to_object_y VALUE={params.DISTANCE_TO_OBJECT_Y|default(10)|float}
[gcode_macro RESUME]
rename_existing: BASE_RESUME
variable_zhop: 0