diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 415f22d70..5e7d4a72c 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -1881,6 +1881,23 @@ void PresetBundle::set_calibrate_printer(std::string name) } } +std::vector> PresetBundle::get_extruder_filament_info() const +{ + std::vector> filament_infos; + int extruder_nums = get_printer_extruder_count(); + if (extruder_nums > 1) { + filament_infos.resize(extruder_nums, std::vector()); + for (auto ams_item : filament_ams_list) { + if (ams_item.first & 0x10000) { // right + filament_infos[1].push_back(ams_item.second); + } else { // left + filament_infos[0].push_back(ams_item.second); + } + } + } + return filament_infos; +} + std::set PresetBundle::get_printer_names_by_printer_type_and_nozzle(const std::string &printer_type, std::string nozzle_diameter_str) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << "printer_type: " << printer_type << "nozzle_diameter_str" << nozzle_diameter_str; @@ -2007,9 +2024,9 @@ bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index) return true; } -int PresetBundle::get_printer_extruder_count() +int PresetBundle::get_printer_extruder_count() const { - Preset& printer_preset = this->printers.get_edited_preset(); + const Preset& printer_preset = this->printers.get_edited_preset(); int count = printer_preset.config.option("nozzle_diameter")->values.size(); diff --git a/src/libslic3r/PresetBundle.hpp b/src/libslic3r/PresetBundle.hpp index b6975b4a8..8e9ac5ef6 100644 --- a/src/libslic3r/PresetBundle.hpp +++ b/src/libslic3r/PresetBundle.hpp @@ -102,6 +102,8 @@ public: void set_calibrate_printer(std::string name); + std::vector> get_extruder_filament_info() const; + std::set get_printer_names_by_printer_type_and_nozzle(const std::string &printer_type, std::string nozzle_diameter_str); bool check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray(const std::string &printer_type, std::string & nozzle_diameter_str, @@ -158,7 +160,7 @@ public: DynamicPrintConfig full_config_secure(std::vector filament_maps = std::vector()) const; //BBS: add some functions for multiple extruders - int get_printer_extruder_count(); + int get_printer_extruder_count() const; bool support_different_extruders(); // Load user configuration and store it into the user profiles. diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index 3d5babc00..4228f7528 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -828,6 +828,10 @@ public: // get the group label of filament size_t get_extruder_id(unsigned int filament_id) const; + const std::vector>& get_extruder_filament_info() const { return m_extruder_filament_info; } + void set_extruder_filament_info(const std::vector>& filament_info) { m_extruder_filament_info = filament_info; } + + // 1 based ids const std::vector>& get_unprintable_filament_ids() const { return m_unprintable_filament_ids; } void set_unprintable_filament_ids(const std::vector> &filament_ids) { m_unprintable_filament_ids = filament_ids; } @@ -936,6 +940,8 @@ private: Polygon m_first_layer_convex_hull; Points m_skirt_convex_hull; + std::vector> m_extruder_filament_info; + // Following section will be consumed by the GCodeGenerator. ToolOrdering m_tool_ordering; WipeTowerData m_wipe_tower_data {m_tool_ordering}; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index b67feef75..095c58d4f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5492,6 +5492,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool PartPlate* cur_plate = background_process.get_current_plate(); std::vector f_maps = cur_plate->get_filament_maps(); invalidated = background_process.apply(this->model, wxGetApp().preset_bundle->full_config(false, f_maps)); + background_process.fff_print()->set_extruder_filament_info(wxGetApp().preset_bundle->get_extruder_filament_info()); } else invalidated = background_process.apply(this->model, wxGetApp().preset_bundle->full_config(false));