mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-30 05:17:19 +00:00
Floating final purge line fix (#14416)
This commit is contained in:
@@ -1845,7 +1845,7 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
|
|||||||
std::string WipeTowerIntegration::finalize(GCode &gcodegen)
|
std::string WipeTowerIntegration::finalize(GCode &gcodegen)
|
||||||
{
|
{
|
||||||
std::string gcode;
|
std::string gcode;
|
||||||
if (gcodegen.wipe_tower_type() == WipeTowerType::Type2) {
|
if (gcodegen.wipe_tower_type() == WipeTowerType::Type2 && !m_final_purge.gcode.empty()) {
|
||||||
if (std::abs(gcodegen.writer().get_position().z() - m_final_purge.print_z) > EPSILON)
|
if (std::abs(gcodegen.writer().get_position().z() - m_final_purge.print_z) > EPSILON)
|
||||||
gcode += gcodegen.change_layer(m_final_purge.print_z);
|
gcode += gcodegen.change_layer(m_final_purge.print_z);
|
||||||
gcode += append_tcr2(gcodegen, m_final_purge, -1);
|
gcode += append_tcr2(gcodegen, m_final_purge, -1);
|
||||||
|
|||||||
@@ -4126,6 +4126,7 @@ void Print::_make_wipe_tower()
|
|||||||
|
|
||||||
// Unload the current filament over the purge tower.
|
// Unload the current filament over the purge tower.
|
||||||
coordf_t layer_height = m_objects.front()->config().layer_height.value;
|
coordf_t layer_height = m_objects.front()->config().layer_height.value;
|
||||||
|
bool generate_final_purge = true;
|
||||||
if (m_wipe_tower_data.tool_ordering.back().wipe_tower_partitions > 0) {
|
if (m_wipe_tower_data.tool_ordering.back().wipe_tower_partitions > 0) {
|
||||||
// The wipe tower goes up to the last layer of the print.
|
// The wipe tower goes up to the last layer of the print.
|
||||||
if (wipe_tower.layer_finished()) {
|
if (wipe_tower.layer_finished()) {
|
||||||
@@ -4137,11 +4138,14 @@ void Print::_make_wipe_tower()
|
|||||||
// There is yet enough space at this layer of the wipe tower for the final purge.
|
// There is yet enough space at this layer of the wipe tower for the final purge.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The wipe tower does not reach the last print layer, perform the pruge at the last print layer.
|
// The wipe tower does not reach the last print layer.
|
||||||
|
// Skip final purge to avoid generating purge lines in mid-air.
|
||||||
assert(m_wipe_tower_data.tool_ordering.back().wipe_tower_partitions == 0);
|
assert(m_wipe_tower_data.tool_ordering.back().wipe_tower_partitions == 0);
|
||||||
wipe_tower.set_layer(float(m_wipe_tower_data.tool_ordering.back().print_z), float(layer_height), 0, false, true);
|
generate_final_purge = false;
|
||||||
}
|
}
|
||||||
m_wipe_tower_data.final_purge = Slic3r::make_unique<WipeTower::ToolChangeResult>(wipe_tower.tool_change((unsigned int) (-1)));
|
m_wipe_tower_data.final_purge = generate_final_purge
|
||||||
|
? Slic3r::make_unique<WipeTower::ToolChangeResult>(wipe_tower.tool_change((unsigned int)(-1)))
|
||||||
|
: Slic3r::make_unique<WipeTower::ToolChangeResult>();
|
||||||
|
|
||||||
m_wipe_tower_data.used_filament = wipe_tower.get_used_filament();
|
m_wipe_tower_data.used_filament = wipe_tower.get_used_filament();
|
||||||
m_wipe_tower_data.number_of_toolchanges = wipe_tower.get_number_of_toolchanges();
|
m_wipe_tower_data.number_of_toolchanges = wipe_tower.get_number_of_toolchanges();
|
||||||
@@ -4237,6 +4241,7 @@ void Print::_make_wipe_tower()
|
|||||||
|
|
||||||
// Unload the current filament over the purge tower.
|
// Unload the current filament over the purge tower.
|
||||||
coordf_t layer_height = m_objects.front()->config().layer_height.value;
|
coordf_t layer_height = m_objects.front()->config().layer_height.value;
|
||||||
|
bool generate_final_purge = true;
|
||||||
if (m_wipe_tower_data.tool_ordering.back().wipe_tower_partitions > 0) {
|
if (m_wipe_tower_data.tool_ordering.back().wipe_tower_partitions > 0) {
|
||||||
// The wipe tower goes up to the last layer of the print.
|
// The wipe tower goes up to the last layer of the print.
|
||||||
if (wipe_tower.layer_finished()) {
|
if (wipe_tower.layer_finished()) {
|
||||||
@@ -4248,11 +4253,14 @@ void Print::_make_wipe_tower()
|
|||||||
// There is yet enough space at this layer of the wipe tower for the final purge.
|
// There is yet enough space at this layer of the wipe tower for the final purge.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The wipe tower does not reach the last print layer, perform the pruge at the last print layer.
|
// The wipe tower does not reach the last print layer.
|
||||||
|
// Skip final purge to avoid generating purge lines in mid-air.
|
||||||
assert(m_wipe_tower_data.tool_ordering.back().wipe_tower_partitions == 0);
|
assert(m_wipe_tower_data.tool_ordering.back().wipe_tower_partitions == 0);
|
||||||
wipe_tower.set_layer(float(m_wipe_tower_data.tool_ordering.back().print_z), float(layer_height), 0, false, true);
|
generate_final_purge = false;
|
||||||
}
|
}
|
||||||
m_wipe_tower_data.final_purge = Slic3r::make_unique<WipeTower::ToolChangeResult>(wipe_tower.tool_change((unsigned int) (-1)));
|
m_wipe_tower_data.final_purge = generate_final_purge
|
||||||
|
? Slic3r::make_unique<WipeTower::ToolChangeResult>(wipe_tower.tool_change((unsigned int)(-1)))
|
||||||
|
: Slic3r::make_unique<WipeTower::ToolChangeResult>();
|
||||||
|
|
||||||
m_wipe_tower_data.used_filament = wipe_tower.get_used_filament();
|
m_wipe_tower_data.used_filament = wipe_tower.get_used_filament();
|
||||||
m_wipe_tower_data.number_of_toolchanges = wipe_tower.get_number_of_toolchanges();
|
m_wipe_tower_data.number_of_toolchanges = wipe_tower.get_number_of_toolchanges();
|
||||||
|
|||||||
Reference in New Issue
Block a user