From 061944c8a7f346f8ccff0242443722f966a494bb Mon Sep 17 00:00:00 2001 From: HellAholic Date: Sun, 14 Sep 2025 10:14:43 +0200 Subject: [PATCH] add a limiter to the z-height hop --- plugins/PostProcessingPlugin/scripts/ZHopOnTravel.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/PostProcessingPlugin/scripts/ZHopOnTravel.py b/plugins/PostProcessingPlugin/scripts/ZHopOnTravel.py index 71924419fe..69cf3d1938 100644 --- a/plugins/PostProcessingPlugin/scripts/ZHopOnTravel.py +++ b/plugins/PostProcessingPlugin/scripts/ZHopOnTravel.py @@ -90,6 +90,7 @@ class ZHopOnTravel(Script): "default_value": 0.5, "minimum_value": 0, "maximum_value_warning": 5, + "maximum_value": 10, "enabled": "zhop_travel_enabled" }, "min_travel_dist": { @@ -417,7 +418,12 @@ class ZHopOnTravel(Script): reset_type += 4 if extra_prime_dist > 0 and hop_retraction: reset_type += 8 - up_lines = f"G1 F{speed_zhop} Z{round(self._cur_z + hop_height,2)} ; Hop Up" + + machine_height = Application.getInstance().getGlobalContainerStack().getProperty("machine_height", "value") + if self._cur_z + hop_height < machine_height: + up_lines = f"G1 F{speed_zhop} Z{round(self._cur_z + hop_height,2)} ; Hop Up" + else: + up_lines = f"G1 F{speed_zhop} Z{round(machine_height, 2)} ; Hop Up" if reset_type in [1, 9] and hop_retraction: # add retract only when necessary up_lines = f"G1 F{retract_speed} E{round(self._cur_e - retraction_amount, 5)} ; Retract\n" + up_lines self._cur_e = round(self._cur_e - retraction_amount, 5)