forked from kyleisah/Klipper-Adaptive-Meshing-Purging
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[gcode_macro Smart_Park] | ||
description: Parks your printhead near the print area for pre-print hotend heating. | ||
gcode: | ||
|
||
{% set z_height = printer["gcode_macro _KAMP_Settings"].smart_park_height | float %} # Pull park height value from _KAMP_Settings | ||
{% set center_x = printer.toolhead.axis_maximum.x / 2 | float %} # Create center point of x for fallback | ||
{% set center_y = printer.toolhead.axis_maximum.y / 2 | float %} # Create center point of y for fallback | ||
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Gather all object points | ||
{% set x_min = all_points | map(attribute=0) | min | default(center_x) %} # Set x_min from smallest object x point | ||
{% set y_min = all_points | map(attribute=1) | min | default(center_y) %} # Set y_min from smallest object y point | ||
{% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %} # Set travel speed from config | ||
|
||
G0 X{x_min} Y{y_min} F{travel_speed} # Move near object area | ||
G0 Z{z_height} # Move Z to park height |