mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-30 21:02:02 +08:00
Fix layer change travel if no sparse layers is enabled
This commit is contained in:
parent
2cac8c2c37
commit
33bafd28e3
@ -540,7 +540,8 @@ std::vector<ExtruderExtrusions> get_extrusions(
|
||||
if (layer_tools.has_wipe_tower && wipe_tower != nullptr) {
|
||||
const bool finish_wipe_tower{extruder_id == layer_tools.extruders.back()};
|
||||
if (finish_wipe_tower || is_toolchange_required(is_first_layer, layer_tools.extruders.back(), extruder_id, current_extruder_id)) {
|
||||
if (const auto tool_change{wipe_tower->get_toolchange(toolchange_number)}) {
|
||||
const bool ignore_sparse{print.config().wipe_tower_no_sparse_layers.value};
|
||||
if (const auto tool_change{wipe_tower->get_toolchange(toolchange_number, ignore_sparse)}) {
|
||||
toolchange_number++;
|
||||
previous_position = Point::new_scale(wipe_tower->transform_wt_pt(tool_change->end_pos));
|
||||
current_extruder_id = tool_change->new_tool;
|
||||
|
@ -42,10 +42,23 @@ public:
|
||||
std::string tool_change(GCodeGenerator &gcodegen, int extruder_id, bool finish_layer);
|
||||
std::string finalize(GCodeGenerator &gcodegen);
|
||||
std::vector<float> used_filament_length() const;
|
||||
std::optional<WipeTower::ToolChangeResult> get_toolchange(std::size_t index) const {
|
||||
std::optional<WipeTower::ToolChangeResult> get_toolchange(std::size_t index, bool ignore_sparse) const {
|
||||
if (m_layer_idx >= m_tool_changes.size()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
if(
|
||||
ignore_sparse
|
||||
&& m_tool_changes.at(m_layer_idx).size() == 1
|
||||
&& (
|
||||
m_tool_changes.at(m_layer_idx).front().initial_tool
|
||||
== m_tool_changes.at(m_layer_idx).front().new_tool
|
||||
)
|
||||
&& m_layer_idx != 0
|
||||
) {
|
||||
// Ignore sparse
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return m_tool_changes.at(m_layer_idx).at(index);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user