ENH:add new prohibited materials

Change-Id: I621aaf9ceabe11dbedd4e77376f10650be453abf
This commit is contained in:
tao wang 2023-03-28 16:32:05 +08:00 committed by Lane.Wei
parent 6facd65530
commit 27f4c282f2
4 changed files with 63 additions and 6 deletions

View File

@ -7,12 +7,30 @@
"type": "TPU", "type": "TPU",
"action": "prohibition", "action": "prohibition",
"description": "TPU is not supported by AMS." "description": "TPU is not supported by AMS."
},
{
"vendor": "Bambulab",
"type": "TPU",
"action": "prohibition",
"description": "TPU is not supported by AMS."
}, },
{ {
"vendor": "Third Party", "vendor": "Third Party",
"type": "PVA", "type": "PVA",
"action": "warning", "action": "warning",
"description": "Damp PVA will become flexible and get stuck inside AMS,please take care to dry it before use." "description": "Damp PVA will become flexible and get stuck inside AMS,please take care to dry it before use."
},
{
"vendor": "Third Party",
"type": "PLA-CF",
"action": "warning",
"description": "CF/GF filaments are hard and brittle, It's easy to break or get stuck in AMS, please use with caution."
},
{
"vendor": "Third Party",
"type": "PETG-CF",
"action": "warning",
"description": "CF/GF filaments are hard and brittle, It's easy to break or get stuck in AMS, please use with caution."
}, },
{ {
"vendor": "Third Party", "vendor": "Third Party",
@ -22,9 +40,21 @@
}, },
{ {
"vendor": "Third Party", "vendor": "Third Party",
"type": "PLA-CF", "type": "PAHT-CF",
"action": "warning", "action": "warning",
"description": "CF/GF filaments are hard and brittle, It's easy to break or get stuck in AMS, please use with caution." "description": "CF/GF filaments are hard and brittle, It's easy to break or get stuck in AMS, please use with caution."
},
{
"vendor": "Bambulab",
"type": "PET-CF",
"action": "prohibition",
"description": "Bambu PET-CF/PA6-CF is not supported by AMS."
},
{
"vendor": "Bambulab",
"type": "PA6-CF",
"action": "prohibition",
"description": "Bambu PET-CF/PA6-CF is not supported by AMS."
} }
] ]
} }

View File

@ -39,6 +39,7 @@ struct FilamentInfo
std::string type; std::string type;
std::string color; std::string color;
std::string filament_id; std::string filament_id;
std::string brand;
float used_m; float used_m;
float used_g; float used_g;
int tray_id; // start with 0 int tray_id; // start with 0

View File

@ -473,6 +473,9 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
if (ams_filament_id.empty() || nozzle_temp_min.empty() || nozzle_temp_max.empty() || m_filament_type.empty()) { if (ams_filament_id.empty() || nozzle_temp_min.empty() || nozzle_temp_max.empty() || m_filament_type.empty()) {
BOOST_LOG_TRIVIAL(trace) << "Invalid Setting id"; BOOST_LOG_TRIVIAL(trace) << "Invalid Setting id";
MessageDialog msg_dlg(nullptr, _L("You need to select the material type and color firet."), wxEmptyString, wxICON_WARNING | wxOK);
msg_dlg.ShowModal();
return;
} else { } else {
if (obj) { if (obj) {
if (obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { if (obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) {

View File

@ -2068,14 +2068,34 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
auto mapping_result = m_mapping_popup.parse_ams_mapping(obj_->amsList); auto mapping_result = m_mapping_popup.parse_ams_mapping(obj_->amsList);
auto has_unknown_filament = false; auto has_unknown_filament = false;
// check if ams mapping is has errors, tpu // check if ams mapping is has errors, tpu
bool has_tpu_filament = false; bool has_prohibited_filament = false;
wxString prohibited_error = wxEmptyString;
for (auto i = 0; i < m_ams_mapping_result.size(); i++) { for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
auto tid = m_ams_mapping_result[i].tray_id; auto tid = m_ams_mapping_result[i].tray_id;
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type); std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
if (filament_type == "TPU") { std::string filament_brand;
has_tpu_filament = true;
for (auto fs : m_filaments) {
if (fs.id == m_ams_mapping_result[i].id) {
filament_brand = boost::to_upper_copy(m_filaments[i].brand);
}
} }
if (filament_type == "TPU") {
has_prohibited_filament = true;
prohibited_error = wxString::Format(_L("%s is not supported by AMS."), "TPU");
}else if (filament_type == "PET-CF" && filament_brand == "BAMBULAB") {
has_prohibited_filament = true;
prohibited_error = wxString::Format(_L("%s is not supported by AMS."), "PET-CF");
}else if (filament_type == "PA6-CF" && filament_brand == "BAMBULAB") {
has_prohibited_filament = true;
prohibited_error = wxString::Format(_L("%s is not supported by AMS."), "PA6-CF");
}
for (auto miter : mapping_result) { for (auto miter : mapping_result) {
//matching //matching
if (miter.id == tid) { if (miter.id == tid) {
@ -2087,8 +2107,8 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
} }
} }
if (has_tpu_filament && obj_->has_ams() && ams_check->GetValue()) { if (has_prohibited_filament && obj_->has_ams() && ams_check->GetValue()) {
wxString tpu_tips = wxString::Format(_L("The %s filament is too soft to be used with the AMS"), "TPU"); wxString tpu_tips = prohibited_error;
show_errors(tpu_tips); show_errors(tpu_tips);
return; return;
} }
@ -3043,6 +3063,7 @@ void SelectMachineDialog::set_default()
//sizer_thumbnail->Layout(); //sizer_thumbnail->Layout();
std::vector<std::string> materials; std::vector<std::string> materials;
std::vector<std::string> brands;
std::vector<std::string> display_materials; std::vector<std::string> display_materials;
{ {
auto preset_bundle = wxGetApp().preset_bundle; auto preset_bundle = wxGetApp().preset_bundle;
@ -3053,6 +3074,7 @@ void SelectMachineDialog::set_default()
std::string filament_type = iter->config.get_filament_type(display_filament_type); std::string filament_type = iter->config.get_filament_type(display_filament_type);
display_materials.push_back(display_filament_type); display_materials.push_back(display_filament_type);
materials.push_back(filament_type); materials.push_back(filament_type);
brands.push_back(iter->vendor->name);
} }
} }
} }
@ -3147,6 +3169,7 @@ void SelectMachineDialog::set_default()
FilamentInfo info; FilamentInfo info;
info.id = extruder; info.id = extruder;
info.type = materials[extruder]; info.type = materials[extruder];
info.brand = brands[extruder];
info.color = colour_rgb.GetAsString(wxC2S_HTML_SYNTAX).ToStdString(); info.color = colour_rgb.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
m_filaments.push_back(info); m_filaments.push_back(info);
} }