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;
}

View File

@ -1080,7 +1080,7 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
break;
auto &entities = this_support_layer->support_fills.entities;
if (support_overriddable && !is_support_overridden(object)) {
if (support_overriddable && !is_support_overridden(object) && !(object_config.support_interface_not_for_body.value && !support_intf_overriddable &&(new_extruder==object_config.support_interface_filament-1||old_extruder==object_config.support_interface_filament-1))) {
set_support_extruder_override(object, copy, new_extruder, num_of_copies);
for (const ExtrusionEntity* ee : entities) {
if (ee->role() == erSupportMaterial || ee->role() == erSupportTransition)

View File

@ -813,7 +813,7 @@ static std::vector<std::string> s_Preset_print_options {
"support_top_z_distance", "support_on_build_plate_only","support_critical_regions_only", "support_remove_small_overhang",
"bridge_no_support", "thick_bridges", "max_bridge_length", "print_sequence",
"filename_format", "wall_filament", "support_bottom_z_distance",
"sparse_infill_filament", "solid_infill_filament", "support_filament", "support_interface_filament",
"sparse_infill_filament", "solid_infill_filament", "support_filament", "support_interface_filament","support_interface_not_for_body",
"ooze_prevention", "standby_temperature_delta", "interface_shells", "line_width", "initial_layer_line_width",
"inner_wall_line_width", "outer_wall_line_width", "sparse_infill_line_width", "internal_solid_infill_line_width",
"top_surface_line_width", "support_line_width", "infill_wall_overlap", "bridge_flow",

View File

@ -3013,6 +3013,13 @@ void PrintConfigDef::init_fff_params()
def->mode = comSimple;
def->set_default_value(new ConfigOptionInt(1));
def = this->add("support_interface_not_for_body",coBool);
def->label = L("No interface filament for body");
def->category = L("Support");
def->tooltip = L("Don't use support interface filament to print support body");
def->mode = comSimple;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("support_line_width", coFloat);
def->label = L("Support");
def->category = L("Quality");

View File

@ -700,6 +700,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionInt, enforce_support_layers))
((ConfigOptionInt, support_filament))
((ConfigOptionFloat, support_line_width))
((ConfigOptionBool, support_interface_not_for_body))
((ConfigOptionBool, support_interface_loop_pattern))
((ConfigOptionInt, support_interface_filament))
((ConfigOptionInt, support_interface_top_layers))

View File

@ -773,6 +773,7 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "support_interface_pattern"
|| opt_key == "support_interface_loop_pattern"
|| opt_key == "support_interface_filament"
|| opt_key == "support_interface_not_for_body"
|| opt_key == "support_interface_spacing"
|| opt_key == "support_bottom_interface_spacing" //BBS
|| opt_key == "support_base_pattern"

View File

@ -610,7 +610,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
"bridge_no_support", "max_bridge_length", "support_top_z_distance", "support_bottom_z_distance",
//BBS: add more support params to dependent of enable_support
"support_type", "support_on_build_plate_only",
"support_remove_small_overhang",
"support_remove_small_overhang","support_interface_not_for_body",
"support_object_xy_distance"/*, "independent_support_layer_height"*/})
toggle_field(el, have_support_material);
toggle_field("support_threshold_angle", have_support_material && is_auto(support_type));
@ -676,6 +676,8 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
toggle_line("flush_into_objects", !is_global_config);
toggle_line("support_interface_not_for_body",config->opt_int("support_interface_filament"));
bool has_fuzzy_skin = (config->opt_enum<FuzzySkinType>("fuzzy_skin") != FuzzySkinType::None);
for (auto el : { "fuzzy_skin_thickness", "fuzzy_skin_point_distance"})
toggle_line(el, has_fuzzy_skin);

View File

@ -2017,6 +2017,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Support filament"), L"param_support_filament");
optgroup->append_single_option_line("support_filament", "support#support-filament");
optgroup->append_single_option_line("support_interface_filament", "support#support-filament");
optgroup->append_single_option_line("support_interface_not_for_body", "support#support-filament");
//optgroup = page->new_optgroup(L("Options for support material and raft"));