mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 23:48:44 +03:00
Merge branch 'main' of https://github.com/QIDITECH/QIDISlicer
This commit is contained in:
@@ -15,7 +15,8 @@ enum class CalibMode : int {
|
|||||||
Calib_Temp_Tower,
|
Calib_Temp_Tower,
|
||||||
Calib_Vol_speed_Tower,
|
Calib_Vol_speed_Tower,
|
||||||
Calib_VFA_Tower,
|
Calib_VFA_Tower,
|
||||||
Calib_Retraction_tower
|
Calib_Retraction_tower,
|
||||||
|
Calib_FRF
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Calib_Params {
|
struct Calib_Params {
|
||||||
|
|||||||
@@ -1575,6 +1575,9 @@ void MainFrame::init_menubar_as_editor()
|
|||||||
append_menu_item(flowrate_menu, wxID_ANY, _L("Coarse"), _L("Flow rate test - Pass 1"), [this](wxCommandEvent &) {
|
append_menu_item(flowrate_menu, wxID_ANY, _L("Coarse"), _L("Flow rate test - Pass 1"), [this](wxCommandEvent &) {
|
||||||
if (m_plater)
|
if (m_plater)
|
||||||
m_plater->calib_flowrate(1);
|
m_plater->calib_flowrate(1);
|
||||||
|
m_plater->get_notification_manager()->push_notification(NotificationType::CustomNotification,NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
|
||||||
|
_u8L("NOTICE: The configuration parameters may be changed "
|
||||||
|
"after using the calibration feature. "));
|
||||||
},
|
},
|
||||||
"", nullptr,
|
"", nullptr,
|
||||||
[this]() {
|
[this]() {
|
||||||
@@ -1583,8 +1586,12 @@ void MainFrame::init_menubar_as_editor()
|
|||||||
},
|
},
|
||||||
this);
|
this);
|
||||||
append_menu_item(flowrate_menu, wxID_ANY, _L("Fine"), _L("Flow rate test - Pass 2"), [this](wxCommandEvent &) {
|
append_menu_item(flowrate_menu, wxID_ANY, _L("Fine"), _L("Flow rate test - Pass 2"), [this](wxCommandEvent &) {
|
||||||
if (m_plater)
|
if (!m_frf_calib_dlg)
|
||||||
m_plater->calib_flowrate(2);
|
m_frf_calib_dlg = new FRF_Calibration_Dlg((wxWindow *) this, wxID_ANY, m_plater);
|
||||||
|
m_frf_calib_dlg->ShowModal();
|
||||||
|
m_plater->get_notification_manager()->push_notification(NotificationType::CustomNotification,NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
|
||||||
|
_u8L("NOTICE: The configuration parameters may be changed "
|
||||||
|
"after using the calibration feature. "));
|
||||||
},
|
},
|
||||||
"", nullptr,
|
"", nullptr,
|
||||||
[this]() {
|
[this]() {
|
||||||
@@ -1599,6 +1606,9 @@ void MainFrame::init_menubar_as_editor()
|
|||||||
if (!m_pa_calib_dlg)
|
if (!m_pa_calib_dlg)
|
||||||
m_pa_calib_dlg = new PA_Calibration_Dlg((wxWindow *) this, wxID_ANY, m_plater);
|
m_pa_calib_dlg = new PA_Calibration_Dlg((wxWindow *) this, wxID_ANY, m_plater);
|
||||||
m_pa_calib_dlg->ShowModal();
|
m_pa_calib_dlg->ShowModal();
|
||||||
|
m_plater->get_notification_manager()->push_notification(NotificationType::CustomNotification,NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
|
||||||
|
_u8L("NOTICE: The configuration parameters may be changed "
|
||||||
|
"after using the calibration feature. "));
|
||||||
},
|
},
|
||||||
"", nullptr,
|
"", nullptr,
|
||||||
[this]() {
|
[this]() {
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
Plater *m_plater{nullptr};
|
Plater *m_plater{nullptr};
|
||||||
|
FRF_Calibration_Dlg *m_frf_calib_dlg{nullptr};
|
||||||
//B34
|
//B34
|
||||||
PA_Calibration_Dlg *m_pa_calib_dlg{nullptr};
|
PA_Calibration_Dlg *m_pa_calib_dlg{nullptr};
|
||||||
//B4
|
//B4
|
||||||
|
|||||||
@@ -5404,7 +5404,7 @@ void Plater::add_model_calibration(bool imperial_units /* = false*/, std::string
|
|||||||
//B34
|
//B34
|
||||||
void Plater::calib_flowrate(int pass)
|
void Plater::calib_flowrate(int pass)
|
||||||
{
|
{
|
||||||
if (pass != 1 && pass != 2)
|
if (pass != 1 /*&& pass != 2*/)
|
||||||
return;
|
return;
|
||||||
const auto calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
|
const auto calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
|
||||||
new_project();
|
new_project();
|
||||||
@@ -5432,7 +5432,7 @@ void Plater::calib_flowrate(int pass)
|
|||||||
tab_printer->load_config(new_config);
|
tab_printer->load_config(new_config);
|
||||||
add_model_calibration(false,
|
add_model_calibration(false,
|
||||||
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "FlowRate" / "flowrate_coarse.3mf").string());
|
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "FlowRate" / "flowrate_coarse.3mf").string());
|
||||||
} else {
|
} /*else {
|
||||||
new_config.set_key_value("complete_objects", new ConfigOptionBool(true));
|
new_config.set_key_value("complete_objects", new ConfigOptionBool(true));
|
||||||
new_config.set_key_value("extruder_clearance_radius", new ConfigOptionFloat(1));
|
new_config.set_key_value("extruder_clearance_radius", new ConfigOptionFloat(1));
|
||||||
new_config.set_key_value("between_objects_gcode",
|
new_config.set_key_value("between_objects_gcode",
|
||||||
@@ -5449,8 +5449,45 @@ void Plater::calib_flowrate(int pass)
|
|||||||
tab_printer->load_config(new_config);
|
tab_printer->load_config(new_config);
|
||||||
add_model_calibration(false,
|
add_model_calibration(false,
|
||||||
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "FlowRate" / "flowrate_fine.3mf").string());
|
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "FlowRate" / "flowrate_fine.3mf").string());
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plater::calib_flowrate_f(int pass, const Calib_Params ¶ms)
|
||||||
|
{
|
||||||
|
if (pass != 2)
|
||||||
|
return;
|
||||||
|
const auto calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
|
||||||
|
new_project();
|
||||||
|
wxGetApp().mainframe->select_tab(size_t(0));
|
||||||
|
if (params.mode != CalibMode::Calib_FRF)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Tab *tab_print = wxGetApp().get_tab(Preset::TYPE_PRINT);
|
||||||
|
Tab *tab_filament = wxGetApp().get_tab(Preset::TYPE_FILAMENT);
|
||||||
|
Tab *tab_printer = wxGetApp().get_tab(Preset::TYPE_PRINTER);
|
||||||
|
DynamicPrintConfig new_config;
|
||||||
|
int extru_multip = params.start * 100;
|
||||||
|
new_config.set_key_value("complete_objects", new ConfigOptionBool(true));
|
||||||
|
new_config.set_key_value("extruder_clearance_radius", new ConfigOptionFloat(1));
|
||||||
|
new_config.set_key_value("extrusion_multiplier", new ConfigOptionFloats{1.});
|
||||||
|
new_config.set_key_value("start_gcode",
|
||||||
|
new ConfigOptionString("G28\nM141 S0\nG0 Z50 F600\nM190 S[first_layer_bed_temperature]\nG28 Z\nG29 ; mesh bed leveling ,comment this code to close it\nG0 X0 Y0 Z50 F6000\nM109 S[first_layer_temperature]\nM83\nG0 X{max((min(print_bed_max[0], first_layer_print_min[0] + 80) - 85),0)} Y{max((min(print_bed_max[1], first_layer_print_min[1] + 80) - 85),0)} Z5 F6000\nG0 Z0.2 F600\nG1 E3 F1800\nG1 X{(min(print_bed_max[0], first_layer_print_min[0] + 80))} E{85 * 0.04} F3000\nG1 Y{max((min(print_bed_max[1], first_layer_print_min[1] + 80) - 85),0) + 2} E{2 * 0.04} F3000\nG1 X{max((min(print_bed_max[0], first_layer_print_min[0] + 80) - 85),0)} E{85 * 0.04} F3000\nG1 Y{max((min(print_bed_max[1], first_layer_print_min[1] + 80) - 85),0) + 85} E{83 * 0.04} F3000\nG1 X{max((min(print_bed_max[0], first_layer_print_min[0] + 80) - 85),0) + 2} E{2 * 0.04} F3000\nG1 Y{max((min(print_bed_max[1], first_layer_print_min[1] + 80) - 85),0) + 3} E{82 * 0.04} F3000\nG1 X{max((min(print_bed_max[0], first_layer_print_min[0] + 80) - 85),0) + 12} E{-10 * 0.04} F3000\nG1 E{10 * 0.04} F3000\nM221 S"+std::to_string(extru_multip)));
|
||||||
|
new_config.set_key_value("between_objects_gcode",
|
||||||
|
new ConfigOptionString("{if current_object_idx==1}M221 S"+std::to_string(extru_multip+1)+"{endif}"
|
||||||
|
"{if current_object_idx==2}M221 S"+std::to_string(extru_multip+2)+"{endif}"
|
||||||
|
"{if current_object_idx==3}M221 S"+std::to_string(extru_multip+3)+"{endif}"
|
||||||
|
"{if current_object_idx==4}M221 S"+std::to_string(extru_multip+4)+"{endif}"
|
||||||
|
"{if current_object_idx==5}M221 S"+std::to_string(extru_multip-1)+"{endif}"
|
||||||
|
"{if current_object_idx==6}M221 S"+std::to_string(extru_multip-2)+"{endif}"
|
||||||
|
"{if current_object_idx==7}M221 S"+std::to_string(extru_multip-3)+"{endif}"
|
||||||
|
"{if current_object_idx==8}M221 S"+std::to_string(extru_multip-4)+"{endif}"));
|
||||||
|
tab_print->load_config(new_config);
|
||||||
|
tab_filament->load_config(new_config);
|
||||||
|
tab_printer->load_config(new_config);
|
||||||
|
add_model_calibration(false,
|
||||||
|
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "FlowRate" / "flowrate_fine.3mf").string());
|
||||||
|
}
|
||||||
|
|
||||||
//B34
|
//B34
|
||||||
void Plater::calib_pa(const Calib_Params ¶ms)
|
void Plater::calib_pa(const Calib_Params ¶ms)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ public:
|
|||||||
//B34
|
//B34
|
||||||
void calib_pa(const Calib_Params ¶ms);
|
void calib_pa(const Calib_Params ¶ms);
|
||||||
void calib_flowrate(int pass);
|
void calib_flowrate(int pass);
|
||||||
|
void calib_flowrate_f(int pass, const Calib_Params ¶ms);
|
||||||
|
|
||||||
|
|
||||||
void new_project();
|
void new_project();
|
||||||
|
|||||||
@@ -34,6 +34,82 @@ wxBoxSizer *create_item_checkbox(wxString title, wxWindow *parent, bool *value,
|
|||||||
return m_sizer_checkbox;
|
return m_sizer_checkbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FRF_Calibration_Dlg::FRF_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
|
||||||
|
: DPIDialog(parent, id, _L("Flowrate-Fine Calibration"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
|
||||||
|
{
|
||||||
|
wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
SetSizer(v_sizer);
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
DynamicPrintConfig m_config;
|
||||||
|
wxString start_length_str = _L("Extrusion Multipler: ");
|
||||||
|
auto text_size = wxWindow::GetTextExtent(start_length_str);
|
||||||
|
text_size.x = text_size.x * 1.5;
|
||||||
|
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Settings"));
|
||||||
|
|
||||||
|
auto st_size = FromDIP(wxSize(text_size.x, -1));
|
||||||
|
auto ti_size = FromDIP(wxSize(90, -1));
|
||||||
|
// extru length
|
||||||
|
auto start_length_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
auto start_length_text = new wxStaticText(this, wxID_ANY, start_length_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
|
||||||
|
m_tiExtru = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_CENTRE);
|
||||||
|
m_tiExtru->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
|
||||||
|
|
||||||
|
start_length_sizer->Add(start_length_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||||
|
start_length_sizer->Add(m_tiExtru, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||||
|
settings_sizer->Add(start_length_sizer);
|
||||||
|
|
||||||
|
v_sizer->Add(settings_sizer);
|
||||||
|
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
|
||||||
|
m_btnStart = new Button(this, _L("OK"));
|
||||||
|
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed),
|
||||||
|
std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal));
|
||||||
|
|
||||||
|
m_btnStart->SetBackgroundColor(btn_bg_green);
|
||||||
|
m_btnStart->SetBorderColor(wxColour(0, 150, 136));
|
||||||
|
m_btnStart->SetTextColor(wxColour("#FFFFFE"));
|
||||||
|
m_btnStart->SetSize(wxSize(FromDIP(48), FromDIP(24)));
|
||||||
|
m_btnStart->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
|
||||||
|
m_btnStart->SetCornerRadius(FromDIP(3));
|
||||||
|
m_btnStart->Bind(wxEVT_BUTTON, &FRF_Calibration_Dlg::on_start, this);
|
||||||
|
v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
|
||||||
|
|
||||||
|
m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FRF_Calibration_Dlg::on_start), NULL, this);
|
||||||
|
|
||||||
|
//wxGetApp().UpdateDlgDarkUI(this);
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
Fit();
|
||||||
|
}
|
||||||
|
|
||||||
|
FRF_Calibration_Dlg::~FRF_Calibration_Dlg() {
|
||||||
|
// Disconnect Events
|
||||||
|
m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FRF_Calibration_Dlg::on_start), NULL, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FRF_Calibration_Dlg::on_start(wxCommandEvent& event) {
|
||||||
|
bool read_double = false;
|
||||||
|
read_double = m_tiExtru->GetTextCtrl()->GetValue().ToDouble(&m_params.start);
|
||||||
|
|
||||||
|
if (!read_double || m_params.start <= 0 || m_params.start > 2) {
|
||||||
|
MessageDialog msg_dlg(nullptr, _L("Please input valid values:\n0 < Extru <= 2.)"), wxEmptyString, wxICON_WARNING | wxOK);
|
||||||
|
msg_dlg.ShowModal();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_params.mode = CalibMode::Calib_FRF;
|
||||||
|
m_plater->calib_flowrate_f(2, m_params);
|
||||||
|
EndModal(wxID_OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FRF_Calibration_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
|
||||||
|
this->Refresh();
|
||||||
|
Fit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
|
PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
|
||||||
: DPIDialog(parent, id, _L("PA Calibration"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
|
: DPIDialog(parent, id, _L("PA Calibration"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,6 +18,22 @@
|
|||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
class FRF_Calibration_Dlg : public DPIDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FRF_Calibration_Dlg(wxWindow *parent, wxWindowID id, Plater *plater);
|
||||||
|
~FRF_Calibration_Dlg();
|
||||||
|
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void on_start(wxCommandEvent &event);
|
||||||
|
Calib_Params m_params;
|
||||||
|
|
||||||
|
TextInput *m_tiExtru;
|
||||||
|
Button * m_btnStart;
|
||||||
|
Plater * m_plater;
|
||||||
|
};
|
||||||
|
|
||||||
class PA_Calibration_Dlg : public DPIDialog
|
class PA_Calibration_Dlg : public DPIDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user