From c2b998048851737d1ec328519642a762c9ae14fe Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 28 Aug 2019 11:32:49 +0200 Subject: [PATCH] Mirror pad_around_object for 'Pad' page on 'Supports' page --- src/libslic3r/PrintConfig.cpp | 5 ++--- src/libslic3r/PrintConfig.hpp | 4 ++-- src/libslic3r/SLAPrint.cpp | 16 ++++++---------- src/slic3r/GUI/ConfigManipulation.cpp | 4 ++-- src/slic3r/GUI/Plater.cpp | 4 ++-- src/slic3r/GUI/Preset.cpp | 2 +- src/slic3r/GUI/Tab.cpp | 20 +++++++++++++++----- 7 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 477962405..5236e4e04 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2640,8 +2640,7 @@ void PrintConfigDef::init_sla_params() def->label = L("Object elevation"); def->category = L("Supports"); def->tooltip = L("How much the supports should lift up the supported object. " - "If this value is zero, the bottom of the model geometry " - "will be considered as part of the pad."); + "If \"Pad around object\" is enabled, this value is ignored."); def->sidetext = L("mm"); def->min = 0; def->max = 150; // This is the max height of print on SL1 @@ -2728,7 +2727,7 @@ void PrintConfigDef::init_sla_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(45.0)); - def = this->add("pad_zero_elevation", coBool); + def = this->add("pad_around_object", coBool); def->label = L("Pad around object"); def->category = L("Pad"); def->tooltip = L("Create pad around object and ignore the support elevation"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 35025fcd1..015b2bde7 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1042,7 +1042,7 @@ public: // ///////////////////////////////////////////////////////////////////////// // Disable the elevation (ignore its value) and use the zero elevation mode - ConfigOptionBool pad_zero_elevation; + ConfigOptionBool pad_around_object; // This is the gap between the object bottom and the generated pad ConfigOptionFloat pad_object_gap; @@ -1085,7 +1085,7 @@ protected: OPT_PTR(pad_max_merge_distance); // OPT_PTR(pad_edge_radius); OPT_PTR(pad_wall_slope); - OPT_PTR(pad_zero_elevation); + OPT_PTR(pad_around_object); OPT_PTR(pad_object_gap); OPT_PTR(pad_object_connector_stride); OPT_PTR(pad_object_connector_width); diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 21aec8384..d8fcf66c1 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -577,12 +577,7 @@ std::string SLAPrint::output_filename(const std::string &filename_base) const namespace { bool is_zero_elevation(const SLAPrintObjectConfig &c) { - bool en_implicit = c.support_object_elevation.getFloat() <= EPSILON && - c.pad_enable.getBool() && c.supports_enable.getBool(); - bool en_explicit = c.pad_zero_elevation.getBool() && - c.supports_enable.getBool(); - - return en_implicit || en_explicit; + return c.pad_enable.getBool() && c.pad_around_object.getBool(); } // Compile the argument for support creation from the static print config. @@ -676,12 +671,13 @@ std::string SLAPrint::validate() const double elv = cfg.object_elevation_mm; - if(supports_en && elv > EPSILON && elv < pinhead_width ) + sla::PoolConfig::EmbedObject builtinpad = builtin_pad_cfg(po->config()); + + if(supports_en && !builtinpad.enabled && elv < pinhead_width ) return L( "Elevation is too low for object. Use the \"Pad around " "obect\" feature to print the object without elevation."); - - sla::PoolConfig::EmbedObject builtinpad = builtin_pad_cfg(po->config()); + if(supports_en && builtinpad.enabled && cfg.pillar_base_safety_distance_mm < builtinpad.object_gap_mm) { return L( @@ -1698,7 +1694,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vectoropt_bool("pad_zero_elevation") && has_suppad; + bool zero_elev = config->opt_bool("pad_around_object") && has_suppad; toggle_field("support_object_elevation", supports_en && !zero_elev); toggle_field("pad_object_gap", zero_elev); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 460b5b0de..d6828df0f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -563,9 +563,9 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) : new_conf.set_key_value("pad_enable", new ConfigOptionBool(pad_enable)); if (selection == _("Below object")) - new_conf.set_key_value("pad_zero_elevation", new ConfigOptionBool(false)); + new_conf.set_key_value("pad_around_object", new ConfigOptionBool(false)); else if (selection == _("Around object")) - new_conf.set_key_value("pad_zero_elevation", new ConfigOptionBool(true)); + new_conf.set_key_value("pad_around_object", new ConfigOptionBool(true)); } else { diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp index 64793630c..d2503d349 100644 --- a/src/slic3r/GUI/Preset.cpp +++ b/src/slic3r/GUI/Preset.cpp @@ -480,7 +480,7 @@ const std::vector& Preset::sla_print_options() // "pad_edge_radius", "pad_wall_slope", "pad_object_gap", - "pad_zero_elevation", + "pad_around_object", "pad_object_connector_stride", "pad_object_connector_width", "pad_object_connector_penetration", diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 612204a92..2f5520d2b 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -840,7 +840,7 @@ static wxString support_combo_value_for_config(const DynamicPrintConfig &config, static wxString pad_combo_value_for_config(const DynamicPrintConfig &config) { - return config.opt_bool("pad_enable") ? (config.opt_bool("pad_zero_elevation") ? _("Around object") : _("Below object")) : _("None"); + return config.opt_bool("pad_enable") ? (config.opt_bool("pad_around_object") ? _("Around object") : _("Below object")) : _("None"); } void Tab::on_value_change(const std::string& opt_key, const boost::any& value) @@ -856,13 +856,20 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key); og_freq_chng_params->set_value(opt_key, val); } + + if (opt_key == "pad_around_object") { + for (PageShp &pg : m_pages) { + Field * fld = pg->get_field(opt_key); + if (fld) fld->set_value(value, false); + } + } if (is_fff ? (opt_key == "support_material" || opt_key == "support_material_auto" || opt_key == "support_material_buildplate_only") : (opt_key == "supports_enable" || opt_key == "support_buildplate_only")) og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff)); - if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_zero_elevation")) + if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_around_object")) og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config)); if (opt_key == "brim_width") @@ -3742,6 +3749,9 @@ void TabSLAPrint::build() 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("pad_around_object"); optgroup->append_single_option_line("support_object_elevation"); optgroup = page->new_optgroup(_(L("Connection of the support sticks and junctions"))); @@ -3763,7 +3773,7 @@ void TabSLAPrint::build() // optgroup->append_single_option_line("pad_edge_radius"); optgroup->append_single_option_line("pad_wall_slope"); - optgroup->append_single_option_line("pad_zero_elevation"); + optgroup->append_single_option_line("pad_around_object"); optgroup->append_single_option_line("pad_object_gap"); optgroup->append_single_option_line("pad_object_connector_stride"); optgroup->append_single_option_line("pad_object_connector_width"); @@ -3839,7 +3849,7 @@ void TabSLAPrint::update() get_field("pad_max_merge_distance")->toggle(pad_en); // get_field("pad_edge_radius")->toggle(supports_en); get_field("pad_wall_slope")->toggle(pad_en); - get_field("pad_zero_elevation")->toggle(pad_en); + get_field("pad_around_object")->toggle(pad_en); double head_penetration = m_config->opt_float("support_head_penetration"); double head_width = m_config->opt_float("support_head_width"); @@ -3882,7 +3892,7 @@ void TabSLAPrint::update() } bool has_suppad = pad_en && supports_en; - bool zero_elev = m_config->opt_bool("pad_zero_elevation") && has_suppad; + bool zero_elev = m_config->opt_bool("pad_around_object") && has_suppad; get_field("support_object_elevation")->toggle(supports_en && !zero_elev); get_field("pad_object_gap")->toggle(zero_elev);