mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-02-14 04:29:27 -07:00
ENH:support setting nozzle data
jira:[none] Change-Id: I75044d9b5529286e5c32a436a38d2e3c8fcf4d55 (cherry picked from commit 68b314eebd58c486cda79931c52a9bdcb72556a3)
This commit is contained in:
parent
1f9d27d880
commit
0e5d3fd7b8
4 changed files with 40 additions and 25 deletions
|
|
@ -2106,7 +2106,7 @@ int MachineObject::command_set_printer_nozzle(std::string nozzle_type, float dia
|
|||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
int MachineObject::command_set_printer_nozzle2(int id, std::string nozzle_type, float diameter, int flow)
|
||||
int MachineObject::command_set_printer_nozzle2(int id, std::string nozzle_type, float diameter)
|
||||
{
|
||||
nozzle_setting_hold_count = HOLD_COUNT_MAX * 2;
|
||||
BOOST_LOG_TRIVIAL(info) << "command_set_printer_nozzle2, nozzle_type = " << nozzle_type << " diameter = " << diameter;
|
||||
|
|
@ -2114,8 +2114,9 @@ int MachineObject::command_set_printer_nozzle2(int id, std::string nozzle_type,
|
|||
j["print"]["command"] = "set_nozzle";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["id"] = id;
|
||||
j["print"]["type"] = "type";
|
||||
j["print"]["type"] = nozzle_type;
|
||||
j["print"]["diameter"] = diameter;
|
||||
j["print"]["wear"] = 0;
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1045,7 +1045,7 @@ public:
|
|||
int command_pushing(std::string cmd);
|
||||
int command_clean_print_error(std::string task_id, int print_error);
|
||||
int command_set_printer_nozzle(std::string nozzle_type, float diameter);
|
||||
int command_set_printer_nozzle2(int id, std::string nozzle_type, float diameter, int flow);
|
||||
int command_set_printer_nozzle2(int id, std::string nozzle_type, float diameter);
|
||||
int command_get_access_code();
|
||||
int command_select_extruder(int id);
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ void PrintOptionsDialog::update_options(MachineObject* obj_)
|
|||
}
|
||||
|
||||
this->Freeze();
|
||||
|
||||
|
||||
m_cb_first_layer->SetValue(obj_->xcam_first_layer_inspector);
|
||||
m_cb_plate_mark->SetValue(obj_->xcam_buildplate_marker_detector);
|
||||
m_cb_auto_recovery->SetValue(obj_->xcam_auto_recovery_step_loss);
|
||||
|
|
@ -239,7 +239,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
|
|||
if (ai_monitoring_level_list->GetCount() > 0) {
|
||||
ai_monitoring_level_list->SetSelection(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
line_sizer->Add(FromDIP(30), 0, 0, 0);
|
||||
line_sizer->Add(text_ai_monitoring_caption, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
|
|
@ -440,14 +440,14 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
|
|||
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_flow_map[NozzleFlowType::S_FLOW] = _L("Normal flow");
|
||||
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_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;
|
||||
|
|
@ -542,8 +542,8 @@ 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(140), -1), 0, NULL, wxCB_READONLY);
|
||||
multiple_left_nozzle_type_checkbox->Append(_L("Stainless Steel"));
|
||||
multiple_left_nozzle_type_checkbox->Append(_L("Hardened Steel"));
|
||||
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"));
|
||||
|
|
@ -559,6 +559,8 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
|
|||
multiple_left_nozzle_flow->SetMaxSize(wxSize(FromDIP(80), -1));
|
||||
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));
|
||||
|
|
@ -585,8 +587,8 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
|
|||
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(140), -1), 0, NULL, wxCB_READONLY);
|
||||
multiple_right_nozzle_type_checkbox->Append(_L("Stainless Steel"));
|
||||
multiple_right_nozzle_type_checkbox->Append(_L("Hardened Steel"));
|
||||
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);
|
||||
|
||||
auto multiple_right_nozzle_diameter = new Label(multiple_panel, _L("Nozzle Diameter"));
|
||||
|
|
@ -602,6 +604,8 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
|
|||
multiple_right_nozzle_flow->SetMaxSize(wxSize(FromDIP(80), -1));
|
||||
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));
|
||||
|
|
@ -618,7 +622,7 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
|
|||
multiple_sizer->Add(0, 0, 0, wxTOP, FromDIP(40));
|
||||
multiple_sizer->Add(leftTitle, 0, wxLEFT, FromDIP(18));
|
||||
multiple_sizer->Add(multiple_left_line_sizer, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(18));
|
||||
multiple_sizer->Add(0, 0, 0, wxTOP, FromDIP(40));
|
||||
multiple_sizer->Add(0, 0, 0, wxTOP, FromDIP(24));
|
||||
multiple_sizer->Add(rightTitle, 0, wxLEFT, FromDIP(18));
|
||||
multiple_sizer->Add(multiple_right_line_sizer, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(18));
|
||||
multiple_sizer->Add(0, 0, 0, wxTOP, FromDIP(40));
|
||||
|
|
@ -627,6 +631,9 @@ PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent)
|
|||
multiple_panel->Layout();
|
||||
multiple_panel->Fit();
|
||||
|
||||
/*inset data*/
|
||||
|
||||
|
||||
sizer->Add(single_panel, 0, wxEXPAND, 0);
|
||||
sizer->Add(multiple_panel, 0, wxEXPAND, 0);
|
||||
SetSizer(sizer);
|
||||
|
|
@ -664,6 +671,13 @@ 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)
|
||||
|
|
@ -680,10 +694,12 @@ void PrinterPartsDialog::set_nozzle_data(wxCommandEvent& evt)
|
|||
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()) {
|
||||
|
|
@ -709,9 +725,7 @@ void PrinterPartsDialog::set_nozzle_data(wxCommandEvent& evt)
|
|||
nozzle_diameter = std::stof(current_nozzle_diameter_combox->GetStringSelection().ToStdString());
|
||||
nozzle_diameter = round(nozzle_diameter * 10) / 10;
|
||||
|
||||
/*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; }
|
||||
if (!obj->is_enable_np) {
|
||||
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);
|
||||
|
|
@ -780,7 +794,7 @@ bool PrinterPartsDialog::Show(bool show)
|
|||
//left
|
||||
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;
|
||||
auto flow_type = obj->m_extder_data.extders[DEPUTY_NOZZLE_ID].current_nozzle_flow_type;
|
||||
|
||||
multiple_left_nozzle_type_checkbox->Enable();
|
||||
multiple_left_nozzle_diameter_checkbox->Enable();
|
||||
|
|
@ -816,13 +830,13 @@ bool PrinterPartsDialog::Show(bool show)
|
|||
}
|
||||
|
||||
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]);}
|
||||
if (flow_type != NozzleFlowType::NONE_FLOWTYPE) {multiple_left_nozzle_flow_checkbox->SetSelection(nozzle_flow_selection_map[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;
|
||||
flow_type = obj->m_extder_data.extders[MAIN_NOZZLE_ID].current_nozzle_flow_type;
|
||||
|
||||
multiple_right_nozzle_diameter_checkbox->Clear();
|
||||
|
||||
|
|
@ -858,7 +872,7 @@ bool PrinterPartsDialog::Show(bool show)
|
|||
}
|
||||
|
||||
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]); };
|
||||
if (flow_type != NozzleFlowType::NONE_FLOWTYPE) { multiple_right_nozzle_flow_checkbox->SetSelection(nozzle_flow_selection_map[flow_type]); };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ protected:
|
|||
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<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;
|
||||
|
|
@ -65,7 +65,7 @@ public:
|
|||
void update_machine_obj(MachineObject* obj_);
|
||||
bool Show(bool show) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class PrintOptionsDialog : public DPIDialog
|
||||
{
|
||||
|
|
@ -108,7 +108,7 @@ public:
|
|||
|
||||
MachineObject *obj { nullptr };
|
||||
|
||||
std::vector<int> last_stage_list_info;
|
||||
std::vector<int> last_stage_list_info;
|
||||
int m_state{0};
|
||||
void update_options(MachineObject *obj_);
|
||||
void update_machine_obj(MachineObject *obj_);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue