Skip to content

exclude_object: lift before the first travel after a skipped object - #28

Draft
alandebortolo wants to merge 2 commits into
Snapmaker:mainfrom
DesignMaster-Solutions:fix-22b-exclude-object-lift-before-travel
Draft

alandebortolo wants to merge 2 commits into
Snapmaker:mainfrom
DesignMaster-Solutions:fix-22b-exclude-object-lift-before-travel

Conversation

@alandebortolo

Copy link
Copy Markdown

Stacked on #24 (it uses the last_tx_position that PR adds), so this shows two commits until #24 is merged. Only the second one is new: the diff of this PR alone.

What happens. OrcaSlicer ends every object with a short ramped lift (0.4 mm of Z over a few mm of XY) and then travels at that height. When the object was skipped, the head is not at the end of that object but at the end of the last printed one, and the first move after the skip goes from there straight to the end point of the ramp. The same 0.4 mm of Z is spread over the whole distance, so the nozzle leaves the last printed part almost at print height and crosses whatever is in between.

There is no issue for this yet. I found it while replaying the 2026-11-01 file from #22 (@abehrman's, three objects skipped) offline: 8 travels cross finished parts with less than 0.05 mm of clearance, all 8 the first move after the EXCLUDE_OBJECT_END of a skipped object (file lines 207895, 215427, 315713, 322732, 392687, 401815, 421571, 507349). They are there on stock and with #24 alone, so it is a second effect of Skip, not something #24 causes or fixes.

The change. When the first move after a skipped object goes up, _normal_move() makes the Z part where the head is and then the XY part. Any E in that move stays with the XY part, as today (a Z+E move would be checked as an extrude-only move). Nothing changes when that move does not go up, or when no object is skipped.

How I tested it, without a printer. Same harness as #24: the firmware in Klipper batch mode with the shipped lava/printer.cfg, the file printed through virtual_sdcard, assertions on the firmware's own move trace.

Test, fixture and logs: https://github.com/DesignMaster-Solutions/u1-fixpack (tests/test_issue22travel.py, tests/prove.sh, docs/evidence/issue-22/), with CI on every push.

Draft for the same reason as #24: batch mode has no physics, so this proves what the firmware commands, not what a print looks like. Nobody has printed with it. A travel that the slicer itself planned without a lift is left as it is.

Built with AI coding assistance; I reviewed and tested it.

…he transform

Fixes Snapmaker#22 (skip an object, Pause, Resume fails with
"Move out of range").

While an object is skipped, exclude_object keeps a per-extruder offset:
last skipped G-code position minus last printed position. The U1 pause park
(MOVE_TO_DISCARD_FILAMENT_POSITION) moves the head with toolhead.manual_move(),
so gcode_move resets its position through exclude_object.get_position(), which
returns the parked position plus that stale offset. The next G1 that does not
set both X and Y (Resume's _CLIENT_EXTRUDE, an E-only move) carries the wrong
XY and is rejected, or, inside the bed, travels there while extruding.

get_position() now compares the position below the transform with the last
one _normal_move() sent. If they differ, the head was moved outside the
transform, so the XYZ offset is zeroed and the last printed position becomes
the real one. The E offset is left as it was.

Diagnosis and the suggested fix are from the issue's reporter; this patch
implements that suggestion. Regression test: tests/test_issue22.py (red on 93cb12f, green with this patch) in
github.com/DesignMaster-Solutions/u1-fixpack.
Stacked on the fix for Snapmaker#22 (uses its
last_tx_position).

The slicer ends every object with a short ramped lift (OrcaSlicer: 0.4 mm of
Z over a few mm of XY) and then travels at that height. When the object was
skipped the head is not at the end of that object but at the end of the last
printed one, and the first move after the skip goes from there straight to the
end point of the ramp: the same 0.4 mm of Z is spread over the whole distance,
so the nozzle leaves the last printed part almost at print height and crosses
whatever is in between.

Seen on a real print file (abehrman's of 2026-11-01, Snapmaker#22,
three objects skipped) run offline: 8 such travels cross finished parts with
less than 0.05 mm of clearance, with and without 0022.

_normal_move() now makes the Z part of that first move where the head is, then
the XY part. Any E in that move stays with the XY part, as before: a Z+E move
would be checked as an extrude-only move (max_extrude_only_distance). Nothing changes when the first move after the skip does not go
up, or when no object is skipped.

Regression test: tests/test_issue22travel.py in
github.com/DesignMaster-Solutions/u1-fixpack (red on stock and with 0022
alone, green with this patch).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants