mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 00:52:04 +00:00
Automatically select external spool if it's the only installed filament (#13356)
* Clean up code * Filament mapping select ext slot automatically when no AMS filament inserted (OrcaSlicer/OrcaSlicer#13103) * Show warning if external filament type does not match the one in sliced file
This commit is contained in:
@@ -354,6 +354,27 @@ namespace Slic3r
|
||||
}
|
||||
}
|
||||
|
||||
// Orca: special cases that no AMS available, we select ext slot automatically because we don't have other choice anyway
|
||||
if (tray_filaments.size() == 1 && devPrinterUtil::IsVirtualSlot(tray_filaments.begin()->first)) {
|
||||
auto ext_tray = tray_filaments.begin();
|
||||
for (auto & r : result) {
|
||||
if (r.tray_id < 0) {
|
||||
r.tray_id = ext_tray->first;
|
||||
|
||||
r.color = ext_tray->second.color;
|
||||
r.type = ext_tray->second.type;
|
||||
r.distance = ext_tray->second.distance;
|
||||
r.filament_id = ext_tray->second.filament_id;
|
||||
r.ctype = ext_tray->second.ctype;
|
||||
r.colors = ext_tray->second.colors;
|
||||
|
||||
/*for new ams mapping*/
|
||||
r.ams_id = ext_tray->second.ams_id;
|
||||
r.slot_id = ext_tray->second.slot_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check ams mapping result
|
||||
if (DevMappingUtil::is_valid_mapping_result(obj, result, true))
|
||||
{
|
||||
|
||||
@@ -291,7 +291,6 @@ public:
|
||||
|
||||
bool is_target_slot_unload() const;
|
||||
bool can_unload_filament();
|
||||
bool is_support_amx_ext_mix_mapping() const { return true;}
|
||||
|
||||
void get_ams_colors(std::vector<wxColour>& ams_colors);
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ std::string PrePrintChecker::get_print_status_info(PrintDialogStatus status)
|
||||
case PrintStatusFilamentWarningHighChamberTempCloseDoor: return "PrintStatusFilamentWarningHighChamberTempCloseDoor";
|
||||
case PrintStatusFilamentWarningHighChamberTempSoft: return "PrintStatusFilamentWarningHighChamberTempSoft";
|
||||
case PrintStatusFilamentWarningUnknownHighChamberTempSoft: return "PrintStatusFilamentWarningUnknownHighChamberTempSoft";
|
||||
case PrintStatusWarningExtFilamentNotMatch: return "PrintStatusWarningExtFilamentNotMatch";
|
||||
case PrintStatusReadingFinished: return "PrintStatusReadingFinished";
|
||||
case PrintStatusSendingCanceled: return "PrintStatusSendingCanceled";
|
||||
case PrintStatusAmsMappingSuccess: return "PrintStatusAmsMappingSuccess";
|
||||
@@ -92,6 +93,7 @@ wxString PrePrintChecker::get_pre_state_msg(PrintDialogStatus status)
|
||||
case PrintStatusWarningKvalueNotUsed: return _L("Set dynamic flow calibration to 'OFF' to enable custom dynamic flow value.");
|
||||
case PrintStatusNotSupportedPrintAll: return _L("This printer does not support printing all plates.");
|
||||
case PrintStatusColorQuantityExceed: return _L("The current firmware supports a maximum of 16 materials. You can either reduce the number of materials to 16 or fewer on the Preparation Page, or try updating the firmware. If you are still restricted after the update, please wait for subsequent firmware support.");
|
||||
case PrintStatusWarningExtFilamentNotMatch: return _L("The type of external filament is unknown or does not match with the filament type in the slicing file. Please make sure you have installed the correct filament in the external spool.");
|
||||
}
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ enum PrintDialogStatus : unsigned int {
|
||||
PrintStatusFilamentWarningHighChamberTempCloseDoor,
|
||||
PrintStatusFilamentWarningHighChamberTempSoft,
|
||||
PrintStatusFilamentWarningUnknownHighChamberTempSoft,
|
||||
PrintStatusWarningExtFilamentNotMatch,
|
||||
PrintStatusFilamentWarningEnd,
|
||||
|
||||
PrintStatusWarningEnd,//->end error<-
|
||||
|
||||
@@ -1092,23 +1092,13 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_,bool use_ams)
|
||||
|
||||
//single nozzle
|
||||
else {
|
||||
if (obj_->is_support_amx_ext_mix_mapping()){
|
||||
map_opt = { false, true, false, false }; //four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
|
||||
if (!use_ams) {
|
||||
map_opt[1] = false;
|
||||
map_opt[3] = true;
|
||||
}
|
||||
filament_result = DevMappingUtil::ams_filament_mapping(obj_, m_filaments, m_ams_mapping_result, map_opt);
|
||||
//auto_supply_with_ext(obj_->vt_slot);
|
||||
}
|
||||
else {
|
||||
map_opt = { false, true, false, false };
|
||||
if (!use_ams) {
|
||||
map_opt[1] = false;
|
||||
map_opt[3] = true;
|
||||
}
|
||||
filament_result = DevMappingUtil::ams_filament_mapping(obj_, m_filaments, m_ams_mapping_result, map_opt);
|
||||
map_opt = { false, true, false, false }; //four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
|
||||
if (!use_ams) {
|
||||
map_opt[1] = false;
|
||||
map_opt[3] = true;
|
||||
}
|
||||
filament_result = DevMappingUtil::ams_filament_mapping(obj_, m_filaments, m_ams_mapping_result, map_opt);
|
||||
//auto_supply_with_ext(obj_->vt_slot);
|
||||
}
|
||||
|
||||
if (filament_result == 0) {
|
||||
@@ -1147,7 +1137,7 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_,bool use_ams)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SelectMachineDialog::get_ams_mapping_result(std::string &mapping_array_str, std::string& mapping_array_str2, std::string &ams_mapping_info)
|
||||
bool SelectMachineDialog::get_ams_mapping_result(std::string &mapping_array_str, std::string& mapping_array_str2, std::string &ams_mapping_info) const
|
||||
{
|
||||
if (m_ams_mapping_result.empty())
|
||||
return false;
|
||||
@@ -1438,7 +1428,7 @@ bool SelectMachineDialog::is_nozzle_type_match(DevExtderSystem data, wxString& e
|
||||
return true;
|
||||
}
|
||||
|
||||
int SelectMachineDialog::convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id)
|
||||
int SelectMachineDialog::convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id) const
|
||||
{
|
||||
if (nozzle_id == (int)FilamentMapNozzleId::NOZZLE_LEFT) {
|
||||
return (int)CloudTaskNozzleId::NOZZLE_LEFT;
|
||||
@@ -1691,6 +1681,9 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
||||
} else if (status == PrintDialogStatus::PrintStatusFilamentWarningHighChamberTempSoft || status == PrintDialogStatus::PrintStatusFilamentWarningUnknownHighChamberTempSoft) {
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(true);
|
||||
} else if (status == PrintStatusWarningExtFilamentNotMatch) {
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(true);
|
||||
}
|
||||
|
||||
/*enter perpare mode*/
|
||||
@@ -3458,7 +3451,7 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
||||
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
|
||||
std::string filament_brand;
|
||||
|
||||
for (auto fs : m_filaments) {
|
||||
for (auto& fs : m_filaments) {
|
||||
if (fs.id == m_ams_mapping_result[i].id) { filament_brand = m_filaments[i].brand; }
|
||||
}
|
||||
|
||||
@@ -3520,6 +3513,19 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
||||
}
|
||||
}
|
||||
|
||||
// Orca: show warning if external filament does not match
|
||||
for (auto& m : m_ams_mapping_result) {
|
||||
if (devPrinterUtil::IsVirtualSlot(m.ams_id)) {
|
||||
for (auto& fs : m_filaments) {
|
||||
if (fs.id == m.id && m.type != fs.type) {
|
||||
show_status(PrintDialogStatus::PrintStatusWarningExtFilamentNotMatch);
|
||||
goto ext_mismatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ext_mismatch:
|
||||
|
||||
/*STUDIO-10970 check the k value and flow cali option*/
|
||||
if (m_checkbox_list["flow_cali"]->IsShown() && m_checkbox_list["flow_cali"]->getValue() == "auto") {
|
||||
const auto ¬_default_ams_names = _check_kval_not_default(obj_, m_ams_mapping_result);
|
||||
|
||||
@@ -500,12 +500,12 @@ public:
|
||||
bool Show(bool show);
|
||||
void show_init();
|
||||
bool do_ams_mapping(MachineObject *obj_,bool use_ams);
|
||||
bool get_ams_mapping_result(std::string& mapping_array_str, std::string& mapping_array_str2, std::string& ams_mapping_info);
|
||||
bool get_ams_mapping_result(std::string& mapping_array_str, std::string& mapping_array_str2, std::string& ams_mapping_info) const;
|
||||
bool build_nozzles_info(std::string& nozzles_info);
|
||||
bool can_hybrid_mapping(DevExtderSystem data);
|
||||
void auto_supply_with_ext(std::vector<DevAmsTray> slots);
|
||||
bool is_nozzle_type_match(DevExtderSystem data, wxString& error_message) const;
|
||||
int convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id);
|
||||
int convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id) const;
|
||||
|
||||
PrintFromType get_print_type() {return m_print_type;};
|
||||
wxString format_steel_name(NozzleType type);
|
||||
|
||||
@@ -1261,15 +1261,10 @@ bool SyncAmsInfoDialog::do_ams_mapping(MachineObject *obj_)
|
||||
}
|
||||
// single nozzle
|
||||
else {
|
||||
if (obj_->is_support_amx_ext_mix_mapping()) {
|
||||
map_opt = {false, true, false, true}; // four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
|
||||
filament_result = DevMappingUtil::ams_filament_mapping(obj_, m_filaments, m_ams_mapping_result, map_opt, std::vector<int>(),
|
||||
wxGetApp().app_config->get_bool("ams_sync_match_full_use_color_dist") ? false : true);
|
||||
// auto_supply_with_ext(obj_->vt_slot);
|
||||
} else {
|
||||
map_opt = {false, true, false, false};
|
||||
filament_result = DevMappingUtil::ams_filament_mapping(obj_, m_filaments, m_ams_mapping_result, map_opt);
|
||||
}
|
||||
map_opt = {false, true, false, true}; // four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
|
||||
filament_result = DevMappingUtil::ams_filament_mapping(obj_, m_filaments, m_ams_mapping_result, map_opt, std::vector<int>(),
|
||||
wxGetApp().app_config->get_bool("ams_sync_match_full_use_color_dist") ? false : true);
|
||||
// auto_supply_with_ext(obj_->vt_slot);
|
||||
}
|
||||
|
||||
if (filament_result == 0) {
|
||||
|
||||
Reference in New Issue
Block a user