From 3006b163d0924c0adf9d8749d1b033b99c78983e Mon Sep 17 00:00:00 2001 From: "xun.zhang" Date: Thu, 18 Apr 2024 16:57:16 +0800 Subject: [PATCH] FIX: always have 0th filament in ams mapping 1. Only set the filament id in map when flush length is not 0 jira:NEW Signed-off-by: xun.zhang Change-Id: I6e0aeaf010f6e6dcbdc3bca5c0034aa60750bb67 --- src/libslic3r/GCode/GCodeProcessor.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index eb704142c..5594559f6 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -807,15 +807,17 @@ void GCodeProcessor::UsedFilaments::process_support_cache(GCodeProcessor* proces void GCodeProcessor::UsedFilaments::update_flush_per_filament(size_t extrude_id, float flush_volume) { - if (flush_per_filament.find(extrude_id) != flush_per_filament.end()) - flush_per_filament[extrude_id] += flush_volume; - else - flush_per_filament[extrude_id] = flush_volume; + if (flush_volume != 0.f) { + if (flush_per_filament.find(extrude_id) != flush_per_filament.end()) + flush_per_filament[extrude_id] += flush_volume; + else + flush_per_filament[extrude_id] = flush_volume; - if (total_volumes_per_extruder.find(extrude_id) != total_volumes_per_extruder.end()) - total_volumes_per_extruder[extrude_id] += flush_volume; - else - total_volumes_per_extruder[extrude_id] = flush_volume; + if (total_volumes_per_extruder.find(extrude_id) != total_volumes_per_extruder.end()) + total_volumes_per_extruder[extrude_id] += flush_volume; + else + total_volumes_per_extruder[extrude_id] = flush_volume; + } } void GCodeProcessor::UsedFilaments::process_role_cache(GCodeProcessor* processor)