mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-09-16 01:53:15 +08:00
Fix SPE-2464: Always retract before layer change travel
If retrac_layer_change is not forced check if the retraction is needed otherwise always retract
This commit is contained in:
parent
2aab8f1245
commit
dba7c3baaa
@ -2969,26 +2969,28 @@ std::string GCodeGenerator::change_layer(
|
|||||||
&& this->m_config.travel_slope.get_at(extruder_id) > 0
|
&& this->m_config.travel_slope.get_at(extruder_id) > 0
|
||||||
&& this->m_config.travel_slope.get_at(extruder_id) < 90
|
&& this->m_config.travel_slope.get_at(extruder_id) < 90
|
||||||
);
|
);
|
||||||
if (do_ramping_layer_change) {
|
|
||||||
Vec3d from{to_3d(this->point_to_gcode(*this->last_position), previous_layer_z)};
|
|
||||||
const Vec3d to{to_3d(unscaled(first_point), print_z)};
|
|
||||||
const double travel_length{(to - from).norm()};
|
|
||||||
|
|
||||||
if (this->m_config.retract_before_travel.get_at(extruder_id) < travel_length) {
|
const Vec3d to{to_3d(unscaled(first_point), print_z)};
|
||||||
|
if (this->last_position && print_z > previous_layer_z && !EXTRUDER_CONFIG(retract_layer_change)) {
|
||||||
|
const Vec3d from{to_3d(this->point_to_gcode(*this->last_position), previous_layer_z)};
|
||||||
|
const Polyline xy_path{this->get_layer_change_xy_path(from, to)};
|
||||||
|
|
||||||
|
if (this->needs_retraction(xy_path, ExtrusionRole::Mixed)) {
|
||||||
|
gcode += this->retract_and_wipe();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
gcode += this->retract_and_wipe();
|
gcode += this->retract_and_wipe();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update from after wipe.
|
if (do_ramping_layer_change) {
|
||||||
from = to_3d(this->point_to_gcode(*this->last_position), previous_layer_z);
|
// Must be determined again after possible wipe.
|
||||||
|
const Vec3d from{to_3d(this->point_to_gcode(*this->last_position), previous_layer_z)};
|
||||||
|
|
||||||
gcode += this->get_ramping_layer_change_gcode(from, to, extruder_id);
|
gcode += this->get_ramping_layer_change_gcode(from, to, extruder_id);
|
||||||
|
|
||||||
this->writer().update_position(to);
|
this->writer().update_position(to);
|
||||||
this->last_position = this->gcode_to_point(unscaled(first_point));
|
this->last_position = this->gcode_to_point(unscaled(first_point));
|
||||||
} else {
|
} else {
|
||||||
if (EXTRUDER_CONFIG(retract_layer_change)) {
|
|
||||||
gcode += this->retract_and_wipe();
|
|
||||||
}
|
|
||||||
if (!first_layer) {
|
if (!first_layer) {
|
||||||
// travel_to_z is not used as it may not generate the travel if the writter z == print_z.
|
// travel_to_z is not used as it may not generate the travel if the writter z == print_z.
|
||||||
gcode += this->writer().get_travel_to_z_gcode(print_z, "simple layer change");
|
gcode += this->writer().get_travel_to_z_gcode(print_z, "simple layer change");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user