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
This commit is contained in:
zhimin.zeng 2024-09-30 16:42:37 +08:00 committed by lane.wei
parent d9ea1a4b24
commit 20837717d4
2 changed files with 23 additions and 3 deletions

View File

@ -978,8 +978,9 @@ std::vector<int> ToolOrdering::get_recommended_filament_maps(const std::vector<s
used_colors.emplace_back(print_config->filament_colour.get_at(used_filaments[idx]));
auto ams_filament_info = print->get_extruder_filament_info();
std::vector<std::vector<std::string>> ams_colors;
for (auto& arr : ams_filament_info) {
std::vector<std::vector<std::string>> ams_colors(extruder_nums);
for (size_t i = 0; i < ams_filament_info.size(); ++i) {
auto& arr = ams_filament_info[i];
std::vector<std::string>colors;
for (auto& item : arr)
colors.emplace_back(item.option<ConfigOptionStrings>("filament_colour")->get_at(0));

View File

@ -2860,6 +2860,7 @@ struct Plater::priv
return false;
#endif
}
std::vector<std::vector<DynamicPrintConfig>> 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<std::vector<DynamicPrintConfig>> Plater::priv::get_extruder_filament_info()
{
std::vector<std::vector<DynamicPrintConfig>> 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<int> 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));