Skip to content

Commit

Permalink
FIX: prime tower start position is incorrect
Browse files Browse the repository at this point in the history
 when support material is used in first tool change

Change-Id: If06459b8404fd599b42187859f476efded57deba
(cherry picked from commit 71f9ed69a3eff4cf3139d04a76176f798a1e1e0d)
  • Loading branch information
zhimin-zeng-bambulab authored and lanewei120 committed Dec 15, 2022
1 parent 118a132 commit 8232597
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src/libslic3r/GCode/WipeTower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTower::prime(
return std::vector<ToolChangeResult>();
}

WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_perimeter)
WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_perimeter, bool first_toolchange_to_nonsoluble)
{
size_t old_tool = m_current_tool;

Expand Down Expand Up @@ -729,6 +729,12 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_per
writer.rectangle(wt_box);
writer.travel(initial_position);
}

if (first_toolchange_to_nonsoluble) {
writer.travel(Vec2f(0, 0));
writer.travel(initial_position);
}

toolchange_Wipe(writer, cleaning_box, wipe_length); // Wipe the newly loaded filament until the end of the assigned wipe area.
++ m_num_tool_changes;
} else
Expand Down Expand Up @@ -1514,7 +1520,11 @@ void WipeTower::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &
finish_layer_tcr = finish_layer(false, layer.extruder_fill);
}
else {
layer_result.emplace_back(tool_change(layer.tool_changes[i].new_tool));
if (idx == -1 && i == 0) {
layer_result.emplace_back(tool_change(layer.tool_changes[i].new_tool, false, true));
} else {
layer_result.emplace_back(tool_change(layer.tool_changes[i].new_tool));
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/GCode/WipeTower.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class WipeTower
// Returns gcode for a toolchange and a final print head position.
// On the first layer, extrude a brim around the future wipe tower first.
// BBS
ToolChangeResult tool_change(size_t new_tool, bool extrude_perimeter = false);
ToolChangeResult tool_change(size_t new_tool, bool extrude_perimeter = false, bool first_toolchange_to_nonsoluble = false);

// Fill the unfilled space with a sparse infill.
// Call this method only if layer_finished() is false.
Expand Down

0 comments on commit 8232597

Please sign in to comment.