From ec2e783615be2afc10fd66d45a9b32f2030d9292 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Wed, 14 Sep 2022 10:02:39 +0200 Subject: [PATCH] Fixed GCodeViewer to take care of parking volume when calculating used filament (similar as in PrusaSlicer) --- src/libslic3r/GCode/GCodeProcessor.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 96d2af236..3c773c89a 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1094,6 +1094,20 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config) } } + // With MM setups like Prusa MMU2, the filaments may be expected to be parked at the beginning. + // Remember the parking position so the initial load is not included in filament estimate. + const ConfigOptionBool* single_extruder_multi_material = config.option("single_extruder_multi_material"); + const ConfigOptionBool* wipe_tower = config.option("wipe_tower"); + const ConfigOptionFloat* parking_pos_retraction = config.option("parking_pos_retraction"); + const ConfigOptionFloat* extra_loading_move = config.option("extra_loading_move"); + + if (single_extruder_multi_material != nullptr && wipe_tower != nullptr && parking_pos_retraction != nullptr && extra_loading_move != nullptr) { + if (single_extruder_multi_material->value && m_result.extruders_count > 1 && wipe_tower->value) { + m_parking_position = float(parking_pos_retraction->value); + m_extra_loading_move = float(extra_loading_move->value); + } + } + bool use_machine_limits = false; const ConfigOptionEnum* machine_limits_usage = config.option>("machine_limits_usage"); if (machine_limits_usage != nullptr)