mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
SLA exposure bounds to printer params.
This commit is contained in:
parent
88dcb7f366
commit
b58713c06f
5 changed files with 50 additions and 94 deletions
|
@ -838,7 +838,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_zero_elevation") ? _("Around object") : _("Below object")) : _("None");
|
||||
}
|
||||
|
||||
void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||
|
@ -860,8 +860,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
(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"))
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_zero_elevation"))
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
|
||||
if (opt_key == "brim_width")
|
||||
{
|
||||
|
@ -998,7 +998,7 @@ void Tab::update_frequently_changed_parameters()
|
|||
|
||||
og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
|
||||
if (! is_fff)
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
|
||||
const std::string updated_value_key = is_fff ? "fill_density" : "pad_enable";
|
||||
|
||||
|
@ -1772,13 +1772,13 @@ void TabFilament::reload_config()
|
|||
|
||||
void TabFilament::update_volumetric_flow_preset_hints()
|
||||
{
|
||||
wxString text;
|
||||
try {
|
||||
text = from_u8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle));
|
||||
} catch (std::exception &ex) {
|
||||
text = _(L("Volumetric flow hints not available\n\n")) + from_u8(ex.what());
|
||||
}
|
||||
m_volumetric_speed_description_line->SetText(text);
|
||||
wxString text;
|
||||
try {
|
||||
text = from_u8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle));
|
||||
} catch (std::exception &ex) {
|
||||
text = _(L("Volumetric flow hints not available\n\n")) + from_u8(ex.what());
|
||||
}
|
||||
m_volumetric_speed_description_line->SetText(text);
|
||||
}
|
||||
|
||||
void TabFilament::update()
|
||||
|
@ -1788,9 +1788,9 @@ void TabFilament::update()
|
|||
|
||||
m_update_cnt++;
|
||||
|
||||
wxString text = from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()));
|
||||
m_cooling_description_line->SetText(text);
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
wxString text = from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()));
|
||||
m_cooling_description_line->SetText(text);
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
Layout();
|
||||
|
||||
bool cooling = m_config->opt_bool("cooling", 0);
|
||||
|
@ -1812,8 +1812,8 @@ void TabFilament::update()
|
|||
|
||||
void TabFilament::OnActivate()
|
||||
{
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
Tab::OnActivate();
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
Tab::OnActivate();
|
||||
}
|
||||
|
||||
wxSizer* Tab::description_line_widget(wxWindow* parent, ogStaticText* *StaticText)
|
||||
|
@ -2290,6 +2290,12 @@ void TabPrinter::build_sla()
|
|||
optgroup->append_single_option_line("absolute_correction");
|
||||
optgroup->append_single_option_line("gamma_correction");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Exposure")));
|
||||
optgroup->append_single_option_line("min_exposure_time");
|
||||
optgroup->append_single_option_line("max_exposure_time");
|
||||
optgroup->append_single_option_line("min_initial_exposure_time");
|
||||
optgroup->append_single_option_line("max_initial_exposure_time");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Print Host upload")));
|
||||
build_printhost(optgroup.get());
|
||||
|
||||
|
@ -2560,7 +2566,7 @@ void TabPrinter::build_unregular_pages()
|
|||
optgroup = page->new_optgroup(_(L("Preview")));
|
||||
|
||||
auto reset_to_filament_color = [this, extruder_idx](wxWindow* parent) {
|
||||
add_scaled_button(parent, &m_reset_to_filament_color, "undo",
|
||||
add_scaled_button(parent, &m_reset_to_filament_color, "undo",
|
||||
_(L("Reset to Filament Color")), wxBU_LEFT | wxBU_EXACTFIT);
|
||||
ScalableButton* btn = m_reset_to_filament_color;
|
||||
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
|
@ -2571,7 +2577,7 @@ void TabPrinter::build_unregular_pages()
|
|||
{
|
||||
std::vector<std::string> colors = static_cast<const ConfigOptionStrings*>(m_config->option("extruder_colour"))->values;
|
||||
colors[extruder_idx] = "";
|
||||
|
||||
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
new_conf.set_key_value("extruder_colour", new ConfigOptionStrings(colors));
|
||||
load_config(new_conf);
|
||||
|
@ -3614,11 +3620,7 @@ void TabSLAMaterial::build()
|
|||
optgroup->append_single_option_line("initial_layer_height");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Exposure")));
|
||||
optgroup->append_single_option_line("exposure_time_min");
|
||||
optgroup->append_single_option_line("exposure_time_max");
|
||||
optgroup->append_single_option_line("exposure_time");
|
||||
optgroup->append_single_option_line("initial_exposure_time_min");
|
||||
optgroup->append_single_option_line("initial_exposure_time_max");
|
||||
optgroup->append_single_option_line("initial_exposure_time");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Corrections")));
|
||||
|
@ -3683,59 +3685,11 @@ void TabSLAMaterial::reload_config()
|
|||
Tab::reload_config();
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
enum e_cmp {EQUAL = 1, SMALLER = 2, GREATER = 4, SMALLER_EQ = 3, GREATER_EQ = 5};
|
||||
|
||||
void bound_check(Tab &tb, e_cmp cmp, const char *id, const char *boundid)
|
||||
{
|
||||
double bound = tb.m_config->opt_float(boundid);
|
||||
double value = tb.m_config->opt_float(id);
|
||||
|
||||
auto boundlabel = tb.m_config->def()->get(boundid)->label;
|
||||
auto valuelabel = tb.m_config->def()->get(id)->label;
|
||||
|
||||
double ddiff = value - bound;
|
||||
int diff = ddiff < 0 ? SMALLER : (std::abs(ddiff) < EPSILON ? EQUAL : GREATER);
|
||||
|
||||
if ((cmp | diff) != cmp) {
|
||||
wxString fmt;
|
||||
|
||||
switch (cmp) {
|
||||
case EQUAL: fmt = _(L("%s should be equal to %s")); break;
|
||||
case SMALLER: fmt = _(L("%s should be smaller than %s")); break;
|
||||
case GREATER: fmt = _(L("%s should be greater than %s")); break;
|
||||
case SMALLER_EQ: fmt = _(L("%s should be smaller or equal to %s")); break;
|
||||
case GREATER_EQ: fmt = _(L("%s should be greater or equal to %s")); break;
|
||||
}
|
||||
|
||||
wxString msg_text = wxString::Format(fmt, valuelabel, boundlabel);
|
||||
|
||||
wxMessageDialog dialog(tb.parent(), msg_text,
|
||||
_(L("Value outside bounds")),
|
||||
wxICON_WARNING | wxOK);
|
||||
|
||||
DynamicPrintConfig new_conf = *tb.m_config;
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
new_conf.set_key_value(id, new ConfigOptionFloat(bound));
|
||||
|
||||
tb.load_config(new_conf);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void TabSLAMaterial::update()
|
||||
{
|
||||
if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptFFF)
|
||||
return;
|
||||
|
||||
bound_check(*this, e_cmp::GREATER_EQ, "exposure_time", "exposure_time_min");
|
||||
bound_check(*this, e_cmp::SMALLER_EQ, "exposure_time", "exposure_time_max");
|
||||
bound_check(*this, e_cmp::GREATER_EQ, "initial_exposure_time", "initial_exposure_time_min");
|
||||
bound_check(*this, e_cmp::SMALLER_EQ, "initial_exposure_time", "initial_exposure_time_max");
|
||||
|
||||
// #ys_FIXME. Just a template for this function
|
||||
// m_update_cnt++;
|
||||
// ! something to update
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue