ENH:support interface filament not for body option

1. Add a option to prevent support interface filament being used in
support body

jira:STUDIO-4847

Change-Id: Ic6e9f663b71a7e4d9cd1bca399c0da2ce22bb5b5
Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
This commit is contained in:
xun.zhang
2023-10-23 17:59:01 +08:00
committed by Lane.Wei
parent 276aec19c2
commit 9719fa81ef
8 changed files with 43 additions and 3 deletions

View File

@@ -3067,6 +3067,27 @@ GCode::LayerResult GCode::process_layer(
Skirt::make_skirt_loops_per_extruder_1st_layer(print, layer_tools, m_skirt_done) :
Skirt::make_skirt_loops_per_extruder_other_layers(print, layer_tools, m_skirt_done);
// BBS: get next extruder according to flush and soluble
auto get_next_extruder = [&](int current_extruder,const std::vector<unsigned int>&extruders) {
std::vector<float> flush_matrix(cast<float>(m_config.flush_volumes_matrix.values));
const unsigned int number_of_extruders = (unsigned int)(sqrt(flush_matrix.size()) + EPSILON);
// Extract purging volumes for each extruder pair:
std::vector<std::vector<float>> wipe_volumes;
for (unsigned int i = 0; i < number_of_extruders; ++i)
wipe_volumes.push_back(std::vector<float>(flush_matrix.begin() + i * number_of_extruders, flush_matrix.begin() + (i + 1) * number_of_extruders));
unsigned int next_extruder = current_extruder;
float min_flush = std::numeric_limits<float>::max();
for (auto extruder_id : extruders) {
if (print.config().filament_soluble.get_at(extruder_id) || extruder_id == current_extruder)
continue;
if (wipe_volumes[current_extruder][extruder_id] < min_flush) {
next_extruder = extruder_id;
min_flush = wipe_volumes[current_extruder][extruder_id];
}
}
return next_extruder;
};
// Group extrusions by an extruder, then by an object, an island and a region.
std::map<unsigned int, std::vector<ObjectByExtruder>> by_extruder;
bool is_anything_overridden = const_cast<LayerTools&>(layer_tools).wiping_extrusions().is_anything_overridden();
@@ -3119,6 +3140,13 @@ GCode::LayerResult GCode::process_layer(
break;
}
//BBS: not found a suitable extruder in current layer ,dontcare_extruider==first_extruder_id==interface_extruder
if (dontcare_extruder == interface_extruder && object.config().support_interface_not_for_body) {
// BBS : get a suitable extruder from other layer
auto all_extruders = print.extruders();
dontcare_extruder = get_next_extruder(dontcare_extruder, all_extruders);
}
if (support_dontcare)
support_extruder = dontcare_extruder;
}