fix: Restore layer Z after spiral-vase raft tool changes - #11965
fix: Restore layer Z after spiral-vase raft tool changes#11965mvanhorn wants to merge 2 commits into
Conversation
| if (m_spiral_vase) { | ||
| // No lazy z lift for spiral vase mode | ||
| const double target_z = z == DBL_MAX ? m_nominal_z : z; | ||
| if (std::abs(m_writer.get_position().z() - target_z) > EPSILON) |
There was a problem hiding this comment.
Here's a small suggestion: the action of descending the z-height should more reasonably be placed after the two lines (xy travel)
_"for (size_t i = 1; i < travel.size(); ++i)
gcode += m_writer.travel_to_xy(this->point_to_gcode(travel.points[i]), comment, use_short_travel_accel);"
(line 7728 below)
This is to ensure that the xy travel is performed at a higher height, and printing starts directly after descending, reducing the possibility of being scratched by the warped edges.
|
Hello, thank you for your contribution. |
Move the XY travel loop ahead of the target-Z calculation and the Z restoration, so the toolhead completes its horizontal move before descending rather than dropping to the layer Z first. This is the ordering the review asked for and keeps the descent from happening far from the resume point. clang-format reports no violations on the file.
|
You were right about the ordering, and it is fixed in 5ebea7f. The XY travel loop now runs before the target-Z calculation and the Z restoration, so the toolhead finishes its horizontal move and only then descends, instead of dropping to the layer Z first and travelling at that height. It is a two-line reorder in |
Diatom-Bambu
left a comment
There was a problem hiding this comment.
thanks for your fixing
Summary
Update the spiral-vase path in
GCode::travel_toto restore the writer to the requested/nominal layer Z when an earlier tool change or injected G-code left it at a different height, then retain the existing XY-only travel behavior once Z is correct. Base the decision on the generator's tracked position and the travel's target Z rather than on X2D-specific commands, raft counts, or a hard-coded clearance value, so other custom tool-change sequences receive the same correction. Preserve the no-extra-Z-move behavior for ordinary spiral layers where the tracked and nominal heights already agree, avoiding changes to seam blending and spiral interpolation.Test plan
max_layer_z + 3; verify the first model extrusion after the raft is at the nominal first-object-layer Z.Why
On an X2D print that uses an auxiliary filament for a two-layer raft and the main filament for a spiral-vase object, the first object extrusion is emitted roughly ten layers above its intended position. The raft-to-object filament change runs custom machine G-code that may finish at a clearance Z such as
max_layer_z + 3, and the generator records that external Z position. The spiral-vase branch ofGCode::travel_tothen emits only an XY travel, unlike the normal branch that travels in XYZ, so it does not restore the nominal object-layer Z before extrusion. The issue is limited to the interaction between raft-driven tool changes, externally moved Z, and spiral-vase travel behavior; ordinary spiral interpolation and the X2D profile template should remain unchanged.Closes #11961