Cura icon indicating copy to clipboard operation
Cura copied to clipboard

Z hop when retracted moves nozzle to X0 Y0 at start of the print

Open WojciechBednarski opened this issue 2 months ago • 6 comments

Cura Version

5.11

Operating System

Windows 11

Printer

Voron Trident 300

Reproduction steps

Before version 5.11 I used Z Hop When Retracted as the standard option for Voron. After update I noticed that my nozzle went to 0,0 at start of the print, which was the problem with adaptive bed mesh (I printed small part, so adaptive mesh was doing only small portion of the bed, as a result edges of the bed were interpolated so much, that they were out of Z limit).

To reproduce I made one gcode with this option, one without. Also double checked that in prior version there was no such behavior. I also tried basic things:

  1. Remove all plugins
  2. Remove all postscripts
  3. Remove all cura settings completely and start from scratch parametrization
  4. Re-add fresh voron profile
  5. Create printer based on custom profile instead of voron ones

Actual results

GCODE without Z Hop When Retracted:

Image

GCODE with Z Hop When Retracted:

Image

Expected results

Expected result for me is not to move the nozzle to X0 Y0 at start of the print with Z-hop enabled. As it was in prior cura versions.

Add your .zip and screenshots here ⬇️

Please, let me know if a project file is necessary, but since it behaves the same way on totally fresh install and settings, I don't think this is necessary.

WojciechBednarski avatar Nov 11 '25 00:11 WojciechBednarski

@WojciechBednarski Thanks for the report. @HellAholic this is easy to reproduce. Just toggle "Z-Hop when retracted" on and off. The issue seems to be new with 5.11.0.

(I'm going to guess - "LayerPlan.cpp"???)

GregValiant avatar Nov 11 '25 11:11 GregValiant

Thanks for the report. Added a ticket to the board. CURA-12840

HellAholic avatar Nov 12 '25 07:11 HellAholic

If you need "Z-Hop when Retracted" and wish to remove that travel line you can use the post-processor "Search and Replace" as a workaround. Set it up like this:

Search for = G0 F(\d*|d.) X0.00 Y0.00 Z(\d.) Replace with = ;Travel Removed

The checkboxes look like this:

Image

GregValiant avatar Dec 05 '25 14:12 GregValiant

If you need "Z-Hop when Retracted" and wish to remove that travel line you can use the post-processor "Search and Replace" as a workaround. Set it up like this:

Search for = G0 F(\d*|d.) X0.00 Y0.00 Z(\d.) Replace with = ;Travel Removed

The checkboxes look like this:

Image

The above regular expression is incorrect. It should be something more like G0 F\d+(\.\d+)? X0.00 Y0.00 Z\d+(\.\d+)?

EDIT: even that is actually quite bad as it removed the movement rate and the next move will potentially be super slow. I've done this instead:

  • search: G0 F(\d+)(\.\d+)? X0.00 Y0.00 Z(\d+)(\.\d+)?
  • replace: G0 F\1\2 Z\3\4

zupalex avatar Dec 07 '25 21:12 zupalex

It works. There is always more than one way to skin a cat. I'll give you a point for spotting the removal of the "F" parameter.

GregValiant avatar Dec 08 '25 03:12 GregValiant

The regexp you pasted in your comment actually replaced nothing in my case because it's missing escaping. The one I posted is also technically incorrect as it is actually missing escaping the dots. I noticed now it's different than the one we can see the start from in your screenshot. Maybe the markdown renderer messed it up?

Edit for clarity: That expression didn't work in my case when I copied blindly from your post, and after looking at it I could see quite a few problems with it:

  • the second d not being escaped in the first capture group after the F
  • no escaping of . characters
  • the last capture group after Zis only matching one digit followed by any other character, therefore won't match fully something like Z0.32 leaving garbage characters at the end

Now all this technically don't matter for end result as the leftover garbage characters would be at the end of a commented line, AND if your line has F followed by an integer, as a float wouldn't be captured due to incorrect "or" clause in the first capture group.

Hope this helps :-)

zupalex avatar Dec 08 '25 08:12 zupalex