First prototype for "SLA materials" Tab
This commit is contained in:
parent
4e193555ae
commit
cce0e9e501
@ -2124,13 +2124,13 @@ void PrintConfigDef::init_sla_params()
|
|||||||
def->default_value = new ConfigOptionFloat(15);
|
def->default_value = new ConfigOptionFloat(15);
|
||||||
|
|
||||||
def = this->add("material_correction_printing", coFloats);
|
def = this->add("material_correction_printing", coFloats);
|
||||||
def->label = L("Correction for expansion when printing");
|
def->full_label = L("Correction for expansion when printing");
|
||||||
def->tooltip = L("Correction for expansion when printing");
|
def->tooltip = L("Correction for expansion when printing");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->default_value = new ConfigOptionFloats( { 1. , 1., 1. } );
|
def->default_value = new ConfigOptionFloats( { 1. , 1., 1. } );
|
||||||
|
|
||||||
def = this->add("material_correction_curing", coFloats);
|
def = this->add("material_correction_curing", coFloats);
|
||||||
def->label = L("Correction for expansion after curing");
|
def->full_label = L("Correction for expansion after curing");
|
||||||
def->tooltip = L("Correction for expansion after curing");
|
def->tooltip = L("Correction for expansion after curing");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->default_value = new ConfigOptionFloats( { 1. , 1., 1. } );
|
def->default_value = new ConfigOptionFloats( { 1. , 1., 1. } );
|
||||||
|
@ -496,12 +496,13 @@ void open_preferences_dialog(int event_preferences)
|
|||||||
void create_preset_tabs(bool no_controller, int event_value_change, int event_presets_changed)
|
void create_preset_tabs(bool no_controller, int event_value_change, int event_presets_changed)
|
||||||
{
|
{
|
||||||
update_label_colours_from_appconfig();
|
update_label_colours_from_appconfig();
|
||||||
add_created_tab(new TabPrint (g_wxTabPanel, no_controller));
|
add_created_tab(new TabPrint (g_wxTabPanel, no_controller));
|
||||||
add_created_tab(new TabFilament (g_wxTabPanel, no_controller));
|
add_created_tab(new TabFilament (g_wxTabPanel, no_controller));
|
||||||
add_created_tab(new TabPrinter (g_wxTabPanel, no_controller));
|
add_created_tab(new TabSLAMaterial (g_wxTabPanel, no_controller));
|
||||||
|
add_created_tab(new TabPrinter (g_wxTabPanel, no_controller));
|
||||||
for (size_t i = 0; i < g_wxTabPanel->GetPageCount(); ++ i) {
|
for (size_t i = 0; i < g_wxTabPanel->GetPageCount(); ++ i) {
|
||||||
Tab *tab = dynamic_cast<Tab*>(g_wxTabPanel->GetPage(i));
|
Tab *tab = dynamic_cast<Tab*>(g_wxTabPanel->GetPage(i));
|
||||||
if (! tab)
|
if (! tab || tab->GetName()=="sla_material")
|
||||||
continue;
|
continue;
|
||||||
tab->set_event_value_change(wxEventType(event_value_change));
|
tab->set_event_value_change(wxEventType(event_value_change));
|
||||||
tab->set_event_presets_changed(wxEventType(event_presets_changed));
|
tab->set_event_presets_changed(wxEventType(event_presets_changed));
|
||||||
|
@ -211,11 +211,17 @@ void Preset::normalize(DynamicPrintConfig &config)
|
|||||||
|
|
||||||
// Load a config file, return a C++ class Slic3r::DynamicPrintConfig with $keys initialized from the config file.
|
// Load a config file, return a C++ class Slic3r::DynamicPrintConfig with $keys initialized from the config file.
|
||||||
// In case of a "default" config item, return the default values.
|
// In case of a "default" config item, return the default values.
|
||||||
DynamicPrintConfig& Preset::load(const std::vector<std::string> &keys)
|
DynamicPrintConfig& Preset::load(const std::vector<std::string> &keys, Preset::Type& type)
|
||||||
{
|
{
|
||||||
// Set the configuration from the defaults.
|
// Set the configuration from the defaults.
|
||||||
Slic3r::FullPrintConfig defaults;
|
if (type == TYPE_SLA_MATERIAL) {
|
||||||
this->config.apply_only(defaults, keys.empty() ? defaults.keys() : keys);
|
Slic3r::SLAFullPrintConfig defaults;
|
||||||
|
this->config.apply_only(defaults, keys.empty() ? defaults.keys() : keys);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Slic3r::FullPrintConfig defaults;
|
||||||
|
this->config.apply_only(defaults, keys.empty() ? defaults.keys() : keys);
|
||||||
|
}
|
||||||
if (! this->is_default) {
|
if (! this->is_default) {
|
||||||
// Load the preset file, apply preset values on top of defaults.
|
// Load the preset file, apply preset values on top of defaults.
|
||||||
try {
|
try {
|
||||||
@ -405,7 +411,7 @@ PresetCollection::PresetCollection(Preset::Type type, const std::vector<std::str
|
|||||||
{
|
{
|
||||||
// Insert just the default preset.
|
// Insert just the default preset.
|
||||||
this->add_default_preset(keys, default_name);
|
this->add_default_preset(keys, default_name);
|
||||||
m_presets.front().load(keys);
|
m_presets.front().load(keys, m_type);
|
||||||
m_edited_preset.config.apply(m_presets.front().config);
|
m_edited_preset.config.apply(m_presets.front().config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,7 +442,7 @@ void PresetCollection::add_default_preset(const std::vector<std::string> &keys,
|
|||||||
{
|
{
|
||||||
// Insert just the default preset.
|
// Insert just the default preset.
|
||||||
m_presets.emplace_back(Preset(this->type(), preset_name, true));
|
m_presets.emplace_back(Preset(this->type(), preset_name, true));
|
||||||
m_presets.back().load(keys);
|
m_presets.back().load(keys, m_type);
|
||||||
++ m_num_default_presets;
|
++ m_num_default_presets;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,7 +468,7 @@ void PresetCollection::load_presets(const std::string &dir_path, const std::stri
|
|||||||
try {
|
try {
|
||||||
Preset preset(m_type, name, false);
|
Preset preset(m_type, name, false);
|
||||||
preset.file = dir_entry.path().string();
|
preset.file = dir_entry.path().string();
|
||||||
preset.load(keys);
|
preset.load(keys, m_type);
|
||||||
m_presets.emplace_back(preset);
|
m_presets.emplace_back(preset);
|
||||||
} catch (const std::runtime_error &err) {
|
} catch (const std::runtime_error &err) {
|
||||||
errors_cummulative += err.what();
|
errors_cummulative += err.what();
|
||||||
|
@ -126,7 +126,7 @@ public:
|
|||||||
|
|
||||||
// Load this profile for the following keys only.
|
// Load this profile for the following keys only.
|
||||||
// Throws std::runtime_error in case the file cannot be read.
|
// Throws std::runtime_error in case the file cannot be read.
|
||||||
DynamicPrintConfig& load(const std::vector<std::string> &keys);
|
DynamicPrintConfig& load(const std::vector<std::string> &keys, Preset::Type& type);
|
||||||
|
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
|
@ -2759,5 +2759,91 @@ void SavePresetWindow::accept()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabSLAMaterial::build()
|
||||||
|
{
|
||||||
|
m_presets = &m_preset_bundle->sla_materials;
|
||||||
|
load_initial_data();
|
||||||
|
|
||||||
|
auto page = add_options_page(_(L("General")), "spool.png");
|
||||||
|
|
||||||
|
/* auto optgroup = page->new_optgroup(_(L("Display")));
|
||||||
|
optgroup->append_single_option_line("display_width");
|
||||||
|
optgroup->append_single_option_line("display_height");
|
||||||
|
|
||||||
|
Line line = { _(L("Number of pixels in axes")), "" };
|
||||||
|
line.append_option(optgroup->get_option("display_pixels_x"));
|
||||||
|
line.append_option(optgroup->get_option("display_pixels_y"));
|
||||||
|
optgroup->append_line(line);
|
||||||
|
*/
|
||||||
|
auto optgroup = page->new_optgroup(_(L("Layers")));
|
||||||
|
optgroup->append_single_option_line("layer_height");
|
||||||
|
optgroup->append_single_option_line("initial_layer_height");
|
||||||
|
|
||||||
|
optgroup = page->new_optgroup(_(L("Exposure")));
|
||||||
|
optgroup->append_single_option_line("exposure_time");
|
||||||
|
optgroup->append_single_option_line("initial_exposure_time");
|
||||||
|
|
||||||
|
optgroup = page->new_optgroup(_(L("Corrections")));
|
||||||
|
// Legend for OptionsGroups
|
||||||
|
optgroup->set_show_modified_btns_val(false);
|
||||||
|
optgroup->label_width = 230;
|
||||||
|
auto line = Line{ "", "" };
|
||||||
|
|
||||||
|
ConfigOptionDef def;
|
||||||
|
def.type = coString;
|
||||||
|
def.width = 150;
|
||||||
|
def.gui_type = "legend";
|
||||||
|
|
||||||
|
std::vector<std::string> axes{ "X", "Y", "Z" };
|
||||||
|
for (auto& axis : axes) {
|
||||||
|
def.tooltip = L("Values in this column are for ") + axis + L(" axis");
|
||||||
|
def.default_value = new ConfigOptionString{ axis };
|
||||||
|
std::string opt_key = axis + "power_legend";
|
||||||
|
auto option = Option(def, opt_key);
|
||||||
|
line.append_option(option);
|
||||||
|
}
|
||||||
|
optgroup->append_line(line);
|
||||||
|
|
||||||
|
std::vector<std::string> corrections = { "material_correction_printing", "material_correction_curing" };
|
||||||
|
for (auto& opt_key : corrections){
|
||||||
|
line = Line{ m_config->def()->get(opt_key)->full_label, "" };
|
||||||
|
for( int id = 0; id < 3; ++id)
|
||||||
|
line.append_option(optgroup->get_option(opt_key, id));
|
||||||
|
optgroup->append_line(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
page = add_options_page(_(L("Notes")), "note.png");
|
||||||
|
optgroup = page->new_optgroup(_(L("Notes")), 0);
|
||||||
|
optgroup->label_width = 0;
|
||||||
|
Option option = optgroup->get_option("material_notes");
|
||||||
|
option.opt.full_width = true;
|
||||||
|
option.opt.height = 250;
|
||||||
|
optgroup->append_single_option_line(option);
|
||||||
|
|
||||||
|
page = add_options_page(_(L("Dependencies")), "wrench.png");
|
||||||
|
optgroup = page->new_optgroup(_(L("Profile dependencies")));
|
||||||
|
line = { _(L("Compatible printers")), "" };
|
||||||
|
line.widget = [this](wxWindow* parent){
|
||||||
|
return compatible_printers_widget(parent, &m_compatible_printers_checkbox, &m_compatible_printers_btn);
|
||||||
|
};
|
||||||
|
optgroup->append_line(line, &m_colored_Label);
|
||||||
|
|
||||||
|
option = optgroup->get_option("compatible_printers_condition");
|
||||||
|
option.opt.full_width = true;
|
||||||
|
optgroup->append_single_option_line(option);
|
||||||
|
|
||||||
|
line = Line{ "", "" };
|
||||||
|
line.full_width = 1;
|
||||||
|
line.widget = [this](wxWindow* parent) {
|
||||||
|
return description_line_widget(parent, &m_parent_preset_description_line);
|
||||||
|
};
|
||||||
|
optgroup->append_line(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabSLAMaterial::update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} // GUI
|
} // GUI
|
||||||
} // Slic3r
|
} // Slic3r
|
||||||
|
@ -342,6 +342,18 @@ public:
|
|||||||
void init_options_list() override;
|
void init_options_list() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TabSLAMaterial : public Tab
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TabSLAMaterial() {}
|
||||||
|
TabSLAMaterial(wxNotebook* parent, bool no_controller) :
|
||||||
|
Tab(parent, _(L("SLA Material Settings")), "sla_material", no_controller) {}
|
||||||
|
~TabSLAMaterial(){}
|
||||||
|
|
||||||
|
void build() override;
|
||||||
|
void update() override;
|
||||||
|
};
|
||||||
|
|
||||||
class SavePresetWindow :public wxDialog
|
class SavePresetWindow :public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user