ENH: add warning while using PVA with 0.2nozzle

jira: STUDIO-12049
Change-Id: Id60f417a94d447915c93d0d36937853616076f3b
This commit is contained in:
jiaxi.chen 2025-05-09 10:59:25 +08:00 committed by lane.wei
parent 79da9477ea
commit ca4a2059fe
2 changed files with 19 additions and 5 deletions

View File

@ -8446,7 +8446,10 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
Preset::remove_suffix_modified(wx_name.ToUTF8().data())); Preset::remove_suffix_modified(wx_name.ToUTF8().data()));
if (preset_type == Preset::TYPE_FILAMENT) { if (preset_type == Preset::TYPE_FILAMENT) {
std::string old_name = wxGetApp().preset_bundle->filaments.get_edited_preset().name;
wxGetApp().preset_bundle->set_filament_preset(idx, preset_name); wxGetApp().preset_bundle->set_filament_preset(idx, preset_name);
if (!q->on_filament_change(idx))
wxGetApp().preset_bundle->set_filament_preset(idx, old_name);
wxGetApp().plater()->update_project_dirty_from_presets(); wxGetApp().plater()->update_project_dirty_from_presets();
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config); wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
dynamic_filament_list.update(); dynamic_filament_list.update();
@ -8456,7 +8459,6 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
} }
auto select_flag = combo->GetFlag(selection); auto select_flag = combo->GetFlag(selection);
combo->ShowBadge(select_flag == (int)PresetComboBox::FilamentAMSType::FROM_AMS); combo->ShowBadge(select_flag == (int)PresetComboBox::FilamentAMSType::FROM_AMS);
q->on_filament_change(idx);
} }
bool select_preset = !combo->selection_is_changed_according_to_physical_printers(); bool select_preset = !combo->selection_is_changed_according_to_physical_printers();
// TODO: ? // TODO: ?
@ -15218,15 +15220,27 @@ bool Plater::search_string_getter(int idx, const char** label, const char** tool
return false; return false;
} }
void Plater::on_filament_change(size_t filament_idx) bool Plater::on_filament_change(size_t filament_idx)
{ {
auto& filament_presets = wxGetApp().preset_bundle->filament_presets; auto& filament_presets = wxGetApp().preset_bundle->filament_presets;
if (filament_idx >= filament_presets.size()) if (filament_idx >= filament_presets.size())
return; return false;
Slic3r::Preset* filament = wxGetApp().preset_bundle->filaments.find_preset(filament_presets[filament_idx]); Slic3r::Preset* filament = wxGetApp().preset_bundle->filaments.find_preset(filament_presets[filament_idx]);
if (filament == nullptr) if (filament == nullptr)
return; return false;
std::string filament_type = filament->config.option<ConfigOptionStrings>("filament_type")->values[0]; std::string filament_type = filament->config.option<ConfigOptionStrings>("filament_type")->values[0];
if (filament_type == "PVA") {
auto nozzle_diameters = p->config->option<ConfigOptionFloatsNullable>("nozzle_diameter")->values;
if (std::find(nozzle_diameters.begin(), nozzle_diameters.end(), 0.2) != nozzle_diameters.end()) {
wxString msg_text = _(L("It is not recommended to use PVA filaments with 0.2mm nozzles."));
msg_text += "\n" + _(L("Are you sure to use them? \n"));
MessageDialog dialog(wxGetApp().plater(), msg_text, "", wxICON_WARNING | wxYES | wxNO);
if (dialog.ShowModal() == wxID_NO) {
return false;
}
}
}
return true;
} }
// BBS. // BBS.

View File

@ -505,7 +505,7 @@ public:
// BBS: return false if not changed // BBS: return false if not changed
bool leave_gizmos_stack(); bool leave_gizmos_stack();
void on_filament_change(size_t filament_idx); bool on_filament_change(size_t filament_idx);
void on_filament_count_change(size_t extruders_count); void on_filament_count_change(size_t extruders_count);
void on_filaments_delete(size_t extruders_count, size_t filament_id, int replace_filament_id = -1); void on_filaments_delete(size_t extruders_count, size_t filament_id, int replace_filament_id = -1);
std::vector<std::array<float, 4>> get_extruders_colors(); std::vector<std::array<float, 4>> get_extruders_colors();