ENH: calib support multi_extruder(UI part)

jira: none
Change-Id: I3009c2f8b601dc078cfed787dc3531fc1d4848d6
(cherry picked from commit 11f61abefaca6f0810e76266e50729432a3aa15e)
This commit is contained in:
zhimin.zeng
2024-08-16 14:54:34 +08:00
committed by Noisyfox
parent 250b827e19
commit 4685bf10c9
13 changed files with 636 additions and 81 deletions

View File

@@ -25,58 +25,6 @@ namespace Slic3r { namespace GUI {
// BBS: new layout
constexpr int titleWidth = 20;
// get the param index of cur_exturder
int get_extruder_idx(const DynamicPrintConfig& config, const std::string &opt_key, int cur_extruder_id)
{
if (printer_extruder_options.find(opt_key) != printer_extruder_options.end()) {
return cur_extruder_id;
}
int extruder_count = wxGetApp().preset_bundle->get_printer_extruder_count();
if (extruder_count == 1 || cur_extruder_id == -1)
return 0;
assert(cur_extruder_id < extruder_count);
const DynamicPrintConfig& cur_printer_config = wxGetApp().preset_bundle->printers.get_selected_preset().config;
auto opt_extruder_type = dynamic_cast<const ConfigOptionEnumsGeneric *>(cur_printer_config.option("extruder_type"));
auto opt_nozzle_volume_type = dynamic_cast<const ConfigOptionEnumsGeneric *>(cur_printer_config.option("nozzle_volume_type"));
if (!opt_extruder_type || !opt_nozzle_volume_type)
return 0;
ExtruderType extruder_type = (ExtruderType) (opt_extruder_type->get_at(cur_extruder_id));
NozzleVolumeType nozzle_volume_type = (NozzleVolumeType) (opt_nozzle_volume_type->get_at(cur_extruder_id));
std::string id_name, variant_name;
unsigned int stride = 1;
if (printer_options_with_variant_1.count(opt_key) > 0) { // printer parameter
id_name = "printer_extruder_id";
variant_name = "printer_extruder_variant";
} else if (printer_options_with_variant_2.count(opt_key) > 0) {
id_name = "printer_extruder_id";
variant_name = "printer_extruder_variant";
stride = 2;
} else if (filament_options_with_variant.count(opt_key) > 0) {
//filament don't use id anymore
//id_name = "filament_extruder_id";
variant_name = "filament_extruder_variant";
} else if (print_options_with_variant.count(opt_key) > 0) {
id_name = "print_extruder_id";
variant_name = "print_extruder_variant";
} else {
return 0;
}
// variant index
int variant_index = config.get_index_for_extruder(cur_extruder_id + 1, id_name, extruder_type, nozzle_volume_type, variant_name, stride);
if (variant_index < 0) {
assert(false);
return 0;
}
return variant_index;
}
const t_field& OptionsGroup::build_field(const Option& opt) {
return build_field(opt.opt_id, opt.opt);
}