mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 03:43:52 +00:00
FIX: support set cali nozzle volume type when new cali value
jira: STUDIO-13784 Change-Id: I69278c05af4c1577b1be125f37155452711f851c (cherry picked from commit 80d8bc07fe64d5567133e16c715c7809b558a629) (cherry picked from commit 07bb88b8dae5860b132bb3ed6ee765c81e9a9a7d)
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include "slic3r/Utils/CalibUtils.hpp"
|
#include "slic3r/Utils/CalibUtils.hpp"
|
||||||
#include <wx/gbsizer.h>
|
#include <wx/gbsizer.h>
|
||||||
|
|
||||||
|
#include "Plater.hpp"
|
||||||
#include "DeviceCore/DevExtruderSystem.h"
|
#include "DeviceCore/DevExtruderSystem.h"
|
||||||
#include "DeviceCore/DevManager.h"
|
#include "DeviceCore/DevManager.h"
|
||||||
|
|
||||||
@@ -31,9 +32,25 @@ enum CaliColumnType : int {
|
|||||||
Cali_Type_Count
|
Cali_Type_Count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool support_nozzle_volume(const MachineObject* obj)
|
||||||
|
{
|
||||||
|
if (!obj)
|
||||||
|
return false;
|
||||||
|
Preset * machine_preset = get_printer_preset(obj);
|
||||||
|
if (machine_preset) {
|
||||||
|
int extruder_nums = machine_preset->config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||||
|
auto nozzle_volume_opt = machine_preset->config.option<ConfigOptionFloatsNullable>("nozzle_volume");
|
||||||
|
if (nozzle_volume_opt) {
|
||||||
|
int printer_variant_size = nozzle_volume_opt->values.size();
|
||||||
|
return (printer_variant_size / extruder_nums) > 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int get_colume_idx(CaliColumnType type, MachineObject* obj)
|
int get_colume_idx(CaliColumnType type, MachineObject* obj)
|
||||||
{
|
{
|
||||||
if ((!obj || !obj->is_multi_extruders())
|
if (!support_nozzle_volume(obj)
|
||||||
&& (type > CaliColumnType::Cali_Nozzle)) {
|
&& (type > CaliColumnType::Cali_Nozzle)) {
|
||||||
return type - 1;
|
return type - 1;
|
||||||
}
|
}
|
||||||
@@ -330,7 +347,7 @@ void HistoryWindow::sync_history_data() {
|
|||||||
title_preset_name->SetFont(Label::Head_14);
|
title_preset_name->SetFont(Label::Head_14);
|
||||||
gbSizer->Add(title_preset_name, { 0, get_colume_idx(CaliColumnType::Cali_Filament, curr_obj) }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
gbSizer->Add(title_preset_name, { 0, get_colume_idx(CaliColumnType::Cali_Filament, curr_obj) }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||||
|
|
||||||
if (curr_obj && curr_obj->is_multi_extruders()) {
|
if (support_nozzle_volume(curr_obj)) {
|
||||||
auto nozzle_name = new Label(m_history_data_panel, _L("Nozzle Flow"));
|
auto nozzle_name = new Label(m_history_data_panel, _L("Nozzle Flow"));
|
||||||
nozzle_name->SetFont(Label::Head_14);
|
nozzle_name->SetFont(Label::Head_14);
|
||||||
gbSizer->Add(nozzle_name, {0, get_colume_idx(CaliColumnType::Cali_Nozzle, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
gbSizer->Add(nozzle_name, {0, get_colume_idx(CaliColumnType::Cali_Nozzle, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||||
@@ -413,7 +430,7 @@ void HistoryWindow::sync_history_data() {
|
|||||||
|
|
||||||
gbSizer->Add(name_value, {i, get_colume_idx(CaliColumnType::Cali_Name, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
gbSizer->Add(name_value, {i, get_colume_idx(CaliColumnType::Cali_Name, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||||
gbSizer->Add(preset_name_value, {i, get_colume_idx(CaliColumnType::Cali_Filament, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
gbSizer->Add(preset_name_value, {i, get_colume_idx(CaliColumnType::Cali_Filament, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||||
if (curr_obj && curr_obj->is_multi_extruders()) {
|
if (support_nozzle_volume(curr_obj)) {
|
||||||
wxString nozzle_name = get_nozzle_volume_type_name(result.nozzle_volume_type);
|
wxString nozzle_name = get_nozzle_volume_type_name(result.nozzle_volume_type);
|
||||||
auto nozzle_name_label = new Label(m_history_data_panel, nozzle_name);
|
auto nozzle_name_label = new Label(m_history_data_panel, nozzle_name);
|
||||||
gbSizer->Add(nozzle_name_label, {i, get_colume_idx(CaliColumnType::Cali_Nozzle, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
gbSizer->Add(nozzle_name_label, {i, get_colume_idx(CaliColumnType::Cali_Nozzle, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||||
@@ -520,7 +537,9 @@ EditCalibrationHistoryDialog::EditCalibrationHistoryDialog(wxWindow
|
|||||||
Label *extruder_name_value = new Label(top_panel, extruder_name);
|
Label *extruder_name_value = new Label(top_panel, extruder_name);
|
||||||
flex_sizer->Add(extruder_name_title);
|
flex_sizer->Add(extruder_name_title);
|
||||||
flex_sizer->Add(extruder_name_value);
|
flex_sizer->Add(extruder_name_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support_nozzle_volume(curr_obj)) {
|
||||||
Label *nozzle_name_title = new Label(top_panel, _L("Nozzle"));
|
Label *nozzle_name_title = new Label(top_panel, _L("Nozzle"));
|
||||||
wxString nozzle_name;
|
wxString nozzle_name;
|
||||||
const ConfigOptionDef *nozzle_volume_type_def = print_config_def.get("nozzle_volume_type");
|
const ConfigOptionDef *nozzle_volume_type_def = print_config_def.get("nozzle_volume_type");
|
||||||
@@ -615,7 +634,10 @@ void EditCalibrationHistoryDialog::on_save(wxCommandEvent& event) {
|
|||||||
auto iter = std::find_if(m_history_results.begin(), m_history_results.end(), [this](const PACalibResult &item) {
|
auto iter = std::find_if(m_history_results.begin(), m_history_results.end(), [this](const PACalibResult &item) {
|
||||||
bool has_same_name = item.name == m_new_result.name && item.filament_id == m_new_result.filament_id;
|
bool has_same_name = item.name == m_new_result.name && item.filament_id == m_new_result.filament_id;
|
||||||
if (curr_obj && curr_obj->is_multi_extruders()) {
|
if (curr_obj && curr_obj->is_multi_extruders()) {
|
||||||
has_same_name &= (item.extruder_id == m_new_result.extruder_id && item.nozzle_volume_type == m_new_result.nozzle_volume_type);
|
has_same_name &= (item.extruder_id == m_new_result.extruder_id);
|
||||||
|
}
|
||||||
|
if (support_nozzle_volume(curr_obj)) {
|
||||||
|
has_same_name &= (item.nozzle_volume_type == m_new_result.nozzle_volume_type);
|
||||||
}
|
}
|
||||||
return has_same_name;
|
return has_same_name;
|
||||||
});
|
});
|
||||||
@@ -772,15 +794,15 @@ NewCalibrationHistoryDialog::NewCalibrationHistoryDialog(wxWindow *parent, const
|
|||||||
m_comboBox_extruder->SetSelection(-1);
|
m_comboBox_extruder->SetSelection(-1);
|
||||||
flex_sizer->Add(extruder_name_title);
|
flex_sizer->Add(extruder_name_title);
|
||||||
flex_sizer->Add(m_comboBox_extruder);
|
flex_sizer->Add(m_comboBox_extruder);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support_nozzle_volume(curr_obj)) {
|
||||||
Label *nozzle_name_title = new Label(top_panel, _L("Nozzle"));
|
Label *nozzle_name_title = new Label(top_panel, _L("Nozzle"));
|
||||||
m_comboBox_nozzle_type = new ::ComboBox(top_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, NEW_HISTORY_DIALOG_INPUT_SIZE, 0, nullptr, wxCB_READONLY);
|
m_comboBox_nozzle_type = new ::ComboBox(top_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, NEW_HISTORY_DIALOG_INPUT_SIZE, 0, nullptr, wxCB_READONLY);
|
||||||
wxArrayString nozzle_items;
|
wxArrayString nozzle_items;
|
||||||
const ConfigOptionDef *nozzle_volume_type_def = print_config_def.get("nozzle_volume_type");
|
const ConfigOptionDef *nozzle_volume_type_def = print_config_def.get("nozzle_volume_type");
|
||||||
if (nozzle_volume_type_def && nozzle_volume_type_def->enum_keys_map) {
|
if (nozzle_volume_type_def && nozzle_volume_type_def->enum_keys_map) {
|
||||||
for (auto item : nozzle_volume_type_def->enum_labels) {
|
for (auto item : nozzle_volume_type_def->enum_labels) { nozzle_items.push_back(_L(item)); }
|
||||||
nozzle_items.push_back(_L(item));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m_comboBox_nozzle_type->Set(nozzle_items);
|
m_comboBox_nozzle_type->Set(nozzle_items);
|
||||||
m_comboBox_nozzle_type->SetSelection(-1);
|
m_comboBox_nozzle_type->SetSelection(-1);
|
||||||
@@ -887,14 +909,16 @@ void NewCalibrationHistoryDialog::on_ok(wxCommandEvent &event)
|
|||||||
msg_dlg.ShowModal();
|
msg_dlg.ShowModal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_new_result.extruder_id = get_extruder_id(m_comboBox_extruder->GetSelection());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support_nozzle_volume(curr_obj)) {
|
||||||
std::string nozzle_name = m_comboBox_nozzle_type->GetValue().ToStdString();
|
std::string nozzle_name = m_comboBox_nozzle_type->GetValue().ToStdString();
|
||||||
if (nozzle_name.empty()) {
|
if (nozzle_name.empty()) {
|
||||||
MessageDialog msg_dlg(nullptr, _L("The nozzle must be selected."), wxEmptyString, wxICON_WARNING | wxOK);
|
MessageDialog msg_dlg(nullptr, _L("The nozzle must be selected."), wxEmptyString, wxICON_WARNING | wxOK);
|
||||||
msg_dlg.ShowModal();
|
msg_dlg.ShowModal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_new_result.extruder_id = get_extruder_id(m_comboBox_extruder->GetSelection());
|
|
||||||
m_new_result.nozzle_volume_type = NozzleVolumeType(m_comboBox_nozzle_type->GetSelection());
|
m_new_result.nozzle_volume_type = NozzleVolumeType(m_comboBox_nozzle_type->GetSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -916,7 +940,10 @@ void NewCalibrationHistoryDialog::on_ok(wxCommandEvent &event)
|
|||||||
auto iter = std::find_if(m_history_results.begin(), m_history_results.end(), [this](const PACalibResult &item) {
|
auto iter = std::find_if(m_history_results.begin(), m_history_results.end(), [this](const PACalibResult &item) {
|
||||||
bool has_same_name = item.name == m_new_result.name && item.filament_id == m_new_result.filament_id;
|
bool has_same_name = item.name == m_new_result.name && item.filament_id == m_new_result.filament_id;
|
||||||
if (curr_obj && curr_obj->is_multi_extruders()) {
|
if (curr_obj && curr_obj->is_multi_extruders()) {
|
||||||
has_same_name &= (item.extruder_id == m_new_result.extruder_id && item.nozzle_volume_type == m_new_result.nozzle_volume_type);
|
has_same_name &= (item.extruder_id == m_new_result.extruder_id);
|
||||||
|
}
|
||||||
|
if (support_nozzle_volume(curr_obj)) {
|
||||||
|
has_same_name &= (item.nozzle_volume_type == m_new_result.nozzle_volume_type);
|
||||||
}
|
}
|
||||||
return has_same_name;
|
return has_same_name;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user