mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
ENH: support mix mapping
jira: [STUDIO-13673] Change-Id: Ic1c89457f5154c108dbab41850ed49561aa34fde (cherry picked from commit 12942e0545424e2528cc3f3c9aa6947b76469b3d)
This commit is contained in:
@@ -225,7 +225,6 @@ public:
|
||||
std::vector<MappingItem*> m_mapping_item_list;
|
||||
|
||||
bool m_has_unmatch_filament {false};
|
||||
bool m_supporting_mix_print {false}; //For single extruder, can ams and ext print together?
|
||||
int m_current_filament_id;
|
||||
ShowType m_show_type{ShowType::RIGHT};
|
||||
std::string m_tag_material;
|
||||
|
||||
@@ -71,6 +71,9 @@ public:
|
||||
/*extruder*/
|
||||
static bool get_printer_can_set_nozzle(std::string type_str) { return get_value_from_config<bool>(type_str, "enable_set_nozzle_info"); }// can set nozzle from studio
|
||||
|
||||
/*print job*/
|
||||
static bool support_ams_ext_mix_print(std::string type_str) { return get_value_from_config<bool>(type_str, "print", "support_ams_ext_mix_print"); }
|
||||
|
||||
/*calibration*/
|
||||
static std::vector<std::string> get_unsupport_auto_cali_filaments(std::string type_str) { return get_value_from_config<std::vector<std::string>>(type_str, "auto_cali_not_support_filaments"); }
|
||||
|
||||
@@ -103,6 +106,25 @@ public:
|
||||
return T();
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
static T get_value_from_config(const std::string& type_str, const std::string& item1, const std::string& item2)
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto& json_item1 = get_value_from_config<nlohmann::json>(type_str, item1);
|
||||
if (json_item1.contains(item2))
|
||||
{
|
||||
return json_item1[item2].get<T>();
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << " failed to get " << item1 << ", " << item2;
|
||||
}
|
||||
|
||||
return T();
|
||||
}
|
||||
|
||||
static nlohmann::json get_json_from_config(const std::string& type_str, const std::string& key1, const std::string& key2 = std::string())
|
||||
{
|
||||
std::string config_file = m_resource_file_path + "/printers/" + type_str + ".json";
|
||||
|
||||
@@ -3405,12 +3405,12 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_mapping_popup.m_supporting_mix_print && nozzle_nums == 1) {
|
||||
if (!DevPrinterConfigUtil::support_ams_ext_mix_print(obj_->printer_type)) {
|
||||
bool useAms = _HasAms(m_ams_mapping_result);
|
||||
bool useExt = _HasExt(m_ams_mapping_result);
|
||||
if (useAms && useExt) {
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingMixInvalid);
|
||||
return;
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingMixInvalid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2392,19 +2392,6 @@ void SyncAmsInfoDialog::update_show_status()
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_mapping_popup.m_supporting_mix_print && nozzle_nums == 1) {
|
||||
bool useAms = false;
|
||||
bool useExt = false;
|
||||
for (auto iter = m_ams_mapping_result.begin(); iter != m_ams_mapping_result.end(); iter++) {
|
||||
if (iter->tray_id != VIRTUAL_TRAY_MAIN_ID) { useAms = true; }
|
||||
if (iter->tray_id == VIRTUAL_TRAY_MAIN_ID) { useExt = true; }
|
||||
if (useAms && useExt) {
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingMixInvalid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check ams and vt_slot mix use status
|
||||
{
|
||||
struct ExtruderStatus
|
||||
|
||||
Reference in New Issue
Block a user