From 3dd5a601547485bfcc4188727343a52c30bb6a73 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Sat, 12 Apr 2025 15:58:50 +0800 Subject: [PATCH] ENH: add filament_printable and delete unprintable and printable list jira: none Change-Id: I643ab11831ceac1fe0793510f64b288cbd16415a --- src/BambuStudio.cpp | 60 +++------- src/libslic3r/GCode/ToolOrdering.cpp | 16 +-- src/libslic3r/Preset.cpp | 7 +- src/libslic3r/PresetBundle.cpp | 15 ++- src/libslic3r/PresetBundle.hpp | 3 +- src/libslic3r/Print.cpp | 15 ++- src/libslic3r/PrintConfig.cpp | 22 ++-- src/libslic3r/PrintConfig.hpp | 3 +- src/slic3r/GUI/AMSMaterialsSetting.cpp | 2 +- .../GUI/CalibrationWizardPresetPage.cpp | 2 +- src/slic3r/GUI/DeviceManager.cpp | 111 ++++++++---------- src/slic3r/GUI/DeviceManager.hpp | 3 +- src/slic3r/GUI/PartPlate.cpp | 35 +----- src/slic3r/GUI/SelectMachine.cpp | 5 +- 14 files changed, 122 insertions(+), 177 deletions(-) diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp index a37c3403a..23eddd6f7 100644 --- a/src/BambuStudio.cpp +++ b/src/BambuStudio.cpp @@ -5861,27 +5861,6 @@ int CLI::run(int argc, char **argv) else filament_maps = part_plate->get_real_filament_maps(m_print_config); - std::vector& unprintable_filament_types = m_print_config.option("unprintable_filament_types", true)->values; - std::vector>unprintable_filament_type_list; - unprintable_filament_type_list.resize(new_extruder_count); - for (int index = 0; index < new_extruder_count; index++) - { - std::vector unprintable_list; - if (unprintable_filament_types.size() > index) - unprintable_list = split_string(unprintable_filament_types[index], ','); - unprintable_filament_type_list[index] = unprintable_list; - } - - std::vector & printable_filament_types = m_print_config.option("printable_filament_types", true)->values; - std::vector> printable_filament_type_list; - printable_filament_type_list.resize(new_extruder_count); - for (int index = 0; index < new_extruder_count; index++) { - std::vector printable_list; - if (printable_filament_types.size() > index) - printable_list = split_string(printable_filament_types[index], ','); - printable_filament_type_list[index] = printable_list; - } - for (int index = 0; index < filament_maps.size(); index++) { int filament_extruder = filament_maps[index]; @@ -5894,28 +5873,23 @@ int CLI::run(int argc, char **argv) } for (int f_index = 0; f_index < plate_filaments.size(); f_index++) { - if (plate_filaments[f_index] <= filament_count) { - int filament_extruder = filament_maps[plate_filaments[f_index] - 1]; - std::vector& unprintable_list = unprintable_filament_type_list[filament_extruder-1]; - std::vector& printable_list = printable_filament_type_list[filament_extruder-1]; - std::string filament_type; - m_print_config.get_filament_type(filament_type, plate_filaments[f_index]-1); - if (unprintable_list.size() > 0) - { - auto iter = std::find(unprintable_list.begin(), unprintable_list.end(), filament_type); - if (iter != unprintable_list.end()) { - BOOST_LOG_TRIVIAL(error) << boost::format("plate %1% : filament %2% can not be printed on extruder %3%, under manual mode for multi extruder printer") % (index + 1) %filament_type %filament_extruder; - record_exit_reson(outfile_dir, CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER, index + 1, cli_errors[CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER], sliced_info); - flush_and_exit(CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER); - } - } - if (printable_list.size() > 0) { - auto iter = std::find(printable_list.begin(), printable_list.end(), filament_type); - if (iter == printable_list.end()) { - BOOST_LOG_TRIVIAL(error) << boost::format("plate %1% : filament %2% can not be printed on extruder %3%, under manual mode for multi extruder printer, not in printable filament list") % (index + 1) % filament_type % filament_extruder; - record_exit_reson(outfile_dir, CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER, index + 1, - cli_errors[CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER], sliced_info); - flush_and_exit(CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER); + for (int f_index = 0; f_index < plate_filaments.size(); f_index++) { + if (plate_filaments[f_index] <= filament_count) { + int filament_extruder = filament_maps[plate_filaments[f_index] - 1]; + std::string filament_type; + m_print_config.get_filament_type(filament_type, plate_filaments[f_index] - 1); + auto *filament_printable_status = dynamic_cast(m_print_config.option("filament_printable")); + if (filament_printable_status) { + int status = filament_printable_status->values.at(plate_filaments[f_index] - 1); + if (!(status >> filament_extruder & 1)) { + BOOST_LOG_TRIVIAL(error) + << boost::format( + "plate %1% : filament %2% can not be printed on extruder %3%, under manual mode for multi extruder printer") % + (index + 1) % filament_type % filament_extruder; + record_exit_reson(outfile_dir, CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER, index + 1, + cli_errors[CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER], sliced_info); + flush_and_exit(CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER); + } } } } diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index 4993b6b66..c809bd7fd 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -67,16 +67,12 @@ bool check_filament_printable_after_group(const std::vector &used_ { for (unsigned int filament_id : used_filaments) { std::string filament_type = print_config->filament_type.get_at(filament_id); - for (size_t idx = 0; idx < print_config->unprintable_filament_types.values.size(); ++idx) { - if (filament_maps[filament_id] == idx) { - std::vector limit_types = split_string(print_config->unprintable_filament_types.get_at(idx), ','); - auto iter = std::find(limit_types.begin(), limit_types.end(), filament_type); - if (iter != limit_types.end()) { - std::string extruder_name = idx == 0 ? _L("left") : _L("right"); - std::string error_msg = _L("Grouping error: ") + filament_type + _L(" can not be placed in the ") + extruder_name + _L(" nozzle"); - throw Slic3r::RuntimeError(error_msg); - } - } + int printable_status = print_config->filament_printable.get_at(filament_id); + int extruder_idx = filament_maps[filament_id]; + if (!(printable_status >> extruder_idx & 1)) { + std::string extruder_name = extruder_idx == 0 ? _L("left") : _L("right"); + std::string error_msg = _L("Grouping error: ") + filament_type + _L(" can not be placed in the ") + extruder_name + _L(" nozzle"); + throw Slic3r::RuntimeError(error_msg); } } return true; diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 407bb9e15..23aa7bd0e 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -906,8 +906,9 @@ static std::vector s_Preset_print_options { "seam_slope_steps", "seam_slope_inner_walls", "role_base_wipe_speed" /*, "seam_slope_gap"*/, "precise_outer_wall", "interlocking_beam", "interlocking_orientation", "interlocking_beam_layer_count", "interlocking_depth", "interlocking_boundary_avoidance", "interlocking_beam_width"}; -static std::vector s_Preset_filament_options { - /*"filament_colour", */ "default_filament_colour","required_nozzle_HRC","filament_diameter", "filament_type", "filament_soluble", "filament_is_support","filament_scarf_seam_type", "filament_scarf_height", "filament_scarf_gap","filament_scarf_length", +static std::vector s_Preset_filament_options {/*"filament_colour", */ "default_filament_colour", "required_nozzle_HRC", "filament_diameter", "filament_type", + "filament_soluble", "filament_is_support", "filament_printable", "filament_scarf_seam_type", "filament_scarf_height", + "filament_scarf_gap", "filament_scarf_length", "filament_max_volumetric_speed", "impact_strength_z", "filament_ramming_volumetric_speed", "filament_flow_ratio", "filament_density", "filament_adhesiveness_category", "filament_cost", "filament_minimal_purge_on_wipe_tower", "nozzle_temperature", "nozzle_temperature_initial_layer", @@ -953,7 +954,7 @@ static std::vector s_Preset_printer_options { "single_extruder_multi_material", "machine_start_gcode", "machine_end_gcode","printing_by_object_gcode","before_layer_change_gcode", "layer_change_gcode", "time_lapse_gcode", "change_filament_gcode", "printer_model", "printer_variant", "printer_extruder_id", "printer_extruder_variant", "extruder_variant_list", "default_nozzle_volume_type", "printable_height", "extruder_printable_height", "extruder_clearance_dist_to_rod", "extruder_clearance_max_radius","extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod", - "nozzle_height", "printable_filament_types", "unprintable_filament_types","master_extruder_id", + "nozzle_height", "master_extruder_id", "default_print_profile", "inherits", "silent_mode", // BBS diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index da551e14a..8efbe40fa 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -330,7 +330,7 @@ Semver PresetBundle::get_vendor_profile_version(std::string vendor_name) return result_ver; } -std::optional PresetBundle::get_filament_by_filament_id(const std::string& filament_id) const +std::optional PresetBundle::get_filament_by_filament_id(const std::string& filament_id, const std::string& printer_name) const { if (filament_id.empty()) return std::nullopt; @@ -356,7 +356,18 @@ std::optional PresetBundle::get_filament_by_filament_id(const info.nozzle_temp_range_high = config.option("nozzle_temperature_range_high")->values[0]; if (config.has("nozzle_temperature_range_low")) info.nozzle_temp_range_low = config.option("nozzle_temperature_range_low")->values[0]; - return info; + + if (!printer_name.empty()) { + std::vector compatible_printers = config.option("compatible_printers")->values; + auto iter = std::find(compatible_printers.begin(), compatible_printers.end(), printer_name); + if (iter != compatible_printers.end() && config.has("filament_printable")) { + info.filament_printable = config.option("filament_printable")->values[0]; + return info; + } + } + else { + return info; + } } } return std::nullopt; diff --git a/src/libslic3r/PresetBundle.hpp b/src/libslic3r/PresetBundle.hpp index 10b0c79c9..7a19cd05a 100644 --- a/src/libslic3r/PresetBundle.hpp +++ b/src/libslic3r/PresetBundle.hpp @@ -59,6 +59,7 @@ struct FilamentBaseInfo int nozzle_temp_range_high{ 220 }; bool is_support{ false }; bool is_system{ true }; + int filament_printable = 3; }; // Bundle of Print + Filament + Printer presets. @@ -122,7 +123,7 @@ public: //BBS: get vendor's current version Semver get_vendor_profile_version(std::string vendor_name); - std::optional get_filament_by_filament_id(const std::string& filament_id) const; + std::optional get_filament_by_filament_id(const std::string& filament_id, const std::string& printer_name = std::string()) const; //BBS: project embedded preset logic PresetsConfigSubstitutions load_project_embedded_presets(std::vector project_presets, ForwardCompatibilitySubstitutionRule substitution_rule); diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 48d1b2d8d..5efdc7d61 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -307,6 +307,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n steps.emplace_back(psSkirtBrim); } else if (opt_key == "filament_soluble" || opt_key == "filament_is_support" + || opt_key == "filament_printable" || opt_key == "impact_strength_z" || opt_key == "filament_scarf_seam_type" || opt_key == "filament_scarf_height" @@ -2530,14 +2531,12 @@ std::vector> Print::get_physical_unprintable_filaments(const std:: if (extruder_num < 2) return physical_unprintables; - auto get_unprintable_extruder_id = [&](unsigned int filament_idx)->int { - if (m_config.unprintable_filament_types.empty()) - return -1; - for (int eid = 0; eid < m_config.unprintable_filament_types.values.size(); ++eid) { - std::vector extruder_unprintables = split_string(m_config.unprintable_filament_types.values[eid], ','); - auto iter = std::find(extruder_unprintables.begin(), extruder_unprintables.end(), m_config.filament_type.values[filament_idx]); - if (iter != extruder_unprintables.end()) - return eid; + auto get_unprintable_extruder_id = [&](unsigned int filament_idx) -> int { + int status = m_config.filament_printable.values[filament_idx]; + for (int i = 0; i < extruder_num; ++i) { + if (!(status >> i & 1)) { + return i; + } } return -1; }; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 23671a4b8..687a10b7a 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -582,18 +582,6 @@ void PrintConfigDef::init_common_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloatsNullable{0}); - def = this->add("unprintable_filament_types", coStrings); - def->label = L("Unprintable filament type"); - def->tooltip = L("Unprintable filament type"); - def->mode = comDevelop; - def->set_default_value(new ConfigOptionStrings{""}); - - def = this->add("printable_filament_types", coStrings); - def->label = L("Printable filament type"); - def->tooltip = L("Printable filament type"); - def->mode = comDevelop; - def->set_default_value(new ConfigOptionStrings{""}); - // Options used by physical printers def = this->add("preset_names", coStrings); @@ -1961,6 +1949,16 @@ void PrintConfigDef::init_fff_params() def->mode = comDevelop; def->set_default_value(new ConfigOptionBools{false}); + // defined in bits + // 0 means cannot support, 1 means support + // 0 bit: can support in left extruder + // 1 bit: can support in right extruder + def = this->add("filament_printable", coInts); + def->label = L("Filament printable"); + def->tooltip = L("The filament is printable in extruder"); + def->mode = comDevelop; + def->set_default_value(new ConfigOptionInts{3}); + // BBS def = this->add("filament_prime_volume", coFloats); def->label = L("Filament prime volume"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 8da9f33aa..b84b902d9 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1031,6 +1031,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBools, filament_soluble)) ((ConfigOptionStrings, filament_ids)) ((ConfigOptionBools, filament_is_support)) + ((ConfigOptionInts, filament_printable)) ((ConfigOptionEnumsGeneric, filament_scarf_seam_type)) ((ConfigOptionFloatsOrPercents, filament_scarf_height)) ((ConfigOptionFloatsOrPercents, filament_scarf_gap)) @@ -1134,8 +1135,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionPoints, bed_exclude_area)) ((ConfigOptionPoints, head_wrap_detect_zone)) // BBS - ((ConfigOptionStrings, unprintable_filament_types)) - ((ConfigOptionStrings, printable_filament_types)) ((ConfigOptionString, bed_custom_texture)) ((ConfigOptionString, bed_custom_model)) ((ConfigOptionEnum, curr_bed_type)) diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index 8749acea5..a93b04977 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -562,7 +562,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event) if (vendor && (vendor->values.size() > 0)) { std::string vendor_name = vendor->values[0]; - DeviceManager::check_filaments_in_blacklist(obj->printer_type, vendor_name, filamnt_type, ams_id, slot_id, it->name, in_blacklist, action, info); + DeviceManager::check_filaments_in_blacklist(obj->printer_type, vendor_name, filamnt_type, it->filament_id, ams_id, slot_id, it->name, in_blacklist, action, info); } if (in_blacklist) { diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp index 53dc3472f..5b38aa0d6 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -1490,7 +1490,7 @@ bool CalibrationPresetPage::is_filament_in_blacklist(int tray_id, Preset* preset auto vendor = dynamic_cast (preset->config.option("filament_vendor")); if (vendor && (vendor->values.size() > 0)) { std::string vendor_name = vendor->values[0]; - DeviceManager::check_filaments_in_blacklist(curr_obj->printer_type, vendor_name, filamnt_type, ams_id, slot_id, "", in_blacklist, action, info); + DeviceManager::check_filaments_in_blacklist(curr_obj->printer_type, vendor_name, filamnt_type, preset->filament_id, ams_id, slot_id, "", in_blacklist, action, info); } if (in_blacklist) { diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 29b6e71df..9796d1110 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -304,6 +304,46 @@ void check_filaments_for_vt_slot(const std::string &tag_vendor, const std::strin } } +bool check_filaments_printable(const std::string &tag_vendor, const std::string &tag_type, const std::string& filament_id, int ams_id, bool &in_blacklist, std::string &ac, std::string &info) +{ + DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager(); + if (!dev) { + return true; + } + + MachineObject *obj = dev->get_selected_machine(); + if (obj == nullptr || !obj->is_multi_extruders()) { + return true; + } + + Preset *printer_preset = GUI::get_printer_preset(obj); + if (!printer_preset) + return true; + + ConfigOptionInts *physical_extruder_map_op = dynamic_cast(printer_preset->config.option("physical_extruder_map")); + if (!physical_extruder_map_op) + return true; + std::vector physical_extruder_maps = physical_extruder_map_op->values; + int extruder_idx = obj->get_extruder_id_by_ams_id(std::to_string(ams_id)); + for (int index = 0; index < physical_extruder_maps.size(); ++index) { + if (physical_extruder_maps[index] == extruder_idx) { + extruder_idx = index; + } + } + + PresetBundle *preset_bundle = GUI::wxGetApp().preset_bundle; + std::optional filament_info = preset_bundle->get_filament_by_filament_id(filament_id, printer_preset->name); + if (filament_info.has_value() && !(filament_info->filament_printable >> extruder_idx & 1)) { + wxString extruder_name = extruder_idx == 0 ? _L("left") : _L("right"); + ac = "prohibition"; + info = (wxString::Format(_L("%s is not supported by %s extruder."), tag_type, extruder_name)).ToUTF8().data(); + in_blacklist = true; + return false; + } + + return true; +} + void AmsTray::update_color_from_str(std::string color) { if (color.empty()) return; @@ -7788,73 +7828,24 @@ void DeviceManager::OnSelectedMachineLost() { GUI::wxGetApp().sidebar().load_ams_list(string(), nullptr); } -bool DeviceManager::check_filaments_printable(const std::string &tag_vendor, const std::string &tag_type, int ams_id, bool &in_blacklist, std::string &ac, std::string &info) -{ - DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager(); - if (!dev) { - return true; - } - MachineObject *obj = dev->get_selected_machine(); - if (obj == nullptr || !obj->is_multi_extruders()) { - return true; - } - Preset *printer_preset = GUI::get_printer_preset(obj); - if (!printer_preset) - return true; - - ConfigOptionInts *physical_extruder_map_op = dynamic_cast(printer_preset->config.option("physical_extruder_map")); - if (!physical_extruder_map_op) - return true; - std::vector physical_extruder_maps = physical_extruder_map_op->values; - - ConfigOptionStrings *unprintable_filament_types_op = dynamic_cast(printer_preset->config.option("unprintable_filament_types")); - if (unprintable_filament_types_op) { - for (size_t idx = 0; idx < unprintable_filament_types_op->values.size(); ++idx) { - if (physical_extruder_maps[idx] == obj->get_extruder_id_by_ams_id(std::to_string(ams_id))) { - std::vector filament_types = split_string(unprintable_filament_types_op->values.at(idx), ','); - auto iter = std::find(filament_types.begin(), filament_types.end(), tag_type); - if (iter != filament_types.end()) { - wxString extruder_name = idx == 0 ? _L("left") : _L("right"); - ac = "prohibition"; - info = (wxString::Format(_L("%s is not supported by %s extruder."), tag_type, extruder_name)).ToUTF8().data(); - in_blacklist = true; - return false; - } - } - } - } - - ConfigOptionStrings *printable_filament_types_op = dynamic_cast(printer_preset->config.option("printable_filament_types")); - if (printable_filament_types_op) { - for (size_t idx = 0; idx < printable_filament_types_op->values.size(); ++idx) { - if (physical_extruder_maps[idx] == obj->get_extruder_id_by_ams_id(std::to_string(ams_id))) { - std::vector filament_types = split_string(printable_filament_types_op->values.at(idx), ','); - if (!filament_types.empty()) { - auto iter = std::find(filament_types.begin(), filament_types.end(), tag_type); - if (iter == filament_types.end()) { - wxString extruder_name = idx == 0 ? _L("left") : _L("right"); - ac = "prohibition"; - info = (wxString::Format(_L("%s is not supported by %s extruder."), tag_type, extruder_name)).ToUTF8().data(); - in_blacklist = true; - return false; - } - } - } - } - } - - return true; -} - -void DeviceManager::check_filaments_in_blacklist(std::string model_id, std::string tag_vendor, std::string tag_type, int ams_id, int slot_id, std::string tag_name, bool& in_blacklist, std::string& ac, std::string& info) +void DeviceManager::check_filaments_in_blacklist(std::string model_id, + std::string tag_vendor, + std::string tag_type, + const std::string &filament_id, + int ams_id, + int slot_id, + std::string tag_name, + bool &in_blacklist, + std::string &ac, + std::string &info) { if (ams_id < 0 || slot_id < 0) { return; } - if (!check_filaments_printable(tag_vendor, tag_type, ams_id, in_blacklist, ac, info)) { + if (!check_filaments_printable(tag_vendor, tag_type, filament_id, ams_id, in_blacklist, ac, info)) { return; } diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 492af82e8..679caccce 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -1488,8 +1488,7 @@ public: static std::vector get_resolution_supported(std::string type_str); static std::vector get_compatible_machine(std::string type_str); static std::vector get_unsupport_auto_cali_filaments(std::string type_str); - static void check_filaments_in_blacklist(std::string model_id, std::string tag_vendor, std::string tag_type, int ams_id, int slot_id, std::string tag_name, bool &in_blacklist, std::string &ac, std::string &info); - static bool check_filaments_printable(const std::string &tag_vendor, const std::string &tag_type, int ams_id, bool &in_blacklist, std::string &ac, std::string &info); + static void check_filaments_in_blacklist(std::string model_id, std::string tag_vendor, std::string tag_type, const std::string& filament_id, int ams_id, int slot_id, std::string tag_name, bool &in_blacklist, std::string &ac, std::string &info); static boost::bimaps::bimap get_all_model_id_with_name(); static std::string load_gcode(std::string type_str, std::string gcode_file); static bool is_virtual_slot(int ams_id); diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index b315cd29c..d65068f37 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -1341,38 +1341,13 @@ bool PartPlate::check_filament_printable(const DynamicPrintConfig &config, wxStr for (auto filament_idx : used_filaments) { int filament_id = filament_idx - 1; std::string filament_type = config.option("filament_type")->values.at(filament_id); + int filament_printable_status = config.option("filament_printable")->values.at(filament_id); std::vector filament_map = get_real_filament_maps(config); int extruder_idx = filament_map[filament_id] - 1; - std::string filament_types_str; - auto unprintable_filament_opt = config.option("unprintable_filament_types"); - if (unprintable_filament_opt) { - auto unprintable_filament_types = unprintable_filament_opt->values; - if (extruder_idx < unprintable_filament_types.size()) - filament_types_str = unprintable_filament_types.at(extruder_idx); - std::vector filament_types = split_string(filament_types_str, ','); - auto iter = std::find(filament_types.begin(), filament_types.end(), filament_type); - if (iter != filament_types.end()) { - wxString extruder_name = extruder_idx == 0 ? _L("left") : _L("right"); - error_message = wxString::Format(_L("The %s nozzle can not print %s."), extruder_name, filament_type); - return false; - } - } - - filament_types_str.clear(); - auto printable_filament_opt = config.option("printable_filament_types"); - if (printable_filament_opt) { - auto printable_filament_types = printable_filament_opt->values; - if (extruder_idx < printable_filament_types.size()) - filament_types_str = printable_filament_types.at(extruder_idx); - std::vector filament_types = split_string(filament_types_str, ','); - if (!filament_types.empty()) { - auto iter = std::find(filament_types.begin(), filament_types.end(), filament_type); - if (iter == filament_types.end()) { - wxString extruder_name = extruder_idx == 0 ? _L("left") : _L("right"); - error_message = wxString::Format(_L("The %s nozzle can not print %s."), extruder_name, filament_type); - return false; - } - } + if (!(filament_printable_status >> extruder_idx & 1)) { + wxString extruder_name = extruder_idx == 0 ? _L("left") : _L("right"); + error_message = wxString::Format(_L("The %s nozzle can not print %s."), extruder_name, filament_type); + return false; } } } diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index ee9dc57a3..6548d4972 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1994,7 +1994,8 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) std::string action; std::string info; - DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, ams_id, slot_id, "", in_blacklist, action, info); + DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, m_ams_mapping_result[i].filament_id, ams_id, slot_id, "", in_blacklist, + action, info); if (in_blacklist && action == "warning") { wxString prohibited_error = wxString::FromUTF8(info); @@ -2072,7 +2073,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) bool in_blacklist = false; std::string action; std::string info; - DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, ams_id, slot_id, "", in_blacklist, action, info); + DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, filament_id, ams_id, slot_id, "", in_blacklist, action, info); if (in_blacklist && action == "prohibition") { has_prohibited_filament = true;