FIX: unable to map if filament not used in model

1.Fix filament can not map if it's not used in model body

jira:NEW

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Ibd2685ffd198b2e17dbf44289d0144b5b7c25788
This commit is contained in:
xun.zhang 2024-04-10 14:50:34 +08:00 committed by Lane.Wei
parent b40cf28a83
commit 7ee6e62ec4
3 changed files with 32 additions and 19 deletions

View File

@ -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())

View File

@ -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);

View File

@ -1636,11 +1636,19 @@ std::vector<int> PartPlate::get_used_extruders()
if (!result)
return used_extruders;
std::set<int> 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