FIX: prime tower start position is incorrect

when support material is used in first tool change

Change-Id: If06459b8404fd599b42187859f476efded57deba
(cherry picked from commit 71f9ed69a3eff4cf3139d04a76176f798a1e1e0d)
This commit is contained in:
zhimin.zeng 2022-11-07 18:50:07 +08:00 committed by Lane.Wei
parent 118a13200b
commit 82325973f8
2 changed files with 13 additions and 3 deletions

View file

@ -660,7 +660,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTower::prime(
return std::vector<ToolChangeResult>(); 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; size_t old_tool = m_current_tool;
@ -729,6 +729,12 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_per
writer.rectangle(wt_box); writer.rectangle(wt_box);
writer.travel(initial_position); 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. toolchange_Wipe(writer, cleaning_box, wipe_length); // Wipe the newly loaded filament until the end of the assigned wipe area.
++ m_num_tool_changes; ++ m_num_tool_changes;
} else } else
@ -1514,9 +1520,13 @@ void WipeTower::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &
finish_layer_tcr = finish_layer(false, layer.extruder_fill); finish_layer_tcr = finish_layer(false, layer.extruder_fill);
} }
else { else {
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)); layer_result.emplace_back(tool_change(layer.tool_changes[i].new_tool));
} }
} }
}
if (layer_result.empty()) { if (layer_result.empty()) {
// there is nothing to merge finish_layer with // there is nothing to merge finish_layer with

View file

@ -217,7 +217,7 @@ public:
// Returns gcode for a toolchange and a final print head position. // Returns gcode for a toolchange and a final print head position.
// On the first layer, extrude a brim around the future wipe tower first. // On the first layer, extrude a brim around the future wipe tower first.
// BBS // 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. // Fill the unfilled space with a sparse infill.
// Call this method only if layer_finished() is false. // Call this method only if layer_finished() is false.