From 090ce6ca05ace0655253af059960d70ff3fb66e5 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 2 Mar 2020 12:43:00 +0100 Subject: [PATCH 1/2] Promote max_bridges_on_pillar to be a runtime parameter. This way the user greater control over support tree branching and the amount of pillars created. fixes #3728 --- src/libslic3r/PrintConfig.cpp | 10 ++++++++++ src/libslic3r/PrintConfig.hpp | 4 ++++ src/libslic3r/SLA/SupportTree.cpp | 1 - src/libslic3r/SLA/SupportTree.hpp | 4 +++- src/libslic3r/SLAPrint.cpp | 3 +++ src/slic3r/GUI/ConfigManipulation.cpp | 1 + src/slic3r/GUI/Preset.cpp | 1 + src/slic3r/GUI/Tab.cpp | 2 ++ 8 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 2be1f8cf63..adb1f4ee3a 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2653,6 +2653,16 @@ void PrintConfigDef::init_sla_params() def->max = 15; def->mode = comSimple; def->set_default_value(new ConfigOptionFloat(1.0)); + + def = this->add("support_max_bridges_on_pillar", coInt); + def->label = L("Max bridges on a pillar"); + def->tooltip = 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 = this->add("support_pillar_connection_mode", coEnum); def->label = L("Support pillar connection mode"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 8c6710dad1..f6a2bd6799 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -980,6 +980,9 @@ public: // Radius in mm of the support pillars. ConfigOptionFloat support_pillar_diameter /*= 0.8*/; + + // How much bridge (supporting another pinhead) can be placed on a pillar. + ConfigOptionInt support_max_bridges_on_pillar; // How the pillars are bridged together ConfigOptionEnum support_pillar_connection_mode; @@ -1101,6 +1104,7 @@ protected: OPT_PTR(support_head_penetration); OPT_PTR(support_head_width); OPT_PTR(support_pillar_diameter); + OPT_PTR(support_max_bridges_on_pillar); OPT_PTR(support_pillar_connection_mode); OPT_PTR(support_buildplate_only); OPT_PTR(support_pillar_widening_factor); diff --git a/src/libslic3r/SLA/SupportTree.cpp b/src/libslic3r/SLA/SupportTree.cpp index 5ee35f9e0a..528778b68b 100644 --- a/src/libslic3r/SLA/SupportTree.cpp +++ b/src/libslic3r/SLA/SupportTree.cpp @@ -41,7 +41,6 @@ const double SupportConfig::max_dual_pillar_height_mm = 35.0; const double SupportConfig::optimizer_rel_score_diff = 1e-6; const unsigned SupportConfig::optimizer_max_iterations = 1000; const unsigned SupportConfig::pillar_cascade_neighbors = 3; -const unsigned SupportConfig::max_bridges_on_pillar = 3; void SupportTree::retrieve_full_mesh(TriangleMesh &outmesh) const { outmesh.merge(retrieve_mesh(MeshType::Support)); diff --git a/src/libslic3r/SLA/SupportTree.hpp b/src/libslic3r/SLA/SupportTree.hpp index acf6c10f5e..c6255aa2f2 100644 --- a/src/libslic3r/SLA/SupportTree.hpp +++ b/src/libslic3r/SLA/SupportTree.hpp @@ -83,6 +83,8 @@ struct SupportConfig // body. This is only useful when elevation is set to zero. double pillar_base_safety_distance_mm = 0.5; + unsigned max_bridges_on_pillar = 3; + double head_fullwidth() const { return 2 * head_front_radius_mm + head_width_mm + 2 * head_back_radius_mm - head_penetration_mm; @@ -103,7 +105,7 @@ struct SupportConfig static const double optimizer_rel_score_diff; static const unsigned optimizer_max_iterations; static const unsigned pillar_cascade_neighbors; - static const unsigned max_bridges_on_pillar; + }; enum class MeshType { Support, Pad }; diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index cca0abd5c1..4ec5aae29f 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -65,6 +65,8 @@ sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) c.support_base_safety_distance.getFloat() < EPSILON ? scfg.safety_distance_mm : c.support_base_safety_distance.getFloat(); + scfg.max_bridges_on_pillar = unsigned(c.support_max_bridges_on_pillar.getInt()); + return scfg; } @@ -946,6 +948,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector& Preset::sla_print_options() "support_head_penetration", "support_head_width", "support_pillar_diameter", + "support_max_bridges_on_pillar", "support_pillar_connection_mode", "support_buildplate_only", "support_pillar_widening_factor", diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 19d0854200..ac141caa49 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3612,6 +3612,8 @@ void TabSLAPrint::build() optgroup = page->new_optgroup(_(L("Support pillar"))); optgroup->append_single_option_line("support_pillar_diameter"); + 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"); // TODO: This parameter is not used at the moment. From aaaeafcdeb6c28e01dbed6b63589314789268d76 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 2 Mar 2020 16:15:41 +0100 Subject: [PATCH 2/2] When loading installed filaments and SLA materials from PrusaSlicer.ini, the "renamed_from" property of current profiles was not taken into account. This lead to a situation where there were no MMU or SLA materials installed after upgrade from PrusaSlicer 2.2.1 to 2.2. This should work now. --- src/slic3r/GUI/Preset.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp index fc98a35fed..c0af7bceae 100644 --- a/src/slic3r/GUI/Preset.cpp +++ b/src/slic3r/GUI/Preset.cpp @@ -374,12 +374,23 @@ void Preset::set_visible_from_appconfig(const AppConfig &app_config) if (type == TYPE_PRINTER) { const std::string &model = config.opt_string("printer_model"); const std::string &variant = config.opt_string("printer_variant"); - if (model.empty() || variant.empty()) { return; } + if (model.empty() || variant.empty()) + return; is_visible = app_config.get_variant(vendor->id, model, variant); - } else if (type == TYPE_FILAMENT) { - is_visible = app_config.has("filaments", name); - } else if (type == TYPE_SLA_MATERIAL) { - is_visible = app_config.has("sla_materials", name); + } else if (type == TYPE_FILAMENT || type == TYPE_SLA_MATERIAL) { + const char *section_name = (type == TYPE_FILAMENT) ? "filaments" : "sla_materials"; + if (app_config.has_section(section_name)) { + // Check whether this profile is marked as "installed" in PrusaSlicer.ini, + // or whether a profile is marked as "installed", which this profile may have been renamed from. + const std::map &installed = app_config.get_section(section_name); + auto has = [&installed](const std::string &name) { + auto it = installed.find(name); + return it != installed.end() && ! it->second.empty(); + }; + is_visible = has(this->name); + for (auto it = this->renamed_from.begin(); ! is_visible && it != this->renamed_from.end(); ++ it) + is_visible = has(*it); + } } }