mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 04:37:52 -06:00
ENH:optimize the logic of setting profiles for filaments
Change-Id: Iab4838647dc72c63690f5d465813f82a80df6464
This commit is contained in:
parent
5060f1b123
commit
40e1f8d7dd
2 changed files with 76 additions and 55 deletions
|
@ -442,12 +442,12 @@ void AMSMaterialsSetting::on_select_reset(wxCommandEvent& event) {
|
||||||
if (is_virtual_tray()) {
|
if (is_virtual_tray()) {
|
||||||
obj->command_ams_filament_settings(255, VIRTUAL_TRAY_ID, ams_filament_id, ams_setting_id, std::string(col_buf), m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
obj->command_ams_filament_settings(255, VIRTUAL_TRAY_ID, ams_filament_id, ams_setting_id, std::string(col_buf), m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
||||||
}
|
}
|
||||||
else {
|
else if(m_is_third){
|
||||||
obj->command_ams_filament_settings(ams_id, tray_id, ams_filament_id, ams_setting_id, std::string(col_buf), m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
obj->command_ams_filament_settings(ams_id, tray_id, ams_filament_id, ams_setting_id, std::string(col_buf), m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set k / n value
|
// set k / n value
|
||||||
if (obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) {
|
if (!obj->is_high_printer_type()) {
|
||||||
// set extrusion cali ratio
|
// set extrusion cali ratio
|
||||||
int cali_tray_id = ams_id * 4 + tray_id;
|
int cali_tray_id = ams_id * 4 + tray_id;
|
||||||
|
|
||||||
|
@ -468,6 +468,14 @@ void AMSMaterialsSetting::on_select_reset(wxCommandEvent& event) {
|
||||||
}
|
}
|
||||||
obj->command_extrusion_cali_set(cali_tray_id, "", "", k, n);
|
obj->command_extrusion_cali_set(cali_tray_id, "", "", k, n);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
PACalibIndexInfo select_index_info;
|
||||||
|
select_index_info.tray_id = tray_id;
|
||||||
|
select_index_info.nozzle_diameter = obj->nozzle_diameter;
|
||||||
|
select_index_info.cali_idx = -1;
|
||||||
|
select_index_info.filament_id = ams_filament_id;
|
||||||
|
CalibUtils::select_PA_calib_result(select_index_info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
@ -626,7 +634,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
||||||
PACalibIndexInfo select_index_info;
|
PACalibIndexInfo select_index_info;
|
||||||
select_index_info.tray_id = tray_id;
|
select_index_info.tray_id = tray_id;
|
||||||
select_index_info.nozzle_diameter = obj->nozzle_diameter;
|
select_index_info.nozzle_diameter = obj->nozzle_diameter;
|
||||||
if (m_pa_cali_select_id > 0) {
|
if (m_pa_cali_select_id >= 0) {
|
||||||
select_index_info.cali_idx = m_pa_profile_items[m_pa_cali_select_id].cali_idx;
|
select_index_info.cali_idx = m_pa_profile_items[m_pa_cali_select_id].cali_idx;
|
||||||
select_index_info.filament_id = m_pa_profile_items[m_pa_cali_select_id].filament_id;
|
select_index_info.filament_id = m_pa_profile_items[m_pa_cali_select_id].filament_id;
|
||||||
}
|
}
|
||||||
|
@ -836,48 +844,38 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
||||||
m_comboBox_filament->SetValue(wxEmptyString);
|
m_comboBox_filament->SetValue(wxEmptyString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_virtual_tray() && obj) {
|
if (!sn.empty()) {
|
||||||
m_button_reset->Show();
|
|
||||||
m_button_confirm->Show();
|
|
||||||
update();
|
|
||||||
Layout();
|
|
||||||
Fit();
|
|
||||||
ShowModal();
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (!m_is_third) {
|
|
||||||
m_button_reset->Hide();
|
|
||||||
if (obj && obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) {
|
|
||||||
m_button_confirm->Show();
|
|
||||||
} else {
|
|
||||||
m_button_confirm->Hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_sn_number->SetLabel(sn);
|
m_sn_number->SetLabel(sn);
|
||||||
m_panel_SN->Show();
|
m_panel_SN->Show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_panel_SN->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj) {
|
||||||
|
if (!m_is_third) {
|
||||||
m_comboBox_filament->Hide();
|
m_comboBox_filament->Hide();
|
||||||
m_readonly_filament->Show();
|
m_readonly_filament->Show();
|
||||||
//m_readonly_filament->GetTextCtrl()->SetLabel("Bambu " + filament);
|
|
||||||
m_readonly_filament->SetLabel("Bambu " + filament);
|
m_readonly_filament->SetLabel("Bambu " + filament);
|
||||||
m_input_nozzle_min->GetTextCtrl()->SetValue(temp_min);
|
m_input_nozzle_min->GetTextCtrl()->SetValue(temp_min);
|
||||||
m_input_nozzle_max->GetTextCtrl()->SetValue(temp_max);
|
m_input_nozzle_max->GetTextCtrl()->SetValue(temp_max);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_comboBox_filament->Show();
|
||||||
|
m_readonly_filament->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj->is_high_printer_type()) {
|
||||||
|
m_title_pa_profile->Show();
|
||||||
|
m_comboBox_cali_result->Show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
m_title_pa_profile->Hide();
|
m_title_pa_profile->Hide();
|
||||||
m_comboBox_cali_result->Hide();
|
m_comboBox_cali_result->Hide();
|
||||||
|
|
||||||
update();
|
|
||||||
Layout();
|
|
||||||
Fit();
|
|
||||||
ShowModal();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_button_reset->Show();
|
m_button_reset->Show();
|
||||||
m_button_confirm->Show();
|
m_button_confirm->Show();
|
||||||
m_panel_SN->Hide();
|
|
||||||
m_comboBox_filament->Show();
|
|
||||||
m_readonly_filament->Hide();
|
|
||||||
m_title_pa_profile->Show();
|
|
||||||
m_comboBox_cali_result->Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
@ -901,9 +899,9 @@ void AMSMaterialsSetting::msw_rescale()
|
||||||
void AMSMaterialsSetting::on_select_cali_result(wxCommandEvent &evt)
|
void AMSMaterialsSetting::on_select_cali_result(wxCommandEvent &evt)
|
||||||
{
|
{
|
||||||
m_pa_cali_select_id = evt.GetSelection();
|
m_pa_cali_select_id = evt.GetSelection();
|
||||||
if (m_pa_cali_select_id > 0) {
|
if (m_pa_cali_select_id >= 0) {
|
||||||
m_input_k_val->GetTextCtrl()->SetValue(std::to_string(this->obj->pa_calib_tab[m_pa_cali_select_id - 1].k_value));
|
m_input_k_val->GetTextCtrl()->SetValue(std::to_string(m_pa_profile_items[m_pa_cali_select_id].k_value));
|
||||||
m_input_n_val->GetTextCtrl()->SetValue(std::to_string(this->obj->pa_calib_tab[m_pa_cali_select_id - 1].n_coef));
|
m_input_n_val->GetTextCtrl()->SetValue(std::to_string(m_pa_profile_items[m_pa_cali_select_id].n_coef));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
m_input_k_val->GetTextCtrl()->SetValue(std::to_string(0.00));
|
m_input_k_val->GetTextCtrl()->SetValue(std::to_string(0.00));
|
||||||
|
@ -978,11 +976,12 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
||||||
m_comboBox_cali_result->SetValue(wxEmptyString);
|
m_comboBox_cali_result->SetValue(wxEmptyString);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
m_button_confirm->Enable();
|
|
||||||
m_button_confirm->SetBackgroundColor(m_btn_bg_green);
|
m_button_confirm->SetBackgroundColor(m_btn_bg_green);
|
||||||
m_button_confirm->SetBorderColor(wxColour(0, 174, 66));
|
m_button_confirm->SetBorderColor(wxColour(0, 174, 66));
|
||||||
m_button_confirm->SetTextColor(wxColour("#FFFFFE"));
|
m_button_confirm->SetTextColor(wxColour("#FFFFFE"));
|
||||||
|
m_button_confirm->Enable(true);
|
||||||
|
}
|
||||||
|
|
||||||
//filament id
|
//filament id
|
||||||
ams_filament_id = "";
|
ams_filament_id = "";
|
||||||
|
@ -1000,32 +999,46 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
||||||
|
|
||||||
wxArrayString items;
|
wxArrayString items;
|
||||||
m_pa_profile_items.clear();
|
m_pa_profile_items.clear();
|
||||||
|
m_comboBox_cali_result->SetValue(wxEmptyString);
|
||||||
m_input_k_val->Enable(true);
|
|
||||||
m_input_n_val->Enable(true);
|
|
||||||
|
|
||||||
if (this->obj->is_high_printer_type()) {
|
if (this->obj->is_high_printer_type()) {
|
||||||
|
m_input_k_val->GetTextCtrl()->SetValue(wxEmptyString);
|
||||||
std::vector<PACalibResult> cali_history = this->obj->pa_calib_tab;
|
std::vector<PACalibResult> cali_history = this->obj->pa_calib_tab;
|
||||||
items.push_back("default");
|
|
||||||
for (auto cali_item : cali_history) {
|
for (auto cali_item : cali_history) {
|
||||||
if (cali_item.filament_id == ams_filament_id) {
|
if (cali_item.filament_id == ams_filament_id) {
|
||||||
items.push_back(cali_item.name);
|
items.push_back(cali_item.name);
|
||||||
m_pa_profile_items.push_back(cali_item);
|
m_pa_profile_items.push_back(cali_item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_comboBox_cali_result->Set(items);
|
m_comboBox_cali_result->Set(items);
|
||||||
|
|
||||||
|
if (items.size() <= 0) {
|
||||||
|
m_button_confirm->Disable();
|
||||||
|
m_button_confirm->SetBackgroundColor(wxColour(0x90, 0x90, 0x90));
|
||||||
|
m_button_confirm->SetBorderColor(wxColour(0x90, 0x90, 0x90));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_button_confirm->Enable();
|
||||||
|
m_button_confirm->SetBackgroundColor(m_btn_bg_green);
|
||||||
|
m_button_confirm->SetBorderColor(wxColour(0, 174, 66));
|
||||||
|
m_button_confirm->SetTextColor(wxColour("#FFFFFE"));
|
||||||
|
}
|
||||||
|
|
||||||
if (tray_id == VIRTUAL_TRAY_ID) {
|
if (tray_id == VIRTUAL_TRAY_ID) {
|
||||||
AmsTray selected_tray = this->obj->vt_tray;
|
AmsTray selected_tray = this->obj->vt_tray;
|
||||||
cali_select_idx = CalibUtils::get_selected_calib_idx(m_pa_profile_items,selected_tray.cali_idx);
|
cali_select_idx = CalibUtils::get_selected_calib_idx(m_pa_profile_items,selected_tray.cali_idx);
|
||||||
m_comboBox_cali_result->SetSelection(cali_select_idx + 1);
|
if (cali_select_idx >= 0) {
|
||||||
|
m_comboBox_cali_result->SetSelection(cali_select_idx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Ams* selected_ams = this->obj->amsList[std::to_string(ams_id)];
|
Ams* selected_ams = this->obj->amsList[std::to_string(ams_id)];
|
||||||
AmsTray selected_tray = *selected_ams->trayList[std::to_string(tray_id)];
|
AmsTray selected_tray = *selected_ams->trayList[std::to_string(tray_id)];
|
||||||
cali_select_idx = CalibUtils::get_selected_calib_idx(m_pa_profile_items, selected_tray.cali_idx);
|
cali_select_idx = CalibUtils::get_selected_calib_idx(m_pa_profile_items, selected_tray.cali_idx);
|
||||||
m_comboBox_cali_result->SetSelection(cali_select_idx + 1);
|
if (cali_select_idx >= 0) {
|
||||||
|
m_comboBox_cali_result->SetSelection(cali_select_idx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cali_select_idx >= 0) {
|
if (cali_select_idx >= 0) {
|
||||||
|
@ -1033,7 +1046,16 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
||||||
m_input_n_val->GetTextCtrl()->SetValue(std::to_string(m_pa_profile_items[cali_select_idx].n_coef));
|
m_input_n_val->GetTextCtrl()->SetValue(std::to_string(m_pa_profile_items[cali_select_idx].n_coef));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (!ams_filament_id.empty()) {
|
||||||
|
m_input_k_val->GetTextCtrl()->SetValue("0.00");
|
||||||
|
m_input_k_val->Enable(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_input_k_val->GetTextCtrl()->SetValue("0.00");
|
||||||
|
m_input_k_val->Disable();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMSMaterialsSetting::on_dpi_changed(const wxRect &suggested_rect)
|
void AMSMaterialsSetting::on_dpi_changed(const wxRect &suggested_rect)
|
||||||
|
|
|
@ -2983,12 +2983,11 @@ void StatusPanel::on_filament_edit(wxCommandEvent &event)
|
||||||
tray_id_int = VIRTUAL_TRAY_ID;
|
tray_id_int = VIRTUAL_TRAY_ID;
|
||||||
m_filament_setting_dlg->ams_id = ams_id_int;
|
m_filament_setting_dlg->ams_id = ams_id_int;
|
||||||
m_filament_setting_dlg->tray_id = tray_id_int;
|
m_filament_setting_dlg->tray_id = tray_id_int;
|
||||||
m_filament_setting_dlg->SetPosition(m_ams_control->GetScreenPosition());
|
|
||||||
wxString k_val;
|
wxString k_val;
|
||||||
wxString n_val;
|
wxString n_val;
|
||||||
k_val = wxString::Format("%.3f", obj->vt_tray.k);
|
k_val = wxString::Format("%.3f", obj->vt_tray.k);
|
||||||
n_val = wxString::Format("%.3f", obj->vt_tray.n);
|
n_val = wxString::Format("%.3f", obj->vt_tray.n);
|
||||||
m_filament_setting_dlg->SetPosition(m_ams_control->GetScreenPosition());
|
m_filament_setting_dlg->Move(wxPoint(m_ams_control->GetScreenPosition().x, m_ams_control->GetScreenPosition().y - FromDIP(40)));
|
||||||
m_filament_setting_dlg->Popup(wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString, k_val, n_val);
|
m_filament_setting_dlg->Popup(wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString, k_val, n_val);
|
||||||
} else {
|
} else {
|
||||||
std::string tray_id = event.GetString().ToStdString(); // m_ams_control->GetCurrentCan(ams_id);
|
std::string tray_id = event.GetString().ToStdString(); // m_ams_control->GetCurrentCan(ams_id);
|
||||||
|
@ -3036,7 +3035,7 @@ void StatusPanel::on_filament_edit(wxCommandEvent &event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_filament_setting_dlg->SetPosition(m_ams_control->GetScreenPosition());
|
m_filament_setting_dlg->Move(wxPoint(m_ams_control->GetScreenPosition().x, m_ams_control->GetScreenPosition().y - FromDIP(40)));
|
||||||
m_filament_setting_dlg->Popup(filament, sn_number, temp_min, temp_max, k_val, n_val);
|
m_filament_setting_dlg->Popup(filament, sn_number, temp_min, temp_max, k_val, n_val);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
@ -3081,7 +3080,7 @@ void StatusPanel::on_ext_spool_edit(wxCommandEvent &event)
|
||||||
temp_min = obj->vt_tray.nozzle_temp_min;
|
temp_min = obj->vt_tray.nozzle_temp_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_filament_setting_dlg->SetPosition(m_ams_control->GetScreenPosition());
|
m_filament_setting_dlg->Move(wxPoint(m_ams_control->GetScreenPosition().x, m_ams_control->GetScreenPosition().y - FromDIP(40)));
|
||||||
m_filament_setting_dlg->Popup(filament, sn_number, temp_min, temp_max, k_val, n_val);
|
m_filament_setting_dlg->Popup(filament, sn_number, temp_min, temp_max, k_val, n_val);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue