Fix Spiral Z-Hop arc handling#11430
Conversation
|
Hey @Noisyfox @SoftFever, this PR looks important, and it's not so much code to review. |
|
That's clever and will remove the need to have arc commands enabled in klipper even if arc fitting is disabled. However it will need extensive testing. Approach:
thoughts? |
|
With this PR everything remains the same, every check is preserved. The main difference is that no G2/3 commands are issued if arc fitting is disabled in Orca, the exact arc is reproduced by 24 tiny segments. |
|
An important addition about Arc Filling is that you need to provide such a lock in the printer settings, not only on the Quality tab. |
|
The problem is that G2/3 commands are generated regardless of this setting. This PR fixes that. |
|
There have been several issues with spiral moves extending beyond the bed, causing klipper to shut down. This happened on prime towers and on models close to the edge. Having reviewed the Pr I don’t think this is as relevant, but we need to double check that no movement is done outside the bounds of the printer as a whole. |
|
Arc moves on z hop is why in the orca main page it’s instructed to enable arc fitting in klipper. And disable it in the quality tab (as it’s a double lossy conversion for klipper) this PR should address the need for any arc fitting to be enabled at all on the klipper side. @pi-squared-studio |
I agree, but that is not what this PR is about. This PR generates the exact size of the replaced spiral movement. It cannot introduce any outside of bounds movement that wouldn't be there with the regular spiral (G2/3) movement. |
6d61455 to
52a76b5
Compare
|
Reviewed the PR. Looks good. Just one thing - I am curious whether exploring adding a final G1 XYZ emission after the arc is complete with the final, target position. Why? There is the possibility of numerical errors with the sin commands which may or may not result in slight deviation in the XYZ plane vs the intended position. Or maybe even better check the last XYZ position vs the intended position and if a delta > epsilon is present emit a final G1 XYZ correcting command. What do you think? Is that even relevant or a possibility? |
|
The intended final position is just the start XY and target Z, because we’re doing a full 360° spiral: So for the 24-segment version we can do: for example: |
|
I was writing a response with the exact same solution to emit only 23 generated segments and do the last one manually to the intended end position. However I do not find it necessary as the end position of the spiral ZHop is not critical, it will always be followed by another move command, it will never be the start of an extrusion move. If you still think it is a vital change it can be done just like this: |
|
Yeap that works. I’m not certain of downstream impact as yes XY will move in the next travel position and the starting Z position is not critical for de retraction. However from a code “elegance” perspective it’s nice to cater for numerical precision issues, as they can be very tricky to diagnose later on if there is an impact somewhere :) so in short, not critical but more elegant :) ps. Your code is better than what I proposed, please use that :) |
52a76b5 to
666db43
Compare
|
Perfection! Thank you! yeah I’ve been bitten a few times with numerical precision results hence I’m being a bit paranoid about it. |
|
My tests showed me that the simulated spiral ends up where it starts (XY) so I didn't give more thought to that. |
|
I think this should be re evaluated and I think that spiral z hop should ALWAYS use segments. In fact, the default setting of 1.0 mm segments used in so many thousands klipper printers (which likely won't ever be updated) causes significant deviations between the commanded arc and the effective path. For example (see Klipper3d/klipper#6984 ) only at radius of 12.5 mm the standard setting results in less than 0.01 mm deviation. If I understand correctly the example in the initial screenshot of this pull, the I parameter specifies an offset of the center of rotation from the current position and it's set to ... 1.2 mm!! You can guess how accurate that will be with segments of 1.0 mm! It's about 7.5 segments for a circle. The "after" screenshot shows not ~8 but 24 segments to approximate the same circle! So here either:
What do you think? |
Marlin also splits arcs into segments and, except for recent releases, has the same rule of 1.0 mm per segment Klipper uses by default. But we know that firmware upgrades are something very few users do, so many with arc enabled in Orca (because of the myth that interpolated and then segmented again arcs are better...) might end up with the same segments Klipper users have. I'm just saying that for spiral Z hop, a very specific use case, users might get a better experience with explicitly generated segments, and in this case I think 24 as you did is very good for the reason you mentioned (Marlin likes shorter segments better).
In theory, but not in practice, since likely most printers around will, in fact, use very rough segments. To preserve the "integrity" of your approach ("use G2/G3 for Z hop if the user chose to do so") the end result is a likely worse user experience without, in fact, any real advantage beside the "principle". Summary: the G2/G3 option in the print settings should affect the user models only. Spiral Z hop should always use explicit segments. |
|
The simplest way to address your concerns is to disable "Arc fitting" in Orca. |
|
My concern is not about my case but it's more for people who have it enabled and then find out spiral z hop won't be operating as smooth as it should. But I think arc fitting is disabled in most profiles, I should check by making a quick search. I'll also update the Wiki since it's incorrect. |
* main: (272 commits) Delete validate-documentation.yml (OrcaSlicer#11477) Update printer profiles for Artillery (OrcaSlicer#11284) Fix emulated spiral Z-hop XY offset on multi-plate slicing (OrcaSlicer#11468) Move WIKI to new repo Validate invalid fields for hidden system profiles (OrcaSlicer#11455) ci: Increase timeout for dedupe-issues workflow from 10 to 30 minutes Fix CICD AI dedupe Change runner from self-hosted to ubuntu-latest Check duplicated issues. ported from Claude code repo (OrcaSlicer#11454) UI fixes / improvements (OrcaSlicer#11413) Fix Spiral Z-Hop arc handling (OrcaSlicer#11430) FIX: Open provided file at startup (OrcaSlicer#11419) Re-include BBS's Clipperutils2 (OrcaSlicer#11415) Fix filament profile import if inherit from vendor generic (OrcaSlicer#11398) Fix crash after syncing printer (OrcaSlicer#11428) Wiki 16 (MiniUpdate): Updated by Stable cmake 4.2 release + VS2026 First (OrcaSlicer#11423) Revert "fix GITHUB_TOKEN permissions in workflows (OrcaSlicer#11392)" correct oversight in OrcaSlicer#11392 (OrcaSlicer#11404) Profiles for Creality K2 Pro printer (OrcaSlicer#11315) Reduce artifacts from short travel moves before external perimeters (OrcaSlicer#10722) ...
* upd-eigen-5.0.0: (273 commits) Delete validate-documentation.yml (OrcaSlicer#11477) Update printer profiles for Artillery (OrcaSlicer#11284) Fix emulated spiral Z-hop XY offset on multi-plate slicing (OrcaSlicer#11468) Move WIKI to new repo Validate invalid fields for hidden system profiles (OrcaSlicer#11455) ci: Increase timeout for dedupe-issues workflow from 10 to 30 minutes Fix CICD AI dedupe Change runner from self-hosted to ubuntu-latest Check duplicated issues. ported from Claude code repo (OrcaSlicer#11454) UI fixes / improvements (OrcaSlicer#11413) Fix Spiral Z-Hop arc handling (OrcaSlicer#11430) FIX: Open provided file at startup (OrcaSlicer#11419) Re-include BBS's Clipperutils2 (OrcaSlicer#11415) Fix filament profile import if inherit from vendor generic (OrcaSlicer#11398) Fix crash after syncing printer (OrcaSlicer#11428) Wiki 16 (MiniUpdate): Updated by Stable cmake 4.2 release + VS2026 First (OrcaSlicer#11423) Revert "fix GITHUB_TOKEN permissions in workflows (OrcaSlicer#11392)" correct oversight in OrcaSlicer#11392 (OrcaSlicer#11404) Profiles for Creality K2 Pro printer (OrcaSlicer#11315) Reduce artifacts from short travel moves before external perimeters (OrcaSlicer#10722) ...
|
This PR is causing some machines to give |
Can you first investigate a little on Klipper discord what the cause could be? I'm very surprised klipper would be unable to handle saucy motion. I would in any case try first by reducing from 24 segments to 16 to see if the error disappears: 24 for a circle are really unnecessary |
We are talking about that in slicer-settings at discord. |
|
I presented my ideas there (Discord). |
|
Do you have arcs enabled? Toggle that setting and check if it gets better |



The existing issue
Spiral Z-Hop was still generating arc moves (G2/G3) even when arc fitting was disabled in Orca.
This meant the G-code did not follow the user’s settings and could cause issues on printers that are not using arc mode.
Why this was a problem
When a printer or firmware has arc support disabled or not fully implemented, unexpected G2/G3 commands may cause:
These behaviors depend on the firmware, but all stem from the same root cause: arcs were emitted despite the user disabling them.
What this PR changes
Result
Screenshots
Arc fitting disabled, spiral ZHop selected
Before:
After:
