From a7260e7257109e5e577b4c80a676212759004345 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 10 Nov 2021 13:44:47 +0100 Subject: [PATCH] Add material print speed parameter for sla printers except sl1 --- src/libslic3r/Format/SL1.cpp | 1 + src/libslic3r/Preset.cpp | 1 + src/libslic3r/PrintConfig.cpp | 17 +++++++++++++++++ src/libslic3r/PrintConfig.hpp | 3 +++ src/slic3r/GUI/Tab.cpp | 12 ++++++++++++ src/slic3r/GUI/Tab.hpp | 2 +- 6 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Format/SL1.cpp b/src/libslic3r/Format/SL1.cpp index 9e271238e..6ed8c5ebe 100644 --- a/src/libslic3r/Format/SL1.cpp +++ b/src/libslic3r/Format/SL1.cpp @@ -382,6 +382,7 @@ void fill_iniconf(ConfMap &m, const SLAPrint &print) m["layerHeight"] = get_cfg_value(cfg, "layer_height"); m["expTime"] = get_cfg_value(cfg, "exposure_time"); m["expTimeFirst"] = get_cfg_value(cfg, "initial_exposure_time"); + m["expUserProfile"] = get_cfg_value(cfg, "material_print_speed") == "slow" ? "1" : "0"; m["materialName"] = get_cfg_value(cfg, "sla_material_settings_id"); m["printerModel"] = get_cfg_value(cfg, "printer_model"); m["printerVariant"] = get_cfg_value(cfg, "printer_variant"); diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index a19eb4d52..7950d38de 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -551,6 +551,7 @@ static std::vector s_Preset_sla_material_options { "material_correction_z", "material_notes", "material_vendor", + "material_print_speed", "default_sla_material_profile", "compatible_prints", "compatible_prints_condition", "compatible_printers", "compatible_printers_condition", "inherits" diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 14d48368f..18defae2c 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -165,6 +165,12 @@ static const t_config_enum_values s_keys_map_SLAPillarConnectionMode = { }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SLAPillarConnectionMode) +static const t_config_enum_values s_keys_map_SLAMaterialSpeed = { + {"slow", slamsSlow}, + {"fast", slamsFast} +}; +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SLAMaterialSpeed); + static const t_config_enum_values s_keys_map_BrimType = { {"no_brim", btNoBrim}, {"outer_only", btOuterOnly}, @@ -3730,6 +3736,17 @@ void PrintConfigDef::init_sla_params() def->max = 10; def->mode = comExpert; def->set_default_value(new ConfigOptionFloat(2.0)); + + def = this->add("material_print_speed", coEnum); + def->label = L("Print speed"); + def->tooltip = L("lorem ipsum"); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_values.push_back("slow"); + def->enum_values.push_back("fast"); + def->enum_labels.push_back(L("Slow")); + def->enum_labels.push_back(L("Fast")); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionEnum(slamsSlow)); } void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &value) diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 8297f9d2f..68dbd68d3 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -915,6 +915,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, hollowing_closing_distance)) ) +enum SLAMaterialSpeed { slamsSlow, slamsFast }; + PRINT_CONFIG_CLASS_DEFINE( SLAMaterialConfig, @@ -929,6 +931,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, material_correction_x)) ((ConfigOptionFloat, material_correction_y)) ((ConfigOptionFloat, material_correction_z)) + ((ConfigOptionEnum, material_print_speed)) ) PRINT_CONFIG_CLASS_DEFINE( diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 6c820cff3..d96e7e3e1 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -4239,6 +4239,11 @@ void TabSLAMaterial::build() optgroup->append_single_option_line(option); build_preset_description_line(optgroup.get()); + + page = add_options_page(L("Material printing profile"), "note.png"); + optgroup = page->new_optgroup(L("Material printing profile")); + option = optgroup->get_option("material_print_speed"); + optgroup->append_single_option_line(option); } // Reload current config (aka presets->edited_preset->config) into the UI fields. @@ -4249,6 +4254,13 @@ void TabSLAMaterial::reload_config() Tab::reload_config(); } +void TabSLAMaterial::toggle_options() +{ + const Preset ¤t_printer = wxGetApp().preset_bundle->printers.get_edited_preset(); + std::string model = current_printer.config.opt_string("printer_model"); + m_config_manipulation.toggle_field("material_print_speed", model != "SL1"); +} + void TabSLAMaterial::update() { if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptFFF) diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 6a7b56fe4..8a87c60c5 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -480,7 +480,7 @@ public: void build() override; void reload_config() override; - void toggle_options() override {}; + void toggle_options() override; void update() override; void init_options_list() override; bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptSLA; }