diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index f39857759..926cfd186 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3277,6 +3277,9 @@ void PrintConfigDef::init_sla_support_params(const std::string &prefix) { ConfigOptionDef* def; + constexpr const char * pretext_unavailable = L("Unavailable for this method.\n"); + std::string pretext; + def = this->add(prefix + "support_head_front_diameter", coFloat); def->label = L("Pinhead front diameter"); def->category = L("Supports"); @@ -3326,20 +3329,28 @@ void PrintConfigDef::init_sla_support_params(const std::string &prefix) def->mode = comExpert; def->set_default_value(new ConfigOptionPercent(50)); + pretext = ""; + if (prefix == "branching") + pretext = pretext_unavailable; + def = this->add(prefix + "support_max_bridges_on_pillar", coInt); def->label = L("Max bridges on a pillar"); - def->tooltip = L( + def->tooltip = pretext + L( "Maximum number of bridges that can be placed on a pillar. Bridges " "hold support point pinheads and connect to pillars as small branches."); def->min = 0; def->max = 50; def->mode = comExpert; - def->set_default_value(new ConfigOptionInt(3)); + def->set_default_value(new ConfigOptionInt(prefix == "branching" ? 2 : 3)); + + pretext = ""; + if (prefix.empty()) + pretext = pretext_unavailable; def = this->add(prefix + "support_max_weight_on_model", coFloat); def->label = L("Max weight on model"); def->category = L("Supports"); - def->tooltip = L( + def->tooltip = pretext + L( "Maximum weight of sub-trees that terminate on the model instead of the print bed. The weight is the sum of the lenghts of all " "branches emanating from the endpoint."); def->sidetext = L("mm"); @@ -3347,9 +3358,13 @@ void PrintConfigDef::init_sla_support_params(const std::string &prefix) def->mode = comExpert; def->set_default_value(new ConfigOptionFloat(10.)); + pretext = ""; + if (prefix == "branching") + pretext = pretext_unavailable; + def = this->add(prefix + "support_pillar_connection_mode", coEnum); def->label = L("Pillar connection mode"); - def->tooltip = L("Controls the bridge type between two neighboring pillars." + def->tooltip = pretext + L("Controls the bridge type between two neighboring pillars." " Can be zig-zag, cross (double zig-zag) or dynamic which" " will automatically switch between the first two depending" " on the distance of the two pillars."); @@ -3373,12 +3388,16 @@ void PrintConfigDef::init_sla_support_params(const std::string &prefix) def = this->add(prefix + "support_pillar_widening_factor", coFloat); def->label = L("Pillar widening factor"); def->category = L("Supports"); - def->tooltip = L( - "Merging bridges or pillars into another pillars can " + + pretext = ""; + if (prefix.empty()) + pretext = pretext_unavailable; + + def->tooltip = pretext + + L("Merging bridges or pillars into another pillars can " "increase the radius. Zero means no increase, one means " "full increase. The exact amount of increase is unspecified and can " - "change in the future. What is garanteed is that thickness will not " - "exceed \"support_base_diameter\""); + "change in the future."); def->min = 0; def->max = 1; @@ -3434,13 +3453,22 @@ void PrintConfigDef::init_sla_support_params(const std::string &prefix) def->sidetext = L("mm"); def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(15.0)); + + double default_val = 15.0; + if (prefix == "branching") + default_val = 5.0; + + def->set_default_value(new ConfigOptionFloat(default_val)); + + pretext = ""; + if (prefix == "branching") + pretext = pretext_unavailable; def = this->add(prefix + "support_max_pillar_link_distance", coFloat); def->label = L("Max pillar linking distance"); def->category = L("Supports"); - def->tooltip = L("The max distance of two pillars to get linked with each other." - " A zero value will prohibit pillar cascading."); + def->tooltip = pretext + L("The max distance of two pillars to get linked with each other." + " A zero value will prohibit pillar cascading."); def->sidetext = L("mm"); def->min = 0; // 0 means no linking def->mode = comAdvanced; @@ -3801,7 +3829,7 @@ void PrintConfigDef::init_sla_params() def->enum_labels[0] = L("Default"); def->enum_labels[1] = L("Branching"); // TODO: def->enum_labels[2] = L("Organic"); - def->mode = comAdvanced; + def->mode = comSimple; def->set_default_value(new ConfigOptionEnum(sla::SupportTreeType::Default)); init_sla_support_params(""); diff --git a/src/libslic3r/libslic3r.h b/src/libslic3r/libslic3r.h index d5a21cf21..79945867b 100644 --- a/src/libslic3r/libslic3r.h +++ b/src/libslic3r/libslic3r.h @@ -380,6 +380,8 @@ inline IntegerOnly fast_round_up(double a) return a == 0.49999999999999994 ? I(0) : I(floor(a + 0.5)); } +template using SamePair = std::pair; + } // namespace Slic3r #endif // _libslic3r_h_ diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 9dd854029..85fe3e53e 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -390,29 +390,28 @@ void ConfigManipulation::toggle_print_sla_options(DynamicPrintConfig* config) toggle_field("support_critical_angle", supports_en && is_default_tree); toggle_field("support_max_bridge_length", supports_en && is_default_tree); toggle_field("support_max_pillar_link_distance", supports_en && is_default_tree); - toggle_field("support_pillar_widening_factor", supports_en && is_default_tree); - toggle_field("support_max_weight_on_model", supports_en && is_default_tree); - toggle_field("support_points_density_relative", supports_en && is_default_tree); - toggle_field("support_points_minimal_distance", supports_en && is_default_tree); + toggle_field("support_pillar_widening_factor", false); + toggle_field("support_max_weight_on_model", false); toggle_field("branchingsupport_head_front_diameter", supports_en && is_branching_tree); toggle_field("branchingsupport_head_penetration", supports_en && is_branching_tree); toggle_field("branchingsupport_head_width", supports_en && is_branching_tree); toggle_field("branchingsupport_pillar_diameter", supports_en && is_branching_tree); toggle_field("branchingsupport_small_pillar_diameter_percent", supports_en && is_branching_tree); - toggle_field("branchingsupport_max_bridges_on_pillar", supports_en && is_branching_tree); - toggle_field("branchingsupport_pillar_connection_mode", supports_en && is_branching_tree); + toggle_field("branchingsupport_max_bridges_on_pillar", false); + toggle_field("branchingsupport_pillar_connection_mode", false); toggle_field("branchingsupport_buildplate_only", supports_en && is_branching_tree); toggle_field("branchingsupport_base_diameter", supports_en && is_branching_tree); toggle_field("branchingsupport_base_height", supports_en && is_branching_tree); toggle_field("branchingsupport_base_safety_distance", supports_en && is_branching_tree); toggle_field("branchingsupport_critical_angle", supports_en && is_branching_tree); toggle_field("branchingsupport_max_bridge_length", supports_en && is_branching_tree); - toggle_field("branchingsupport_max_pillar_link_distance", supports_en && is_branching_tree); + toggle_field("branchingsupport_max_pillar_link_distance", false); toggle_field("branchingsupport_pillar_widening_factor", supports_en && is_branching_tree); toggle_field("branchingsupport_max_weight_on_model", supports_en && is_branching_tree); - toggle_field("branchingsupport_points_density_relative", supports_en && is_branching_tree); - toggle_field("branchingsupport_points_minimal_distance", supports_en && is_branching_tree); + + toggle_field("support_points_density_relative", supports_en); + toggle_field("support_points_minimal_distance", supports_en); bool pad_en = config->opt_bool("pad_enable"); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 60742dd4d..481b16222 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -4821,29 +4821,46 @@ void TabSLAMaterial::update() wxGetApp().mainframe->on_config_changed(m_config); } -void TabSLAPrint::build_sla_support_params(const std::string &prefix, +static void add_options_into_line(ConfigOptionsGroupShp &optgroup, + const std::vector> &prefixes, + const std::string &optkey) +{ + auto opt = optgroup->get_option(prefixes.front().first + optkey); + Line line{ opt.opt.label, "" }; + line.full_width = 1; + for (auto &prefix : prefixes) { + opt = optgroup->get_option(prefix.first + optkey); + opt.opt.label = prefix.second; + opt.opt.width = 12; // TODO + line.append_option(opt); + } + optgroup->append_line(line); +} + +void TabSLAPrint::build_sla_support_params(const std::vector> &prefixes, const Slic3r::GUI::PageShp &page) { + auto optgroup = page->new_optgroup(L("Support head")); - optgroup->append_single_option_line(prefix + "support_head_front_diameter"); - optgroup->append_single_option_line(prefix + "support_head_penetration"); - optgroup->append_single_option_line(prefix + "support_head_width"); + add_options_into_line(optgroup, prefixes, "support_head_front_diameter"); + add_options_into_line(optgroup, prefixes, "support_head_penetration"); + add_options_into_line(optgroup, prefixes, "support_head_width"); optgroup = page->new_optgroup(L("Support pillar")); - optgroup->append_single_option_line(prefix + "support_pillar_diameter"); - optgroup->append_single_option_line(prefix + "support_small_pillar_diameter_percent"); - optgroup->append_single_option_line(prefix + "support_max_bridges_on_pillar"); + add_options_into_line(optgroup, prefixes, "support_pillar_diameter"); + add_options_into_line(optgroup, prefixes, "support_small_pillar_diameter_percent"); + add_options_into_line(optgroup, prefixes, "support_max_bridges_on_pillar"); - optgroup->append_single_option_line(prefix + "support_pillar_connection_mode"); - optgroup->append_single_option_line(prefix + "support_buildplate_only"); - optgroup->append_single_option_line(prefix + "support_pillar_widening_factor"); - optgroup->append_single_option_line(prefix + "support_max_weight_on_model"); - optgroup->append_single_option_line(prefix + "support_base_diameter"); - optgroup->append_single_option_line(prefix + "support_base_height"); - optgroup->append_single_option_line(prefix + "support_base_safety_distance"); + add_options_into_line(optgroup, prefixes, "support_pillar_connection_mode"); + add_options_into_line(optgroup, prefixes, "support_buildplate_only"); + add_options_into_line(optgroup, prefixes, "support_pillar_widening_factor"); + add_options_into_line(optgroup, prefixes, "support_max_weight_on_model"); + add_options_into_line(optgroup, prefixes, "support_base_diameter"); + add_options_into_line(optgroup, prefixes, "support_base_height"); + add_options_into_line(optgroup, prefixes, "support_base_safety_distance"); // Mirrored parameter from Pad page for toggling elevation on the same page - optgroup->append_single_option_line(prefix + "support_object_elevation"); + add_options_into_line(optgroup, prefixes, "support_object_elevation"); Line line{ "", "" }; line.full_width = 1; @@ -4853,9 +4870,9 @@ void TabSLAPrint::build_sla_support_params(const std::string &prefix, optgroup->append_line(line); optgroup = page->new_optgroup(L("Connection of the support sticks and junctions")); - optgroup->append_single_option_line(prefix + "support_critical_angle"); - optgroup->append_single_option_line(prefix + "support_max_bridge_length"); - optgroup->append_single_option_line(prefix + "support_max_pillar_link_distance"); + add_options_into_line(optgroup, prefixes, "support_critical_angle"); + add_options_into_line(optgroup, prefixes, "support_max_bridge_length"); + add_options_into_line(optgroup, prefixes, "support_max_pillar_link_distance"); } void TabSLAPrint::build() @@ -4871,46 +4888,11 @@ void TabSLAPrint::build() page = add_options_page(L("Supports"), "support"/*"sla_supports"*/); -// page = add_options_page(L("Branching"), "supports"); - optgroup = page->new_optgroup(L("Supports")); optgroup->append_single_option_line("supports_enable"); optgroup->append_single_option_line("support_tree_type"); - build_sla_support_params("", page); - build_sla_support_params("branching", page); -// optgroup = page->new_optgroup(L("Support head")); -// optgroup->append_single_option_line("support_head_front_diameter"); -// optgroup->append_single_option_line("support_head_penetration"); -// optgroup->append_single_option_line("support_head_width"); - -// optgroup = page->new_optgroup(L("Support pillar")); -// optgroup->append_single_option_line("support_pillar_diameter"); -// optgroup->append_single_option_line("support_small_pillar_diameter_percent"); -// optgroup->append_single_option_line("support_max_bridges_on_pillar"); - -// optgroup->append_single_option_line("support_pillar_connection_mode"); -// optgroup->append_single_option_line("support_buildplate_only"); -// optgroup->append_single_option_line("support_pillar_widening_factor"); -// optgroup->append_single_option_line("support_max_weight_on_model"); -// optgroup->append_single_option_line("support_base_diameter"); -// optgroup->append_single_option_line("support_base_height"); -// optgroup->append_single_option_line("support_base_safety_distance"); - -// // Mirrored parameter from Pad page for toggling elevation on the same page -// optgroup->append_single_option_line("support_object_elevation"); - -// Line line{ "", "" }; -// line.full_width = 1; -// line.widget = [this](wxWindow* parent) { -// return description_line_widget(parent, &m_support_object_elevation_description_line); -// }; -// optgroup->append_line(line); - -// optgroup = page->new_optgroup(L("Connection of the support sticks and junctions")); -// optgroup->append_single_option_line("support_critical_angle"); -// optgroup->append_single_option_line("support_max_bridge_length"); -// optgroup->append_single_option_line("support_max_pillar_link_distance"); + build_sla_support_params({{"", "Default"}, {"branching", "Branching"}}, page); optgroup = page->new_optgroup(L("Automatic generation")); optgroup->append_single_option_line("support_points_density_relative"); diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index e95050f33..c060eb7fd 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -526,7 +526,10 @@ public: class TabSLAPrint : public Tab { - void build_sla_support_params(const std::string &prefix, + // Methods are a vector of method prefix -> method label pairs + // method prefix is the prefix whith which all the config values are prefixed + // for a particular method. The label is the friendly name for the method + void build_sla_support_params(const std::vector> &methods, const Slic3r::GUI::PageShp &page); public: