ENH: add back infill anchor for special case

These two settings is necessary for some
specific user case.

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: I9d70679932ac90c34296393d0e8bb8aebd8ebe48
This commit is contained in:
salt.wei 2023-05-29 10:15:57 +08:00 committed by Lane.Wei
parent 030275a5a1
commit 3ea602091e
10 changed files with 79 additions and 15 deletions

View file

@ -1571,6 +1571,62 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
auto def_infill_anchor_min = def = this->add("sparse_infill_anchor", coFloatOrPercent);
def->label = L("Length of sparse infill anchor");
def->category = L("Strength");
def->tooltip = L("Connect a sparse infill line to an internal perimeter with a short segment of an additional perimeter. "
"If expressed as percentage (example: 15%) it is calculated over sparse infill line width. "
"Slicer tries to connect two close infill lines to a short perimeter segment. If no such perimeter segment "
"shorter than infill_anchor_max is found, the infill line is connected to a perimeter segment at just one side "
"and the length of the perimeter segment taken is limited to this parameter, but no longer than anchor_length_max. "
"Set this parameter to zero to disable anchoring perimeters connected to a single infill line.");
def->sidetext = L("mm or %");
def->ratio_over = "sparse_infill_line_width";
def->max_literal = 1000;
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->enum_values.push_back("0");
def->enum_values.push_back("1");
def->enum_values.push_back("2");
def->enum_values.push_back("5");
def->enum_values.push_back("10");
def->enum_values.push_back("1000");
def->enum_labels.push_back(L("0 (no open anchors)"));
def->enum_labels.push_back("1 mm");
def->enum_labels.push_back("2 mm");
def->enum_labels.push_back("5 mm");
def->enum_labels.push_back("10 mm");
def->enum_labels.push_back(L("1000 (unlimited)"));
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloatOrPercent(400, true));
def = this->add("sparse_infill_anchor_max", coFloatOrPercent);
def->label = L("Maximum length of sparse infill anchor");
def->category = def_infill_anchor_min->category;
def->tooltip = L("Connect a sparse infill line to an internal perimeter with a short segment of an additional perimeter. "
"If expressed as percentage (example: 15%) it is calculated over sparse infill line width. "
"Slicer tries to connect two close infill lines to a short perimeter segment. If no such perimeter segment "
"shorter than this parameter is found, the infill line is connected to a perimeter segment at just one side "
"and the length of the perimeter segment taken is limited to infill_anchor, but no longer than this parameter. "
"Set this parameter to zero to disable anchoring.");
def->sidetext = def_infill_anchor_min->sidetext;
def->ratio_over = def_infill_anchor_min->ratio_over;
def->max_literal = def_infill_anchor_min->max_literal;
def->gui_type = def_infill_anchor_min->gui_type;
def->enum_values.push_back("0");
def->enum_values.push_back("1");
def->enum_values.push_back("2");
def->enum_values.push_back("5");
def->enum_values.push_back("10");
def->enum_values.push_back("1000");
def->enum_labels.push_back(L("0 (not anchored)"));
def->enum_labels.push_back("1 mm");
def->enum_labels.push_back("2 mm");
def->enum_labels.push_back("5 mm");
def->enum_labels.push_back("10 mm");
def->enum_labels.push_back(L("1000 (unlimited)"));
def->mode = def_infill_anchor_min->mode;
def->set_default_value(new ConfigOptionFloatOrPercent(20, false));
def = this->add("sparse_infill_filament", coInt);
def->label = L("Infill");
def->category = L("Extruders");
@ -3935,6 +3991,10 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
value = "tree(auto)";
} else if (opt_key == "support_base_pattern" && value == "none") {
value = "hollow";
} else if (opt_key == "infill_anchor") {
opt_key = "sparse_infill_anchor";
} else if (opt_key == "infill_anchor_max") {
opt_key = "sparse_infill_anchor_max";
} else if (opt_key == "different_settings_to_system") {
std::string copy_value = value;
copy_value.erase(std::remove(copy_value.begin(), copy_value.end(), '\"'), copy_value.end()); // remove '"' in string