Mirror pad_around_object for 'Pad' page on 'Supports' page

This commit is contained in:
tamasmeszaros 2019-08-28 11:32:49 +02:00
parent 19f6d87689
commit c2b9980488
7 changed files with 30 additions and 25 deletions

View file

@ -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");

View file

@ -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);

View file

@ -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::vector<t_conf
|| opt_key == "pad_wall_thickness"
|| opt_key == "supports_enable"
|| opt_key == "support_object_elevation"
|| opt_key == "pad_zero_elevation"
|| opt_key == "pad_around_object"
|| opt_key == "slice_closing_radius") {
steps.emplace_back(slaposObjectSlice);
} else if (

View file

@ -351,10 +351,10 @@ void ConfigManipulation::toggle_print_sla_options(DynamicPrintConfig* config)
toggle_field("pad_max_merge_distance", pad_en);
// toggle_field("pad_edge_radius", supports_en);
toggle_field("pad_wall_slope", pad_en);
toggle_field("pad_zero_elevation", pad_en);
toggle_field("pad_around_object", pad_en);
bool has_suppad = pad_en && supports_en;
bool zero_elev = config->opt_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);

View file

@ -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
{

View file

@ -480,7 +480,7 @@ const std::vector<std::string>& 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",

View file

@ -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);