diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 594cf0f3da..06d4659f84 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -1997,6 +1997,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) { std::set printer_names; @@ -2116,9 +2133,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 699017b4c5..c9f787a7aa 100644 --- a/src/libslic3r/PresetBundle.hpp +++ b/src/libslic3r/PresetBundle.hpp @@ -127,6 +127,8 @@ public: void set_is_validation_mode(bool mode) { validation_mode = mode; } void set_vendor_to_validate(std::string vendor) { vendor_to_validate = vendor; } + 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, @@ -188,7 +190,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 c4565463ab..1260b77a74 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -957,6 +957,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; } @@ -1081,6 +1085,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 d2aef0b4ea..67f66b204d 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5536,6 +5536,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));