diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 651808bb8..918d6d549 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -723,6 +723,12 @@ void GCodeProcessor::UsedFilaments::reset() support_volume_per_extruder.clear(); } +void GCodeProcessor::UsedFilaments::increase_support_caches(double extruded_volume) +{ + support_volume_cache += extruded_volume; + role_cache += extruded_volume; +} + void GCodeProcessor::UsedFilaments::increase_model_caches(double extruded_volume) { color_change_cache += extruded_volume; @@ -768,6 +774,18 @@ void GCodeProcessor::UsedFilaments::process_wipe_tower_cache(GCodeProcessor* pro } } +void GCodeProcessor::UsedFilaments::process_support_cache(GCodeProcessor* processor) +{ + size_t active_extruder_id = processor->m_extruder_id; + if (support_volume_cache != 0.0f){ + if (support_volume_per_extruder.find(active_extruder_id) != support_volume_per_extruder.end()) + support_volume_per_extruder[active_extruder_id] += support_volume_cache; + else + support_volume_per_extruder[active_extruder_id] = support_volume_cache; + support_volume_cache = 0.0f; + } +} + 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()) diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 9a339244f..a0a6c4c68 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -511,27 +511,14 @@ namespace Slic3r { void reset(); - void increase_support_caches(double extruded_volume){ - support_volume_cache += extruded_volume; - role_cache += extruded_volume; - } - + void increase_support_caches(double extruded_volume); void increase_model_caches(double extruded_volume); void increase_wipe_tower_caches(double extruded_volume); void process_color_change_cache(); void process_model_cache(GCodeProcessor* processor); void process_wipe_tower_cache(GCodeProcessor* processor); - void process_support_cache(GCodeProcessor* processor){ - size_t active_extruder_id = processor->m_extruder_id; - if (support_volume_cache != 0.0f) { - if (support_volume_per_extruder.find(active_extruder_id) != support_volume_per_extruder.end()) - support_volume_per_extruder[active_extruder_id] += support_volume_cache; - else - support_volume_per_extruder[active_extruder_id] = support_volume_cache; - support_volume_cache = 0.0f; - } - } + void process_support_cache(GCodeProcessor* processor); void update_flush_per_filament(size_t extrude_id, float flush_length); void process_role_cache(GCodeProcessor* processor); diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index dd60fdbc6..e4dbba07e 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -1636,11 +1636,19 @@ std::vector PartPlate::get_used_extruders() if (!result) return used_extruders; + std::set used_extruders_set; PrintEstimatedStatistics& ps = result->print_statistics; - for (auto it = ps.volumes_per_extruder.begin(); it != ps.volumes_per_extruder.end(); it++) { - used_extruders.push_back(it->first + 1); - } - return used_extruders; + // model usage + for (const auto&item:ps.volumes_per_extruder) + used_extruders_set.emplace(item.first + 1); + // support usage + for (const auto&item:ps.support_volumes_per_extruder) + used_extruders_set.emplace(item.first + 1); + // wipe tower usage + for (const auto&item:ps.wipe_tower_volumes_per_extruder) + used_extruders_set.emplace(item.first + 1); + + return std::vector(used_extruders_set.begin(), used_extruders_set.end()); } Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double wipe_volume, int plate_extruder_size, bool use_global_objects) const