ENH: remove nozzle setting

jira: [STUDIO-11598]
Change-Id: Ia10fc3bd67b61a28480b38eef0c28a088c10135e
This commit is contained in:
xin.zhang 2025-04-16 12:22:55 +08:00 committed by lane.wei
parent 4b96f09a75
commit 9b585239f7
10 changed files with 47 additions and 352 deletions

View File

@ -56,7 +56,7 @@
"printer_series": "series_x1",
"has_cali_line": true,
"printer_is_enclosed": true,
"enable_set_nozzle_info": true
"enable_set_nozzle_info": false
},
"01.01.01.00": {
"print": {

View File

@ -56,7 +56,7 @@
"printer_series": "series_x1",
"has_cali_line": true,
"printer_is_enclosed": true,
"enable_set_nozzle_info": true
"enable_set_nozzle_info": false
},
"01.01.01.00": {
"print": {

View File

@ -52,7 +52,7 @@
"printer_series": "series_p1p",
"has_cali_line": false,
"printer_is_enclosed": false,
"enable_set_nozzle_info": true
"enable_set_nozzle_info": false
},
"01.02.00.00": {
"print": {

View File

@ -52,7 +52,7 @@
"printer_series": "series_p1p",
"has_cali_line": false,
"printer_is_enclosed": true,
"enable_set_nozzle_info": true
"enable_set_nozzle_info": false
},
"01.02.99.10": {
"print": {

View File

@ -60,7 +60,7 @@
"printer_series": "series_x1",
"has_cali_line": true,
"printer_is_enclosed": true,
"enable_set_nozzle_info": true
"enable_set_nozzle_info": false
},
"01.05.06.06": {
"rv2166": "00.00.21.20"

View File

@ -52,7 +52,7 @@
"printer_series": "series_n",
"has_cali_line": false,
"printer_is_enclosed": false,
"enable_set_nozzle_info": true
"enable_set_nozzle_info": false
},
"01.01.50.01": {
"print": {

View File

@ -52,7 +52,7 @@
"printer_series": "series_n",
"has_cali_line": false,
"printer_is_enclosed": false,
"enable_set_nozzle_info": true
"enable_set_nozzle_info": false
},
"01.01.50.01": {
"print": {

View File

@ -1 +1 @@
02.00.00.13
02.00.00.14

View File

@ -560,25 +560,6 @@ bool PrintOptionsDialog::Show(bool show)
PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
: DPIDialog(parent, wxID_ANY, _L("Printer Parts"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
{
nozzle_type_map[NozzleType::ntHardenedSteel] = _L("Hardened Steel");
nozzle_type_map[NozzleType::ntStainlessSteel] = _L("Stainless Steel");
nozzle_flow_map[NozzleFlowType::S_FLOW] = _L("Standard");
nozzle_flow_map[NozzleFlowType::H_FLOW] = _L("High flow");
nozzle_type_selection_map[NozzleType::ntHardenedSteel] = 0;
nozzle_type_selection_map[NozzleType::ntStainlessSteel] = 1;
nozzle_flow_selection_map[NozzleFlowType::S_FLOW] = 0;
nozzle_flow_selection_map[NozzleFlowType::H_FLOW] = 1;
nozzle_stainless_diameter_map[0] = 0.2;
nozzle_stainless_diameter_map[1] = 0.4;
nozzle_hard_diameter_map[0] = 0.4;
nozzle_hard_diameter_map[1] = 0.6;
nozzle_hard_diameter_map[2] = 0.8;
SetBackgroundColour(*wxWHITE);
wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
@ -605,20 +586,7 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
nozzle_type->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
nozzle_type->Wrap(-1);
ID_NOZZLE_TYPE_CHECKBOX_SINGLE = wxNewId();
ID_NOZZLE_TYPE_CHECKBOX_LEFT = wxNewId();
ID_NOZZLE_TYPE_CHECKBOX_RIGHT = wxNewId();
ID_NOZZLE_DIAMETER_CHECKBOX_SINGLE = wxNewId();
ID_NOZZLE_DIAMETER_CHECKBOX_LEFT = wxNewId();
ID_NOZZLE_DIAMETER_CHECKBOX_RIGHT = wxNewId();
ID_NOZZLE_FLOW_CHECKBOX_LEFT = wxNewId();
ID_NOZZLE_FLOW_CHECKBOX_RIGHT = wxNewId();
nozzle_type_checkbox = new ComboBox(single_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(180), -1), 0, NULL, wxCB_READONLY);
nozzle_type_checkbox->Append(nozzle_type_map[NozzleType::ntHardenedSteel]);
nozzle_type_checkbox->Append(nozzle_type_map[NozzleType::ntStainlessSteel]);
nozzle_type_checkbox->SetSelection(0);
line_sizer_nozzle_type->Add(nozzle_type, 0, wxALIGN_CENTER, 5);
line_sizer_nozzle_type->Add(0, 0, 1, wxEXPAND, 5);
@ -669,9 +637,6 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
multiple_left_nozzle_type->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
multiple_left_nozzle_type_checkbox = new ComboBox(multiple_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(180), -1), 0, NULL, wxCB_READONLY);
multiple_left_nozzle_type_checkbox->Append(nozzle_type_map[NozzleType::ntHardenedSteel]);
multiple_left_nozzle_type_checkbox->Append(nozzle_type_map[NozzleType::ntStainlessSteel]);
multiple_left_nozzle_type_checkbox->SetSelection(0);
auto multiple_left_nozzle_diameter = new Label(multiple_panel, _L("Nozzle Diameter"));
multiple_left_nozzle_diameter->SetFont(Label::Body_14);
@ -682,8 +647,6 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
multiple_left_nozzle_flow->SetFont(Label::Body_14);
multiple_left_nozzle_flow->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
multiple_left_nozzle_flow_checkbox = new ComboBox(multiple_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(140), -1), 0, NULL, wxCB_READONLY);
multiple_left_nozzle_flow_checkbox->Append(nozzle_flow_map[NozzleFlowType::S_FLOW]);
multiple_left_nozzle_flow_checkbox->Append(nozzle_flow_map[NozzleFlowType::H_FLOW]);
multiple_left_line_sizer->Add(multiple_left_nozzle_type, 0, wxALIGN_CENTER, 0);
multiple_left_line_sizer->Add(0, 0, 0, wxLEFT, FromDIP(8));
@ -707,10 +670,7 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
multiple_right_nozzle_type->SetFont(Label::Body_14);
multiple_right_nozzle_type->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
multiple_right_nozzle_type_checkbox = new ComboBox(multiple_panel, ID_NOZZLE_TYPE_CHECKBOX_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(180), -1), 0, NULL, wxCB_READONLY);
multiple_right_nozzle_type_checkbox->Append(nozzle_type_map[NozzleType::ntHardenedSteel]);
multiple_right_nozzle_type_checkbox->Append(nozzle_type_map[NozzleType::ntStainlessSteel]);
multiple_right_nozzle_type_checkbox->SetSelection(0);
multiple_right_nozzle_type_checkbox = new ComboBox(multiple_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(180), -1), 0, NULL, wxCB_READONLY);
auto multiple_right_nozzle_diameter = new Label(multiple_panel, _L("Nozzle Diameter"));
multiple_right_nozzle_diameter->SetFont(Label::Body_14);
@ -721,8 +681,6 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
multiple_right_nozzle_flow->SetFont(Label::Body_14);
multiple_right_nozzle_flow->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
multiple_right_nozzle_flow_checkbox = new ComboBox(multiple_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(140), -1), 0, NULL, wxCB_READONLY);
multiple_right_nozzle_flow_checkbox->Append(nozzle_flow_map[NozzleFlowType::S_FLOW]);
multiple_right_nozzle_flow_checkbox->Append(nozzle_flow_map[NozzleFlowType::H_FLOW]);
multiple_right_line_sizer->Add(multiple_right_nozzle_type, 0, wxALIGN_CENTER, 0);
multiple_right_line_sizer->Add(0, 0, 0, wxLEFT, FromDIP(8));
@ -755,8 +713,6 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
multiple_panel->Fit();
/*inset data*/
sizer->Add(single_panel, 0, wxEXPAND, 0);
sizer->Add(multiple_panel, 0, wxEXPAND, 0);
SetSizer(sizer);
@ -766,196 +722,12 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
single_panel->Hide();
wxGetApp().UpdateDlgDarkUI(this);
nozzle_type_checkbox->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
nozzle_diameter_checkbox->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_left_nozzle_type_checkbox->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_left_nozzle_diameter_checkbox->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_left_nozzle_flow_checkbox->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_right_nozzle_type_checkbox->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_right_nozzle_diameter_checkbox->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_right_nozzle_flow_checkbox->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
nozzle_type_checkbox->SetId(ID_NOZZLE_TYPE_CHECKBOX_SINGLE);
multiple_left_nozzle_type_checkbox->SetId(ID_NOZZLE_TYPE_CHECKBOX_LEFT);
multiple_right_nozzle_type_checkbox->SetId(ID_NOZZLE_TYPE_CHECKBOX_RIGHT);
nozzle_diameter_checkbox->SetId(ID_NOZZLE_DIAMETER_CHECKBOX_SINGLE);
multiple_left_nozzle_diameter_checkbox->SetId(ID_NOZZLE_DIAMETER_CHECKBOX_LEFT);
multiple_right_nozzle_diameter_checkbox->SetId(ID_NOZZLE_DIAMETER_CHECKBOX_RIGHT);
multiple_left_nozzle_flow_checkbox->SetId(ID_NOZZLE_FLOW_CHECKBOX_LEFT);
multiple_right_nozzle_flow_checkbox->SetId(ID_NOZZLE_FLOW_CHECKBOX_RIGHT);
}
PrinterPartsDialog::~PrinterPartsDialog()
{
nozzle_type_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
nozzle_diameter_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_left_nozzle_type_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_left_nozzle_diameter_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_left_nozzle_flow_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_right_nozzle_type_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_right_nozzle_diameter_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
multiple_right_nozzle_flow_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_data), NULL, this);
}
void PrinterPartsDialog::set_nozzle_data(wxCommandEvent& evt)
{
ComboBox* current_nozzle_type_combox = nullptr;
ComboBox* current_nozzle_diameter_combox = nullptr;
ComboBox* current_nozzle_flow_combox = nullptr;
int nozzle_id = MAIN_NOZZLE_ID;
if (evt.GetId() == ID_NOZZLE_TYPE_CHECKBOX_SINGLE ||
evt.GetId() == ID_NOZZLE_DIAMETER_CHECKBOX_SINGLE) {
current_nozzle_type_combox = nozzle_type_checkbox;
current_nozzle_diameter_combox = nozzle_diameter_checkbox;
nozzle_id = MAIN_NOZZLE_ID;
} else if ( evt.GetId() == ID_NOZZLE_TYPE_CHECKBOX_LEFT ||
evt.GetId() == ID_NOZZLE_DIAMETER_CHECKBOX_LEFT ||
evt.GetId() == ID_NOZZLE_FLOW_CHECKBOX_LEFT ) {
current_nozzle_type_combox = multiple_left_nozzle_type_checkbox;
current_nozzle_diameter_combox = multiple_left_nozzle_diameter_checkbox;
current_nozzle_flow_combox = multiple_left_nozzle_flow_checkbox;
nozzle_id = DEPUTY_NOZZLE_ID;
} else if ( evt.GetId() == ID_NOZZLE_TYPE_CHECKBOX_RIGHT ||
evt.GetId() == ID_NOZZLE_DIAMETER_CHECKBOX_RIGHT ||
evt.GetId() == ID_NOZZLE_FLOW_CHECKBOX_RIGHT) {
current_nozzle_type_combox = multiple_right_nozzle_type_checkbox;
current_nozzle_diameter_combox = multiple_right_nozzle_diameter_checkbox;
current_nozzle_flow_combox = multiple_right_nozzle_flow_checkbox;
nozzle_id = MAIN_NOZZLE_ID;
}
if (obj) {
try {
auto nozzle_type = NozzleType::ntHardenedSteel;
auto nozzle_diameter = 0.4f;
auto nozzle_flow = NozzleFlowType::NONE_FLOWTYPE;
for (auto sm : nozzle_type_selection_map) {
if (sm.second == current_nozzle_type_combox->GetSelection()) {
nozzle_type = sm.first;
}
}
/*update nozzle diameter*/
if (evt.GetId() == ID_NOZZLE_TYPE_CHECKBOX_SINGLE) {
nozzle_diameter_checkbox->Clear();
std::map<int, float> diameter_map;
if (nozzle_type == NozzleType::ntHardenedSteel) {
diameter_map = nozzle_hard_diameter_map;
} else if (nozzle_type == NozzleType::ntStainlessSteel) {
diameter_map = nozzle_stainless_diameter_map;
}
for (int i = 0; i < diameter_map.size(); i++) { nozzle_diameter_checkbox->Append(wxString::Format(_L("%.1f"), diameter_map[i])); }
nozzle_diameter_checkbox->SetSelection(0);
} else if (evt.GetId() == ID_NOZZLE_TYPE_CHECKBOX_LEFT) {
multiple_left_nozzle_diameter_checkbox->Clear();
std::map<int, float> diameter_map;
if (nozzle_type == NozzleType::ntHardenedSteel) {
diameter_map = nozzle_hard_diameter_map;
} else if (nozzle_type == NozzleType::ntStainlessSteel) {
diameter_map = nozzle_stainless_diameter_map;
}
for (int i = 0; i < diameter_map.size(); i++) { multiple_left_nozzle_diameter_checkbox->Append(wxString::Format(_L("%.1f"), diameter_map[i])); }
multiple_left_nozzle_diameter_checkbox->SetSelection(0);
} else if (evt.GetId() == ID_NOZZLE_TYPE_CHECKBOX_RIGHT) {
multiple_right_nozzle_diameter_checkbox->Clear();
std::map<int, float> diameter_map;
if (nozzle_type == NozzleType::ntHardenedSteel) {
diameter_map = nozzle_hard_diameter_map;
} else if (nozzle_type == NozzleType::ntStainlessSteel) {
diameter_map = nozzle_stainless_diameter_map;
}
for (int i = 0; i < diameter_map.size(); i++) { multiple_right_nozzle_diameter_checkbox->Append(wxString::Format(_L("%.1f"), diameter_map[i])); }
multiple_right_nozzle_diameter_checkbox->SetSelection(0);
}
nozzle_diameter = std::stof(current_nozzle_diameter_combox->GetStringSelection().ToStdString());
nozzle_diameter = round(nozzle_diameter * 10) / 10;
if (current_nozzle_flow_combox) {
for (auto sm : nozzle_flow_selection_map) {
if (sm.second == current_nozzle_flow_combox->GetSelection()) {
nozzle_flow = sm.first;
}
}
}
if (!obj->is_enable_np) {
if (current_nozzle_type_combox && current_nozzle_type_combox->IsShown() && current_nozzle_type_combox->GetValue().IsEmpty()) { return; }
if (current_nozzle_diameter_combox && current_nozzle_diameter_combox->IsShown() && current_nozzle_diameter_combox->GetValue().IsEmpty()) { return; }
obj->m_extder_data.extders[MAIN_NOZZLE_ID].current_nozzle_diameter = nozzle_diameter;
obj->m_extder_data.extders[MAIN_NOZZLE_ID].current_nozzle_type = nozzle_type;
obj->command_set_printer_nozzle(NozzleTypeEumnToStr[nozzle_type], nozzle_diameter);
} else {
std::string nozzle_data = "H";
if (nozzle_flow == NozzleFlowType::S_FLOW) {
nozzle_data += "S";
} else if (nozzle_flow == NozzleFlowType::H_FLOW) {
nozzle_data += "H";
} else {
nozzle_data += "S";/*default to standard*/
BOOST_LOG_TRIVIAL(warning) << "warning: nozzle flow type default to standard!";
}
if (nozzle_type == NozzleType::ntStainlessSteel) {
nozzle_data += "00";
} else if (nozzle_type == NozzleType::ntHardenedSteel) {
nozzle_data += "01";
} else {
BOOST_LOG_TRIVIAL(warning) << "error: nozzle type is unknown!";
return;
}
if (current_nozzle_type_combox && current_nozzle_type_combox->IsShown() && current_nozzle_type_combox->GetValue().IsEmpty()) { return; }
if (current_nozzle_diameter_combox && current_nozzle_diameter_combox->IsShown() && current_nozzle_diameter_combox->GetValue().IsEmpty()) { return; }
if (current_nozzle_flow_combox && current_nozzle_flow_combox->IsShown() && current_nozzle_flow_combox->GetValue().IsEmpty()) { return; }
obj->m_extder_data.extders[nozzle_id].current_nozzle_diameter = nozzle_diameter;
obj->m_extder_data.extders[nozzle_id].current_nozzle_flow_type = nozzle_flow;
obj->m_extder_data.extders[nozzle_id].current_nozzle_type = nozzle_type;
obj->command_set_printer_nozzle2(obj->m_extder_data.extders[nozzle_id].nozzle_id, nozzle_data, nozzle_diameter);
}
} catch (...) {}
}
}
void PrinterPartsDialog::on_dpi_changed(const wxRect& suggested_rect)
{
Fit();
}
void PrinterPartsDialog::update_machine_obj(MachineObject* obj_)
{
if (!obj_)
{
return;
}
obj = obj_;
nozzle_stainless_diameter_map.clear();
if (obj->is_series_o())
{
/*STUDIO-10089 there are only 0.2 stainless nozzle in O series*/
nozzle_stainless_diameter_map[0] = 0.2;
}
else
{
nozzle_stainless_diameter_map[0] = 0.2;
nozzle_stainless_diameter_map[1] = 0.4;
}
}
PrinterPartsDialog::~PrinterPartsDialog() {}
void PrinterPartsDialog::on_dpi_changed(const wxRect& suggested_rect) { Fit(); }
void PrinterPartsDialog::update_machine_obj(MachineObject* obj_) { if (obj_) { obj = obj_; }}
bool PrinterPartsDialog::Show(bool show)
{
if (show) {
@ -963,7 +735,8 @@ bool PrinterPartsDialog::Show(bool show)
CentreOnParent();
/*disable editing*/
EnableEditing(DeviceManager::get_printer_can_set_nozzle(obj->printer_type));
EnableEditing(false);
assert(DeviceManager::get_printer_can_set_nozzle(obj->printer_type) == false);/*editing is not supported*/
if (obj->m_extder_data.extders.size() <= 1) {
single_panel->Show();
@ -971,30 +744,8 @@ bool PrinterPartsDialog::Show(bool show)
auto type = obj->m_extder_data.extders[MAIN_NOZZLE_ID].current_nozzle_type;
auto diameter = obj->m_extder_data.extders[MAIN_NOZZLE_ID].current_nozzle_diameter;
nozzle_diameter_checkbox->Clear();
if (type == NozzleType::ntUndefine) {
nozzle_type_checkbox->SetValue(wxEmptyString);
nozzle_diameter_checkbox->SetValue(wxEmptyString);
} else {
std::map<int, float> diameter_map;
if (type == NozzleType::ntHardenedSteel) {
diameter_map = nozzle_hard_diameter_map;
} else if (type == NozzleType::ntStainlessSteel) {
diameter_map = nozzle_stainless_diameter_map;
}
for (int i = 0; i < diameter_map.size(); i++) {
nozzle_diameter_checkbox->Append(wxString::Format(_L("%.1f"), diameter_map[i]));
if (diameter == diameter_map[i]) {
nozzle_diameter_checkbox->SetSelection(i);
}
}
nozzle_type_checkbox->SetSelection(nozzle_type_selection_map[type]);
}
nozzle_type_checkbox->SetValue(GetString(type));
nozzle_diameter_checkbox->SetValue(GetString(diameter));
} else {
single_panel->Hide();
multiple_panel->Show();
@ -1003,77 +754,17 @@ bool PrinterPartsDialog::Show(bool show)
auto type = obj->m_extder_data.extders[DEPUTY_NOZZLE_ID].current_nozzle_type;
auto diameter = obj->m_extder_data.extders[DEPUTY_NOZZLE_ID].current_nozzle_diameter;
auto flow_type = obj->m_extder_data.extders[DEPUTY_NOZZLE_ID].current_nozzle_flow_type;
multiple_left_nozzle_diameter_checkbox->Clear();
if (type == NozzleType::ntUndefine)
{
multiple_left_nozzle_type_checkbox->SetValue(wxEmptyString);
multiple_left_nozzle_diameter_checkbox->SetValue(wxEmptyString);
multiple_left_nozzle_flow_checkbox->SetValue(wxEmptyString);
}
else
{
std::map<int, float> diameter_map;
if (type == NozzleType::ntHardenedSteel)
{
diameter_map = nozzle_hard_diameter_map;
}
else if (type == NozzleType::ntStainlessSteel)
{
diameter_map = nozzle_stainless_diameter_map;
}
for (int i = 0; i < diameter_map.size(); i++)
{
multiple_left_nozzle_diameter_checkbox->Append(wxString::Format(_L("%.1f"), diameter_map[i]));
if (diameter == diameter_map[i])
{
multiple_left_nozzle_diameter_checkbox->SetSelection(i);
}
}
multiple_left_nozzle_type_checkbox->SetSelection(nozzle_type_selection_map[type]);
if (flow_type != NozzleFlowType::NONE_FLOWTYPE) {multiple_left_nozzle_flow_checkbox->SetSelection(nozzle_flow_selection_map[flow_type]);}
}
multiple_left_nozzle_type_checkbox->SetValue(GetString(type));
multiple_left_nozzle_diameter_checkbox->SetValue(GetString(diameter));
multiple_left_nozzle_flow_checkbox->SetValue(GetString(flow_type));
//right
type = obj->m_extder_data.extders[MAIN_NOZZLE_ID].current_nozzle_type;
diameter = obj->m_extder_data.extders[MAIN_NOZZLE_ID].current_nozzle_diameter;
flow_type = obj->m_extder_data.extders[MAIN_NOZZLE_ID].current_nozzle_flow_type;
multiple_right_nozzle_diameter_checkbox->Clear();
if (type == NozzleType::ntUndefine)
{
multiple_right_nozzle_type_checkbox->SetValue(wxEmptyString);
multiple_right_nozzle_diameter_checkbox->SetValue(wxEmptyString);
multiple_right_nozzle_flow_checkbox->SetValue(wxEmptyString);
}
else
{
std::map<int, float> diameter_map;
if (type == NozzleType::ntHardenedSteel)
{
diameter_map = nozzle_hard_diameter_map;
}
else if (type == NozzleType::ntStainlessSteel)
{
diameter_map = nozzle_stainless_diameter_map;
}
for (int i = 0; i < diameter_map.size(); i++)
{
multiple_right_nozzle_diameter_checkbox->Append(wxString::Format(_L("%.1f"), diameter_map[i]));
if (diameter == diameter_map[i])
{
multiple_right_nozzle_diameter_checkbox->SetSelection(i);
}
}
multiple_right_nozzle_type_checkbox->SetSelection(nozzle_type_selection_map[type]);
if (flow_type != NozzleFlowType::NONE_FLOWTYPE) { multiple_right_nozzle_flow_checkbox->SetSelection(nozzle_flow_selection_map[flow_type]); };
}
multiple_right_nozzle_type_checkbox->SetValue(GetString(type));
multiple_right_nozzle_diameter_checkbox->SetValue(GetString(diameter));
multiple_right_nozzle_flow_checkbox->SetValue(GetString(flow_type));
}
Layout();
@ -1098,4 +789,25 @@ void PrinterPartsDialog::EnableEditing(bool enable) {
change_nozzle_tips->Show(!enable);
multiple_change_nozzle_tips->Show(!enable);
}
wxString PrinterPartsDialog::GetString(NozzleType nozzle_type) const {
switch (nozzle_type) {
case Slic3r::ntHardenedSteel: return _L("Hardened Steel");
case Slic3r::ntStainlessSteel: return _L("Stainless Steel");
default: break;
}
return wxEmptyString;
}
wxString PrinterPartsDialog::GetString(NozzleFlowType nozzle_flow_type) const {
switch (nozzle_flow_type) {
case Slic3r::S_FLOW: return _L("Standard");
case Slic3r::H_FLOW: return _L("High flow");
default: break;
}
return wxEmptyString;
}
}} // namespace Slic3r::GUI

View File

@ -24,17 +24,6 @@ namespace Slic3r { namespace GUI {
class PrinterPartsDialog : public DPIDialog
{
protected:
wxWindowID ID_NOZZLE_TYPE_CHECKBOX_SINGLE;
wxWindowID ID_NOZZLE_TYPE_CHECKBOX_LEFT;
wxWindowID ID_NOZZLE_TYPE_CHECKBOX_RIGHT;
wxWindowID ID_NOZZLE_DIAMETER_CHECKBOX_SINGLE;
wxWindowID ID_NOZZLE_DIAMETER_CHECKBOX_LEFT;
wxWindowID ID_NOZZLE_DIAMETER_CHECKBOX_RIGHT;
wxWindowID ID_NOZZLE_FLOW_CHECKBOX_LEFT;
wxWindowID ID_NOZZLE_FLOW_CHECKBOX_RIGHT;
MachineObject* obj{ nullptr };
ComboBox* nozzle_type_checkbox;
@ -54,19 +43,10 @@ protected:
wxPanel *single_panel;
wxPanel *multiple_panel;
std::string last_nozzle_type;
std::map<NozzleType, wxString> nozzle_type_map;
std::map<NozzleType, int> nozzle_type_selection_map;
std::map<NozzleFlowType, wxString> nozzle_flow_map;
std::map<NozzleFlowType, int> nozzle_flow_selection_map;
std::map<int, float> nozzle_stainless_diameter_map;
std::map<int, float> nozzle_hard_diameter_map;
public:
PrinterPartsDialog(wxWindow* parent);
~PrinterPartsDialog();
void set_nozzle_data(wxCommandEvent& evt);
void on_dpi_changed(const wxRect& suggested_rect) override;
void update_machine_obj(MachineObject* obj_);
bool Show(bool show) override;
@ -74,6 +54,9 @@ public:
private:
void EnableEditing(bool enable);
wxString GetString(NozzleType nozzle_type) const;
wxString GetString(NozzleFlowType nozzle_flow_type) const;
wxString GetString(float diameter) const { return wxString::FromDouble(diameter); };
};