From c5d70a846e390298e00acaae991171a04ffa9f07 Mon Sep 17 00:00:00 2001 From: "salt.wei" Date: Sun, 25 Jun 2023 16:19:22 +0800 Subject: [PATCH] ENH: add setting of extruder type Signed-off-by: salt.wei Change-Id: Ic126466f6b579dd6a55a1ba16a63c015d538c750 --- .../machine/Anycubic 4Max Pro 0.4 nozzle.json | 3 +++ .../machine/Anycubic 4Max Pro 2 0.4 nozzle.json | 3 +++ .../machine/Anycubic Chiron 0.4 nozzle.json | 3 +++ .../machine/Anycubic Kobra Max 0.4 nozzle.json | 3 +++ .../machine/Anycubic Vyper 0.4 nozzle.json | 3 +++ .../machine/Anycubic i3 Mega S 0.4 nozzle.json | 3 +++ .../machine/Creality CR-10 Max 0.4 nozzle.json | 3 +++ .../machine/Creality CR-10 V2 0.4 nozzle.json | 3 +++ .../machine/Creality Ender-3 V2 0.4 nozzle.json | 3 +++ .../machine/Creality Ender-6 0.4 nozzle.json | 3 +++ .../Prusa/machine/Prusa MINI 0.4 nozzle.json | 3 +++ .../machine/Voxelab Aquila X2 0.4 nozzle.json | 3 +++ src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 17 +++++++++++++++++ src/libslic3r/PrintConfig.hpp | 7 +++++++ src/slic3r/GUI/Tab.cpp | 5 +++-- 16 files changed, 64 insertions(+), 3 deletions(-) diff --git a/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json index 6c7b618b6..5e40d9e29 100644 --- a/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json @@ -7,6 +7,9 @@ "inherits": "fdm_machine_common", "printer_model": "Anycubic 4Max Pro", "default_print_profile": "0.20mm Standard @Anycubic 4MaxPro", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 2 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 2 0.4 nozzle.json index b5a34b72a..03217606e 100644 --- a/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 2 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 2 0.4 nozzle.json @@ -7,6 +7,9 @@ "inherits": "fdm_machine_common", "printer_model": "Anycubic 4Max Pro 2", "default_print_profile": "0.20mm Standard @Anycubic 4MaxPro2", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Anycubic/machine/Anycubic Chiron 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic Chiron 0.4 nozzle.json index a28752a62..3f969ecba 100644 --- a/resources/profiles/Anycubic/machine/Anycubic Chiron 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic Chiron 0.4 nozzle.json @@ -7,6 +7,9 @@ "inherits": "fdm_machine_common", "printer_model": "Anycubic Chiron", "default_print_profile": "0.20mm Standard @Anycubic Chiron", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Anycubic/machine/Anycubic Kobra Max 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic Kobra Max 0.4 nozzle.json index 064c06b74..414518515 100644 --- a/resources/profiles/Anycubic/machine/Anycubic Kobra Max 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic Kobra Max 0.4 nozzle.json @@ -7,6 +7,9 @@ "inherits": "fdm_machine_common", "printer_model": "Anycubic Kobra Max", "default_print_profile": "0.20mm Standard @Anycubic KobraMax", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Anycubic/machine/Anycubic Vyper 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic Vyper 0.4 nozzle.json index ded7b8758..4fd0e041d 100644 --- a/resources/profiles/Anycubic/machine/Anycubic Vyper 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic Vyper 0.4 nozzle.json @@ -7,6 +7,9 @@ "inherits": "fdm_machine_common", "printer_model": "Anycubic Vyper", "default_print_profile": "0.20mm Standard @Anycubic Vyper", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Anycubic/machine/Anycubic i3 Mega S 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic i3 Mega S 0.4 nozzle.json index 5c7fc73fc..ba3394dc2 100644 --- a/resources/profiles/Anycubic/machine/Anycubic i3 Mega S 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic i3 Mega S 0.4 nozzle.json @@ -7,6 +7,9 @@ "inherits": "fdm_machine_common", "printer_model": "Anycubic i3 Mega S", "default_print_profile": "0.20mm Standard @Anycubic i3MegaS", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Creality/machine/Creality CR-10 Max 0.4 nozzle.json b/resources/profiles/Creality/machine/Creality CR-10 Max 0.4 nozzle.json index db31916e0..02c882f6a 100644 --- a/resources/profiles/Creality/machine/Creality CR-10 Max 0.4 nozzle.json +++ b/resources/profiles/Creality/machine/Creality CR-10 Max 0.4 nozzle.json @@ -10,6 +10,9 @@ "Generic PLA @Creality" ], "default_print_profile": "0.20mm Standard @Creality CR10Max", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Creality/machine/Creality CR-10 V2 0.4 nozzle.json b/resources/profiles/Creality/machine/Creality CR-10 V2 0.4 nozzle.json index 84bd95c19..2174cfd3b 100644 --- a/resources/profiles/Creality/machine/Creality CR-10 V2 0.4 nozzle.json +++ b/resources/profiles/Creality/machine/Creality CR-10 V2 0.4 nozzle.json @@ -7,6 +7,9 @@ "inherits": "fdm_creality_common", "printer_model": "Creality CR-10 V2", "default_print_profile": "0.20mm Standard @Creality CR10V2", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Creality/machine/Creality Ender-3 V2 0.4 nozzle.json b/resources/profiles/Creality/machine/Creality Ender-3 V2 0.4 nozzle.json index b106800c3..11f3f6087 100644 --- a/resources/profiles/Creality/machine/Creality Ender-3 V2 0.4 nozzle.json +++ b/resources/profiles/Creality/machine/Creality Ender-3 V2 0.4 nozzle.json @@ -10,6 +10,9 @@ "Generic PLA @Creality" ], "default_print_profile": "0.20mm Standard @Creality Ender3V2", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Creality/machine/Creality Ender-6 0.4 nozzle.json b/resources/profiles/Creality/machine/Creality Ender-6 0.4 nozzle.json index 71c815656..df2c38e7e 100644 --- a/resources/profiles/Creality/machine/Creality Ender-6 0.4 nozzle.json +++ b/resources/profiles/Creality/machine/Creality Ender-6 0.4 nozzle.json @@ -7,6 +7,9 @@ "inherits": "fdm_creality_common", "printer_model": "Creality Ender-6", "default_print_profile": "0.20mm Standard @Creality Ender6", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Prusa/machine/Prusa MINI 0.4 nozzle.json b/resources/profiles/Prusa/machine/Prusa MINI 0.4 nozzle.json index a8986f0ca..63cf0c416 100644 --- a/resources/profiles/Prusa/machine/Prusa MINI 0.4 nozzle.json +++ b/resources/profiles/Prusa/machine/Prusa MINI 0.4 nozzle.json @@ -10,6 +10,9 @@ "Generic PLA @Prusa" ], "default_print_profile": "0.20mm Standard @MINI", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Voxelab/machine/Voxelab Aquila X2 0.4 nozzle.json b/resources/profiles/Voxelab/machine/Voxelab Aquila X2 0.4 nozzle.json index a1694481f..13a767572 100644 --- a/resources/profiles/Voxelab/machine/Voxelab Aquila X2 0.4 nozzle.json +++ b/resources/profiles/Voxelab/machine/Voxelab Aquila X2 0.4 nozzle.json @@ -7,6 +7,9 @@ "inherits": "fdm_machine_common", "printer_model": "Voxelab Aquila X2", "default_print_profile": "0.20mm Standard @Voxelab AquilaX2", + "extruder_type": [ + "Bowden" + ], "nozzle_diameter": [ "0.4" ], diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index fe85d5513..83ba9e9a1 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -837,7 +837,7 @@ static std::vector s_Preset_printer_options { "print_host_webui", "printhost_cafile","printhost_port","printhost_authorization_type", "printhost_user", "printhost_password", "printhost_ssl_ignore_revoke", - "use_relative_e_distances" + "use_relative_e_distances", "extruder_type" }; static std::vector s_Preset_sla_print_options { diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 10d9f5984..07ff98b1a 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -305,6 +305,12 @@ static const t_config_enum_values s_keys_map_ZHopType = { }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(ZHopType) +static const t_config_enum_values s_keys_map_ExtruderType = { + { "DirectDrive", etDirectDrive }, + { "Bowden", etBowden } +}; +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(ExtruderType) + static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology) { for (std::pair &kvp : options) @@ -2426,6 +2432,17 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnumsGeneric{ ZHopType::zhtSpiral }); + def = this->add("extruder_type", coEnums); + def->label = L("Type"); + def->tooltip = ("This setting is only used for initial value of manual calibration of presure advance. Bowden extruder usually has larger pa value. This setting doesn't influence normal slicing"); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_values.push_back("DirectDrive"); + def->enum_values.push_back("Bowden"); + def->enum_labels.push_back(L("Direct drive")); + def->enum_labels.push_back(L("Bowden")); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionEnumsGeneric{ ExtruderType::etDirectDrive }); + def = this->add("retract_restart_extra", coFloats); //def->label = L("Extra length on restart"); def->label = "Extra length on restart"; diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index f8c33ed8f..b9b94fad6 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -212,6 +212,12 @@ enum ZHopType { zhtCount }; +// BBS +enum ExtruderType { + etDirectDrive = 0, + etBowden +}; + static std::string bed_type_to_gcode_string(const BedType type) { std::string type_str; @@ -864,6 +870,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, auxiliary_fan)) ((ConfigOptionBool, accel_to_decel_enable)) ((ConfigOptionPercent, accel_to_decel_factor)) + ((ConfigOptionEnumsGeneric, extruder_type)) ) // This object is mapped to Perl as Slic3r::Config::Print. diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 3a0da5faf..e75bbbcf4 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3415,7 +3415,8 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) auto page = add_options_page(page_name, "empty", true); m_pages.insert(m_pages.begin() + n_before_extruders + extruder_idx, page); - auto optgroup = page->new_optgroup(L("Size"), L"param_diameter", -1, true); + auto optgroup = page->new_optgroup(L("Type"), L"param_type", -1, true); + optgroup->append_single_option_line("extruder_type", "", extruder_idx); optgroup->append_single_option_line("nozzle_diameter", "", extruder_idx); optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value) @@ -3654,7 +3655,7 @@ void TabPrinter::toggle_options() bool have_retract_length = m_config->opt_float("retraction_length", i) > 0; //BBS - for (auto el : { "nozzle_diameter", "extruder_offset"}) + for (auto el : {"extruder_type" , "nozzle_diameter", "extruder_offset"}) toggle_option(el, !is_BBL_printer, i); // user can customize travel length if we have retraction length or we"re using