From 20837717d411016251c4831586b0fa61350a08b2 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Mon, 30 Sep 2024 16:42:37 +0800 Subject: [PATCH] FIX: When the printer is inconsistent with the current preset when the ams is 0/0, should not consider the print connect status jira:none Change-Id: I2288ff15894d5c734a98b830df6678cab2bd12fc --- src/libslic3r/GCode/ToolOrdering.cpp | 5 +++-- src/slic3r/GUI/Plater.cpp | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index d568b7995..2372451c6 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -978,8 +978,9 @@ std::vector ToolOrdering::get_recommended_filament_maps(const std::vectorfilament_colour.get_at(used_filaments[idx])); auto ams_filament_info = print->get_extruder_filament_info(); - std::vector> ams_colors; - for (auto& arr : ams_filament_info) { + std::vector> ams_colors(extruder_nums); + for (size_t i = 0; i < ams_filament_info.size(); ++i) { + auto& arr = ams_filament_info[i]; std::vectorcolors; for (auto& item : arr) colors.emplace_back(item.option("filament_colour")->get_at(0)); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 824cf95ed..1052e4b98 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2860,6 +2860,7 @@ struct Plater::priv return false; #endif } + std::vector> get_extruder_filament_info(); void update_print_volume_state(); void schedule_background_process(); // Update background processing thread from the current config and Model. @@ -5455,6 +5456,24 @@ void Plater::priv::schedule_background_process() this->view3D->get_canvas3d()->set_config(this->config); } +std::vector> Plater::priv::get_extruder_filament_info() +{ + std::vector> filament_infos; + DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager(); + if (!dev) + return filament_infos; + + MachineObject *obj_ = dev->get_selected_machine(); + if (obj_ == nullptr) + return filament_infos; + + if (!obj_->is_multi_extruders()) + return filament_infos; + + filament_infos = wxGetApp().preset_bundle->get_extruder_filament_info(); + return filament_infos; +} + void Plater::priv::update_print_volume_state() { //BBS: use the plate's bounding box instead of the bed's @@ -5546,7 +5565,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()); + background_process.fff_print()->set_extruder_filament_info(get_extruder_filament_info()); } else invalidated = background_process.apply(this->model, wxGetApp().preset_bundle->full_config(false));