mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-28 16:53:14 +08:00
ENH:support checking the complete material blacklist
jira:[STUDIO-10749] Change-Id: Iea007cf94a2ecdc21be972fce121c09bef009a03
This commit is contained in:
parent
1866753539
commit
9c364779e0
@ -1117,8 +1117,10 @@ int MachineObject::ams_filament_mapping(
|
|||||||
// mapping algorithm
|
// mapping algorithm
|
||||||
for (int i = 0; i < filaments.size(); i++) {
|
for (int i = 0; i < filaments.size(); i++) {
|
||||||
FilamentInfo info;
|
FilamentInfo info;
|
||||||
info.id = filaments[i].id;
|
info.id = filaments[i].id;
|
||||||
info.tray_id = -1;
|
info.tray_id = -1;
|
||||||
|
info.type = filaments[i].type;
|
||||||
|
info.filament_id = filaments[i].filament_id;
|
||||||
result.push_back(info);
|
result.push_back(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1163,24 +1165,22 @@ int MachineObject::ams_filament_mapping(
|
|||||||
}
|
}
|
||||||
if (picked_src_idx >= 0 && picked_tar_idx >= 0) {
|
if (picked_src_idx >= 0 && picked_tar_idx >= 0) {
|
||||||
auto tray = tray_filaments.find(distance_map[k][picked_tar_idx].tray_id);
|
auto tray = tray_filaments.find(distance_map[k][picked_tar_idx].tray_id);
|
||||||
|
|
||||||
if (tray != tray_filaments.end()) {
|
if (tray != tray_filaments.end()) {
|
||||||
result[picked_src_idx].tray_id = tray->first;
|
result[picked_src_idx].tray_id = tray->first;
|
||||||
result[picked_src_idx].color = tray->second.color;
|
|
||||||
result[picked_src_idx].type = tray->second.type;
|
|
||||||
result[picked_src_idx].distance = tray->second.distance;
|
|
||||||
result[picked_src_idx].filament_id = tray->second.filament_id;
|
|
||||||
result[picked_src_idx].ctype = tray->second.ctype;
|
|
||||||
result[picked_src_idx].colors = tray->second.colors;
|
|
||||||
|
|
||||||
|
result[picked_src_idx].color = tray->second.color;
|
||||||
|
result[picked_src_idx].type = tray->second.type;
|
||||||
|
result[picked_src_idx].distance = tray->second.distance;
|
||||||
|
result[picked_src_idx].filament_id = tray->second.filament_id;
|
||||||
|
result[picked_src_idx].ctype = tray->second.ctype;
|
||||||
|
result[picked_src_idx].colors = tray->second.colors;
|
||||||
|
|
||||||
/*for new ams mapping*/
|
/*for new ams mapping*/
|
||||||
result[picked_src_idx].ams_id = tray->second.ams_id;
|
result[picked_src_idx].ams_id = tray->second.ams_id;
|
||||||
result[picked_src_idx].slot_id = tray->second.slot_id;
|
result[picked_src_idx].slot_id = tray->second.slot_id;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
FilamentInfo info;
|
|
||||||
info.tray_id = -1;
|
|
||||||
}
|
|
||||||
::sprintf(buffer, "ams_mapping, picked F(%02d) AMS(%02d), distance=%6.0f", picked_src_idx+1, picked_tar_idx+1,
|
::sprintf(buffer, "ams_mapping, picked F(%02d) AMS(%02d), distance=%6.0f", picked_src_idx+1, picked_tar_idx+1,
|
||||||
distance_map[picked_src_idx][picked_tar_idx].distance);
|
distance_map[picked_src_idx][picked_tar_idx].distance);
|
||||||
BOOST_LOG_TRIVIAL(info) << std::string(buffer);
|
BOOST_LOG_TRIVIAL(info) << std::string(buffer);
|
||||||
|
@ -67,6 +67,7 @@ enum PrintDialogStatus : unsigned int {
|
|||||||
PrintStatusAmsMappingU0Invalid,
|
PrintStatusAmsMappingU0Invalid,
|
||||||
PrintStatusAmsMappingMixInvalid,
|
PrintStatusAmsMappingMixInvalid,
|
||||||
PrintStatusTPUUnsupportAutoCali,
|
PrintStatusTPUUnsupportAutoCali,
|
||||||
|
PrintStatusHasFilamentInBlackList,
|
||||||
PrintStatusFilamentErrorEnd,
|
PrintStatusFilamentErrorEnd,
|
||||||
|
|
||||||
PrintStatusErrorEnd,//->end error<-
|
PrintStatusErrorEnd,//->end error<-
|
||||||
@ -117,7 +118,7 @@ public:
|
|||||||
static ::std::string get_print_status_info(PrintDialogStatus status);
|
static ::std::string get_print_status_info(PrintDialogStatus status);
|
||||||
|
|
||||||
wxString get_pre_state_msg(PrintDialogStatus status);
|
wxString get_pre_state_msg(PrintDialogStatus status);
|
||||||
bool is_error(PrintDialogStatus status) { return (PrintStatusErrorBegin < status) && (PrintStatusErrorEnd > status); };
|
bool is_error(PrintDialogStatus status) { return (PrintStatusErrorBegin < status) && (PrintStatusErrorEnd > status); };
|
||||||
bool is_error_printer(PrintDialogStatus status) { return (PrintStatusPrinterErrorBegin < status) && (PrintStatusPrinterErrorEnd > status); };
|
bool is_error_printer(PrintDialogStatus status) { return (PrintStatusPrinterErrorBegin < status) && (PrintStatusPrinterErrorEnd > status); };
|
||||||
bool is_error_filament(PrintDialogStatus status) { return (PrintStatusFilamentErrorBegin < status) && (PrintStatusFilamentErrorEnd > status); };
|
bool is_error_filament(PrintDialogStatus status) { return (PrintStatusFilamentErrorBegin < status) && (PrintStatusFilamentErrorEnd > status); };
|
||||||
bool is_warning(PrintDialogStatus status) { return (PrintStatusWarningBegin < status) && (PrintStatusWarningEnd > status); };
|
bool is_warning(PrintDialogStatus status) { return (PrintStatusWarningBegin < status) && (PrintStatusWarningEnd > status); };
|
||||||
|
@ -1725,13 +1725,15 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
|||||||
msg = msg_text;
|
msg = msg_text;
|
||||||
Enable_Refresh_Button(true);
|
Enable_Refresh_Button(true);
|
||||||
Enable_Send_Button(true);
|
Enable_Send_Button(true);
|
||||||
}
|
} else if (status == PrintStatusMixAmsAndVtSlotWarning) {
|
||||||
else if (status == PrintStatusMixAmsAndVtSlotWarning) {
|
|
||||||
Enable_Refresh_Button(true);
|
Enable_Refresh_Button(true);
|
||||||
Enable_Send_Button(true);
|
Enable_Send_Button(true);
|
||||||
} else if (status == PrintStatusTPUUnsupportAutoCali) {
|
} else if (status == PrintStatusTPUUnsupportAutoCali) {
|
||||||
Enable_Refresh_Button(true);
|
Enable_Refresh_Button(true);
|
||||||
Enable_Send_Button(false);
|
Enable_Send_Button(false);
|
||||||
|
} else if (status == PrintStatusHasFilamentInBlackList) {
|
||||||
|
Enable_Refresh_Button(true);
|
||||||
|
Enable_Send_Button(false);
|
||||||
} else if (status == PrintStatusWarningKvalueNotUsed) {
|
} else if (status == PrintStatusWarningKvalueNotUsed) {
|
||||||
Enable_Refresh_Button(true);
|
Enable_Refresh_Button(true);
|
||||||
Enable_Send_Button(true);
|
Enable_Send_Button(true);
|
||||||
@ -1953,7 +1955,6 @@ void SelectMachineDialog::show_errors(wxString &info)
|
|||||||
|
|
||||||
void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool has_slice_warnings = false;
|
bool has_slice_warnings = false;
|
||||||
bool is_printing_block = false;
|
bool is_printing_block = false;
|
||||||
|
|
||||||
@ -2047,11 +2048,6 @@ 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
|
|
||||||
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++) {
|
||||||
|
|
||||||
const auto& ams_id = m_ams_mapping_result[i].get_ams_id();
|
const auto& ams_id = m_ams_mapping_result[i].get_ams_id();
|
||||||
@ -2070,16 +2066,6 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool in_blacklist = false;
|
|
||||||
std::string action;
|
|
||||||
std::string info;
|
|
||||||
DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, filament_id, ams_id, slot_id, "", in_blacklist, action, info);
|
|
||||||
|
|
||||||
if (in_blacklist && action == "prohibition") {
|
|
||||||
has_prohibited_filament = true;
|
|
||||||
prohibited_error = wxString::FromUTF8(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto miter : mapping_result) {
|
for (auto miter : mapping_result) {
|
||||||
//matching
|
//matching
|
||||||
if (miter.id == tid) {
|
if (miter.id == tid) {
|
||||||
@ -2091,12 +2077,6 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_prohibited_filament && obj_->has_ams()) {
|
|
||||||
wxString tpu_tips = prohibited_error;
|
|
||||||
show_errors(tpu_tips);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (has_unknown_filament) {
|
if (has_unknown_filament) {
|
||||||
has_slice_warnings = true;
|
has_slice_warnings = true;
|
||||||
confirm_text.push_back(ConfirmBeforeSendInfo(_L("There are some unknown filaments in the AMS mappings. Please check whether they are the required filaments. If they are okay, press \"Confirm\" to start printing.")));
|
confirm_text.push_back(ConfirmBeforeSendInfo(_L("There are some unknown filaments in the AMS mappings. Please check whether they are the required filaments. If they are okay, press \"Confirm\" to start printing.")));
|
||||||
@ -3439,6 +3419,35 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// filaments check for black list
|
||||||
|
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
|
||||||
|
const auto &ams_id = m_ams_mapping_result[i].get_ams_id();
|
||||||
|
const auto &slot_id = m_ams_mapping_result[i].get_slot_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_brand;
|
||||||
|
|
||||||
|
for (auto fs : m_filaments) {
|
||||||
|
if (fs.id == m_ams_mapping_result[i].id) { filament_brand = m_filaments[i].brand; }
|
||||||
|
}
|
||||||
|
|
||||||
|
bool in_blacklist = false;
|
||||||
|
std::string action;
|
||||||
|
std::string info;
|
||||||
|
|
||||||
|
DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, m_ams_mapping_result[i].filament_id, ams_id, slot_id, "", in_blacklist,
|
||||||
|
action, info);
|
||||||
|
|
||||||
|
if (in_blacklist && action == "prohibition") {
|
||||||
|
std::vector<wxString> error_msg;
|
||||||
|
error_msg.emplace_back(info);
|
||||||
|
show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackList, error_msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** warning check **/
|
/** warning check **/
|
||||||
struct ExtruderStatus
|
struct ExtruderStatus
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user