mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-20 09:53:15 +08:00
ENH: add default item for pa
jira: none Change-Id: I4ad3bd094325bdbd1e6b013a91766214951dc032
This commit is contained in:
parent
791be19547
commit
0c772105f9
@ -13,6 +13,31 @@ namespace Slic3r { namespace GUI {
|
|||||||
|
|
||||||
wxDEFINE_EVENT(EVT_SELECTED_COLOR, wxCommandEvent);
|
wxDEFINE_EVENT(EVT_SELECTED_COLOR, wxCommandEvent);
|
||||||
|
|
||||||
|
static void get_default_k_n_value(const std::string &filament_id, float &k, float &n)
|
||||||
|
{
|
||||||
|
if (filament_id.compare("GFG00") == 0) {
|
||||||
|
// PETG
|
||||||
|
k = 0.04;
|
||||||
|
n = 1.0;
|
||||||
|
} else if (filament_id.compare("GFB00") == 0 || filament_id.compare("GFB50") == 0) {
|
||||||
|
// ABS
|
||||||
|
k = 0.04;
|
||||||
|
n = 1.0;
|
||||||
|
} else if (filament_id.compare("GFU01") == 0) {
|
||||||
|
// TPU
|
||||||
|
k = 0.2;
|
||||||
|
n = 1.0;
|
||||||
|
} else if (filament_id.compare("GFB01") == 0) {
|
||||||
|
// ASA
|
||||||
|
k = 0.04;
|
||||||
|
n = 1.0;
|
||||||
|
} else {
|
||||||
|
// PLA , other
|
||||||
|
k = 0.02;
|
||||||
|
n = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static std::string float_to_string_with_precision(float value, int precision = 3)
|
static std::string float_to_string_with_precision(float value, int precision = 3)
|
||||||
{
|
{
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
@ -76,7 +101,7 @@ void AMSMaterialsSetting::create()
|
|||||||
m_sizer_button->Add(m_button_close, 0, wxALIGN_CENTER, 0);
|
m_sizer_button->Add(m_button_close, 0, wxALIGN_CENTER, 0);
|
||||||
|
|
||||||
m_sizer_main->Add(m_panel_normal, 0, wxALL, FromDIP(2));
|
m_sizer_main->Add(m_panel_normal, 0, wxALL, FromDIP(2));
|
||||||
|
|
||||||
m_sizer_main->Add(m_panel_kn, 0, wxALL, FromDIP(2));
|
m_sizer_main->Add(m_panel_kn, 0, wxALL, FromDIP(2));
|
||||||
|
|
||||||
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(24));
|
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(24));
|
||||||
@ -353,7 +378,7 @@ void AMSMaterialsSetting::create_panel_kn(wxWindow* parent)
|
|||||||
parent->SetSizer(sizer);
|
parent->SetSizer(sizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMSMaterialsSetting::paintEvent(wxPaintEvent &evt)
|
void AMSMaterialsSetting::paintEvent(wxPaintEvent &evt)
|
||||||
{
|
{
|
||||||
auto size = GetSize();
|
auto size = GetSize();
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
@ -368,7 +393,7 @@ AMSMaterialsSetting::~AMSMaterialsSetting()
|
|||||||
m_comboBox_cali_result->Disconnect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(AMSMaterialsSetting::on_select_cali_result), NULL, this);
|
m_comboBox_cali_result->Disconnect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(AMSMaterialsSetting::on_select_cali_result), NULL, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMSMaterialsSetting::input_min_finish()
|
void AMSMaterialsSetting::input_min_finish()
|
||||||
{
|
{
|
||||||
if (m_input_nozzle_min->GetTextCtrl()->GetValue().empty()) return;
|
if (m_input_nozzle_min->GetTextCtrl()->GetValue().empty()) return;
|
||||||
|
|
||||||
@ -421,7 +446,7 @@ void AMSMaterialsSetting::enable_confirm_button(bool en)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!m_is_third) {
|
if (!m_is_third) {
|
||||||
m_tip_readonly->Hide();
|
m_tip_readonly->Hide();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//m_comboBox_filament->Show(en);
|
//m_comboBox_filament->Show(en);
|
||||||
@ -529,7 +554,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
|||||||
std::string vendor_name = vendor->values[0];
|
std::string vendor_name = vendor->values[0];
|
||||||
DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, in_blacklist, action, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (in_blacklist) {
|
if (in_blacklist) {
|
||||||
if (action == "prohibition") {
|
if (action == "prohibition") {
|
||||||
@ -581,7 +606,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
|||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//reset param
|
//reset param
|
||||||
wxString k_text = m_input_k_val->GetTextCtrl()->GetValue();
|
wxString k_text = m_input_k_val->GetTextCtrl()->GetValue();
|
||||||
wxString n_text = m_input_n_val->GetTextCtrl()->GetValue();
|
wxString n_text = m_input_n_val->GetTextCtrl()->GetValue();
|
||||||
@ -709,7 +734,7 @@ void AMSMaterialsSetting::on_picker_color(wxCommandEvent& event)
|
|||||||
set_color(wxColour(color_num>>24&0xFF, color_num>>16&0xFF, color_num>>8&0xFF, color_num&0xFF));
|
set_color(wxColour(color_num>>24&0xFF, color_num>>16&0xFF, color_num>>8&0xFF, color_num&0xFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMSMaterialsSetting::on_clr_picker(wxMouseEvent &event)
|
void AMSMaterialsSetting::on_clr_picker(wxMouseEvent &event)
|
||||||
{
|
{
|
||||||
if(!m_is_third)
|
if(!m_is_third)
|
||||||
return;
|
return;
|
||||||
@ -768,8 +793,8 @@ void AMSMaterialsSetting::update_widgets()
|
|||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AMSMaterialsSetting::Show(bool show)
|
bool AMSMaterialsSetting::Show(bool show)
|
||||||
{
|
{
|
||||||
if (show) {
|
if (show) {
|
||||||
m_button_confirm->SetMinSize(AMS_MATERIALS_SETTING_BUTTON_SIZE);
|
m_button_confirm->SetMinSize(AMS_MATERIALS_SETTING_BUTTON_SIZE);
|
||||||
m_input_nozzle_max->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20)));
|
m_input_nozzle_max->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20)));
|
||||||
@ -793,7 +818,7 @@ bool AMSMaterialsSetting::Show(bool show)
|
|||||||
Fit();
|
Fit();
|
||||||
wxGetApp().UpdateDarkUI(this);
|
wxGetApp().UpdateDarkUI(this);
|
||||||
}
|
}
|
||||||
return DPIDialog::Show(show);
|
return DPIDialog::Show(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_min, wxString temp_max, wxString k, wxString n)
|
void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_min, wxString temp_max, wxString k, wxString n)
|
||||||
@ -819,7 +844,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
|||||||
stream << std::fixed << std::setprecision(1) << obj->nozzle_diameter;
|
stream << std::fixed << std::setprecision(1) << obj->nozzle_diameter;
|
||||||
std::string nozzle_diameter_str = stream.str();
|
std::string nozzle_diameter_str = stream.str();
|
||||||
std::set<std::string> printer_names = preset_bundle->get_printer_names_by_printer_type_and_nozzle(MachineObject::get_preset_printer_model_name(obj->printer_type), nozzle_diameter_str);
|
std::set<std::string> printer_names = preset_bundle->get_printer_names_by_printer_type_and_nozzle(MachineObject::get_preset_printer_model_name(obj->printer_type), nozzle_diameter_str);
|
||||||
|
|
||||||
if (preset_bundle) {
|
if (preset_bundle) {
|
||||||
BOOST_LOG_TRIVIAL(trace) << "system_preset_bundle filament number=" << preset_bundle->filaments.size();
|
BOOST_LOG_TRIVIAL(trace) << "system_preset_bundle filament number=" << preset_bundle->filaments.size();
|
||||||
for (auto filament_it = preset_bundle->filaments.begin(); filament_it != preset_bundle->filaments.end(); filament_it++) {
|
for (auto filament_it = preset_bundle->filaments.begin(); filament_it != preset_bundle->filaments.end(); filament_it++) {
|
||||||
@ -831,7 +856,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
|||||||
if (preset_bundle->filaments.get_preset_base(*filament_it) != &preset || (!filament_it->is_system && !obj->is_support_user_preset)) {
|
if (preset_bundle->filaments.get_preset_base(*filament_it) != &preset || (!filament_it->is_system && !obj->is_support_user_preset)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigOption * printer_opt = filament_it->config.option("compatible_printers");
|
ConfigOption * printer_opt = filament_it->config.option("compatible_printers");
|
||||||
ConfigOptionStrings *printer_strs = dynamic_cast<ConfigOptionStrings *>(printer_opt);
|
ConfigOptionStrings *printer_strs = dynamic_cast<ConfigOptionStrings *>(printer_opt);
|
||||||
for (auto printer_str : printer_strs->values) {
|
for (auto printer_str : printer_strs->values) {
|
||||||
@ -866,7 +891,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
|||||||
if (filament_it->filament_id == ams_filament_id) {
|
if (filament_it->filament_id == ams_filament_id) {
|
||||||
selection_idx = idx;
|
selection_idx = idx;
|
||||||
bambu_filament_name = filament_it->alias;
|
bambu_filament_name = filament_it->alias;
|
||||||
|
|
||||||
|
|
||||||
// update if nozzle_temperature_range is found
|
// update if nozzle_temperature_range is found
|
||||||
ConfigOption *opt_min = filament_it->config.option("nozzle_temperature_range_low");
|
ConfigOption *opt_min = filament_it->config.option("nozzle_temperature_range_low");
|
||||||
@ -890,7 +915,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,7 +937,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
|||||||
else {
|
else {
|
||||||
m_readonly_filament->SetLabel(bambu_filament_name);
|
m_readonly_filament->SetLabel(bambu_filament_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -933,7 +958,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_button_reset->Show();
|
m_button_reset->Show();
|
||||||
//m_button_confirm->Show();
|
//m_button_confirm->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_comboBox_filament->Set(filament_items);
|
m_comboBox_filament->Set(filament_items);
|
||||||
@ -1091,8 +1116,16 @@ 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_comboBox_cali_result->SetValue(wxEmptyString);
|
||||||
|
|
||||||
if (obj->cali_version >= 0) {
|
if (obj->cali_version >= 0) {
|
||||||
|
// add default item
|
||||||
|
PACalibResult default_item;
|
||||||
|
default_item.filament_id = ams_filament_id;
|
||||||
|
default_item.cali_idx = -1;
|
||||||
|
get_default_k_n_value(ams_filament_id, default_item.k_value, default_item.n_coef);
|
||||||
|
m_pa_profile_items.emplace_back(default_item);
|
||||||
|
items.push_back(_L("Default"));
|
||||||
|
|
||||||
m_input_k_val->GetTextCtrl()->SetValue(wxEmptyString);
|
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;
|
||||||
for (auto cali_item : cali_history) {
|
for (auto cali_item : cali_history) {
|
||||||
@ -1109,6 +1142,9 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
|||||||
if (cali_select_idx >= 0) {
|
if (cali_select_idx >= 0) {
|
||||||
m_comboBox_cali_result->SetSelection(cali_select_idx);
|
m_comboBox_cali_result->SetSelection(cali_select_idx);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
m_comboBox_cali_result->SetSelection(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Ams* selected_ams = this->obj->amsList[std::to_string(ams_id)];
|
Ams* selected_ams = this->obj->amsList[std::to_string(ams_id)];
|
||||||
@ -1119,8 +1155,11 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
|||||||
if (cali_select_idx >= 0) {
|
if (cali_select_idx >= 0) {
|
||||||
m_comboBox_cali_result->SetSelection(cali_select_idx);
|
m_comboBox_cali_result->SetSelection(cali_select_idx);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
m_comboBox_cali_result->SetSelection(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cali_select_idx >= 0) {
|
if (cali_select_idx >= 0) {
|
||||||
m_input_k_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[cali_select_idx].k_value));
|
m_input_k_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[cali_select_idx].k_value));
|
||||||
m_input_n_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[cali_select_idx].n_coef));
|
m_input_n_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[cali_select_idx].n_coef));
|
||||||
@ -1138,8 +1177,8 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMSMaterialsSetting::on_dpi_changed(const wxRect &suggested_rect)
|
void AMSMaterialsSetting::on_dpi_changed(const wxRect &suggested_rect)
|
||||||
{
|
{
|
||||||
m_input_nozzle_max->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20)));
|
m_input_nozzle_max->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20)));
|
||||||
m_input_nozzle_min->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20)));
|
m_input_nozzle_min->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20)));
|
||||||
//m_clr_picker->msw_rescale();
|
//m_clr_picker->msw_rescale();
|
||||||
@ -1152,7 +1191,7 @@ void AMSMaterialsSetting::on_dpi_changed(const wxRect &suggested_rect)
|
|||||||
m_button_confirm->SetCornerRadius(FromDIP(12));
|
m_button_confirm->SetCornerRadius(FromDIP(12));
|
||||||
m_button_close->SetMinSize(AMS_MATERIALS_SETTING_BUTTON_SIZE);
|
m_button_close->SetMinSize(AMS_MATERIALS_SETTING_BUTTON_SIZE);
|
||||||
m_button_close->SetCornerRadius(FromDIP(12));
|
m_button_close->SetCornerRadius(FromDIP(12));
|
||||||
this->Refresh();
|
this->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorPicker::ColorPicker(wxWindow* parent, wxWindowID id, const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/)
|
ColorPicker::ColorPicker(wxWindow* parent, wxWindowID id, const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/)
|
||||||
@ -1601,7 +1640,7 @@ void ColorPickerPopup::paintEvent(wxPaintEvent& evt)
|
|||||||
|
|
||||||
void ColorPickerPopup::OnDismiss() {}
|
void ColorPickerPopup::OnDismiss() {}
|
||||||
|
|
||||||
void ColorPickerPopup::Popup()
|
void ColorPickerPopup::Popup()
|
||||||
{
|
{
|
||||||
PopupWindow::Popup();
|
PopupWindow::Popup();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user