OrcaSlicer icon indicating copy to clipboard operation
OrcaSlicer copied to clipboard

z_offset is not applied to the first move down onto a part (print start, and after a tool change without a prime tower)

Open monsterlag opened this issue 1 month ago • 1 comments

Summary

When the printer profile's Z offset (z_offset) is not zero, Snapmaker Orca writes the first move down onto a part at the nominal layer height, without the offset. Everything that prints before the next Z word is therefore z_offset too low (or too high). This happens at the start of the print and after a tool change when the slicer does not know the last position:

  • a job with no prime tower (including any single-toolhead job, because the tower is dropped there);
  • a multi-colour job whose first layer starts on a part instead of on the prime tower.

The cause is in GCode::_extrude(): after a travel from an unknown position the slicer forces Z with travel_to_z(m_last_layer_z, "force restore Z after unknown last pos", true). m_last_layer_z is the nominal print_z without z_offset. Upstream OrcaSlicer fixed the same line in OrcaSlicer/OrcaSlicer#11011 (issue #11002) by using m_nominal_z. That change is not in Snapmaker Orca 2.4.0, 2.4.1-alpha or current main.

Steps to reproduce

  1. Printer: Snapmaker U1 (0.4 nozzle). In Printer settings > Basic information, set Z offset to 0.05.
  2. Add one object on one toolhead, or several objects on several toolheads with the prime tower off. First-layer height 0.25 mm.
  3. Slice and export the G-code (I used the command line; GUI not checked).
  4. Look at the first G1 Z before the first extruding move, and at the first G1 Z after each tool change.

Expected

Every extruding move on layer 1 is at 0.25 + 0.05 = 0.30 (G1 Z.3), like the rest of the file.

Actual

The hop is shifted but the move down is not. For example, a lift to G1 Z.7 is followed by G1 Z.25, so the moves up to the next Z word print at 0.25. One case without a tower: 546 of 74,288 extruding moves were at the unshifted height (345 raft moves on layer 1 and 201 moves on the first layer after a tool change). With the prime tower on and the print starting on the tower, 0 moves were unshifted (three projects, 56,000 to 371,000 moves each). A four-colour plate whose first layer started on a part showed the same single unshifted move down with the tower on.

Environment

  • Snapmaker Orca 2.4.0 (macOS, Apple Silicon), command-line slicing (--slice). GUI not checked.
  • Printer profile: inherits "Snapmaker U1 (0.4 nozzle)", z_offset = 0.05, High Temp Plate.
  • Code checked: v2.4.0, v2.4.1-alpha and main 5638e55 all still contain the m_last_layer_z line.

Evidence

I print PLA on a Darkmoon G10 plate and raise the first layer by 0.05 mm through the slicer's z_offset. I measured the result per move in sliced files: two independent parsers compared a rebuilt project against the file that had printed, and every Z word moved by exactly +0.05 except the first move down in the cases listed above. My build scripts now check every extruding move and patch or reject those files. Without that check, a part whose first line is lettering or a thin outline goes down 0.05 mm closer than the rest of the layer.

Suggested fix

Port the GCode.cpp hunk of OrcaSlicer/OrcaSlicer#11011: use m_nominal_z instead of m_last_layer_z in the "restore Z after unknown last pos" travel.

Drafted with an AI agent (Claude) from my print notes and sliced files; the agent checked the code reference against current main.

monsterlag avatar Oct 21 '26 22:10 monsterlag

I reproduced this on the 2.4.1 release (macOS, Apple Silicon, command line --slice 0), which the report did not cover. Two 20 mm boxes, two PLA filaments on T0 and T1, by layer, stock "Snapmaker U1 (0.4 nozzle)" profile with only z_offset changed. I counted every extruding move against its layer's ;Z: line:

run z_offset prime tower extruding moves at the unshifted height
off0 0 off 4,512 (nothing to shift)
off5 0.05 off 4,512 204, on 50 layers (Z0.25 to Z10.05)
tow5 0.05 on 25,338 4, first layer only

In off5 the start looks like this: G1 Z.25, four inner wall moves, then G1 X119.6 Y119.6 Z.3 F30000 and the outer wall at 0.30. The same thing repeats after each tool change, so with no tower the first moves of every colour on every layer are 0.05 mm low. With the tower on, only the 4 moves before the first Z word of the print are affected, as described above for a first layer that starts on a part.

main at e88f84a99 still has the line (src/libslic3r/GCode.cpp 7939): travel_to_z(m_last_layer_z, "force restore Z after unknown last pos", true).

To spot affected files without reading them by hand, I added a text check to the U1 Dry Run tools: python3 tools/z_offset_lost.py file.gcode (https://github.com/DesignMaster-Solutions/u1-dryrun/blob/main/tools/z_offset_lost.py). It reads z_offset from the settings block of the file and reports the extruding moves printed at exactly the layer height. On the three files above it exits 0, 1 and 1 with the counts in the table.

What I did not do: nothing was printed, I did not build with the upstream fix (OrcaSlicer#11011) to confirm it clears these counts, and I only tried positive 0.05 and the command line, not the GUI.

alandebortolo avatar Nov 13 '26 05:11 alandebortolo