NEW: add new tree support style "Tree Slim"

1. Add a new style "Tree Slim". If enabled, tree
support branches are merged more aggressively, and the support volume
is minimized.
2. Enable support style, add back Snug for normal support.
3. Remove hybrid(auto) type and use "Tree Hybrid" style to represent it.
4. Fix a bug in plan_layer_heights that may generate empty layers when
   layer height is set to 0.3mm.
5. Fix a bug where no raft is generated if there is no overhang.
6. Fix the bug where no bottom interface or bottom gap is generated when
   tree slim is selected.
7. Use physical distance to calc radius

Change-Id: Iacd57018ae5496cdc9acd28551c44d1c88c53fe0
This commit is contained in:
Arthur 2022-12-07 20:32:33 +08:00 committed by Lane.Wei
parent 51deb70f64
commit 29dbc77e91
16 changed files with 471 additions and 243 deletions

View file

@ -177,8 +177,12 @@ static t_config_enum_values s_keys_map_SupportMaterialPattern {
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SupportMaterialPattern)
static t_config_enum_values s_keys_map_SupportMaterialStyle {
{ "default", smsDefault },
{ "grid", smsGrid },
{ "snug", smsSnug }
{ "snug", smsSnug },
{ "tree_slim", smsTreeSlim },
{ "tree_strong", smsTreeStrong },
{ "tree_hybrid", smsTreeHybrid }
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SupportMaterialStyle)
@ -192,7 +196,6 @@ CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SupportMaterialInterfacePattern)
static t_config_enum_values s_keys_map_SupportType{
{ "normal(auto)", stNormalAuto },
{ "tree(auto)", stTreeAuto },
{ "hybrid(auto)", stHybridAuto },
{ "normal(manual)", stNormal },
{ "tree(manual)", stTree }
};
@ -2369,16 +2372,14 @@ void PrintConfigDef::init_fff_params()
def->label = L("Type");
def->category = L("Support");
def->tooltip = L("normal(auto) and tree(auto) is used to generate support automatically. "
"If normal or tree is selected, only support enforcers are generated");
"If normal(manual) or tree(manual) is selected, only support enforcers are generated");
def->enum_keys_map = &ConfigOptionEnum<SupportType>::get_enum_values();
def->enum_values.push_back("normal(auto)");
def->enum_values.push_back("tree(auto)");
def->enum_values.push_back("hybrid(auto)");
def->enum_values.push_back("normal(manual)");
def->enum_values.push_back("tree(manual)");
def->enum_labels.push_back(L("normal(auto)"));
def->enum_labels.push_back(L("tree(auto)"));
def->enum_labels.push_back(L("hybrid(auto)"));
def->enum_labels.push_back(L("normal(manual)"));
def->enum_labels.push_back(L("tree(manual)"));
def->mode = comSimple;
@ -2417,7 +2418,7 @@ void PrintConfigDef::init_fff_params()
def->label = L("Support critical regions only");
def->category = L("Support");
def->tooltip = L("Only create support for critical regions including sharp tail, cantilever, etc.");
def->mode = comSimple;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
// BBS: change type to common float.
@ -2465,9 +2466,9 @@ void PrintConfigDef::init_fff_params()
def = this->add("support_filament", coInt);
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
def->label = L("Support");
def->label = L("Support base");
def->category = L("Support");
def->tooltip = L("Filament to print support and raft. \"Default\" means no specific filament for support and current filament is used");
def->tooltip = L("Filament to print support base and raft. \"Default\" means no specific filament for support and current filament is used");
def->min = 0;
def->mode = comSimple;
def->set_default_value(new ConfigOptionInt(1));
@ -2625,16 +2626,27 @@ void PrintConfigDef::init_fff_params()
def = this->add("support_style", coEnum);
def->label = L("Style");
def->category = L("Support");
//def->tooltip = L("Style and shape of the support towers. Projecting the supports into a regular grid "
// "will create more stable supports, while snug support towers will save material and reduce "
// "object scarring");
def->tooltip = L("Style and shape of the support. For normal support, projecting the supports into a regular grid "
"will create more stable supports (default), while snug support towers will save material and reduce "
"object scarring.\n"
"For tree support, tight style will merge branches more aggressively and save "
"a lot of material (default), while hybrid style will create similar structure to normal support "
"under large flat overhangs.");
def->enum_keys_map = &ConfigOptionEnum<SupportMaterialStyle>::get_enum_values();
def->enum_values.push_back("default");
def->enum_values.push_back("grid");
def->enum_values.push_back("snug");
def->enum_values.push_back("tree_slim");
def->enum_values.push_back("tree_strong");
def->enum_values.push_back("tree_hybrid");
def->enum_labels.push_back(L("Default"));
def->enum_labels.push_back(L("Grid"));
def->enum_labels.push_back(L("Snug"));
def->mode = comDevelop;
def->set_default_value(new ConfigOptionEnum<SupportMaterialStyle>(smsGrid));
def->enum_labels.push_back(L("Tree Slim"));
def->enum_labels.push_back(L("Tree Strong"));
def->enum_labels.push_back(L("Tree Hybrid"));
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<SupportMaterialStyle>(smsDefault));
def = this->add("independent_support_layer_height", coBool);
def->label = L("Independent support layer height");
@ -3816,6 +3828,8 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
value = "normal(manual)";
} else if (opt_key == "support_type" && value == "tree") {
value = "tree(manual)";
} else if (opt_key == "support_type" && value == "hybrid(auto)") {
value = "tree(auto)";
} 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