diff --git a/resources/images/calib_sf.svg b/resources/images/calib_sf.svg
new file mode 100644
index 0000000000..54f08c2f2c
--- /dev/null
+++ b/resources/images/calib_sf.svg
@@ -0,0 +1,15 @@
+
diff --git a/resources/images/calib_sf_inactive.svg b/resources/images/calib_sf_inactive.svg
new file mode 100644
index 0000000000..31a8351a7c
--- /dev/null
+++ b/resources/images/calib_sf_inactive.svg
@@ -0,0 +1,17 @@
+
diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt
index 6e54b56f22..fdd2009304 100644
--- a/src/slic3r/CMakeLists.txt
+++ b/src/slic3r/CMakeLists.txt
@@ -398,6 +398,8 @@ set(SLIC3R_GUI_SOURCES
GUI/CalibrationWizard.cpp
GUI/CalibrationWizardPage.cpp
GUI/CalibrationWizardPage.hpp
+ GUI/calib_dlg.cpp
+ GUI/calib_dlg.hpp
GUI/Calibration.hpp
GUI/Calibration.cpp
GUI/PrintOptionsDialog.hpp
diff --git a/src/slic3r/GUI/BBLTopbar.cpp b/src/slic3r/GUI/BBLTopbar.cpp
index 12719e83e5..a395105d73 100644
--- a/src/slic3r/GUI/BBLTopbar.cpp
+++ b/src/slic3r/GUI/BBLTopbar.cpp
@@ -24,6 +24,7 @@ enum CUSTOM_ID
ID_TITLE,
ID_MODEL_STORE,
ID_PUBLISH,
+ ID_CALIB,
ID_TOOL_BAR = 3200,
ID_AMS_NOTEBOOK,
};
@@ -194,6 +195,7 @@ void BBLTopbar::Init(wxFrame* parent)
m_frame = parent;
m_skip_popup_file_menu = false;
m_skip_popup_dropdown_menu = false;
+ m_skip_popup_calib_menu = false;
wxInitAllImageHandlers();
@@ -241,6 +243,13 @@ void BBLTopbar::Init(wxFrame* parent)
wxBitmap redo_inactive_bitmap = create_scaled_bitmap("topbar_redo_inactive", nullptr, TOPBAR_ICON_SIZE);
m_redo_item->SetDisabledBitmap(redo_inactive_bitmap);
+ this->AddSpacer(FromDIP(10));
+
+ wxBitmap calib_bitmap = create_scaled_bitmap("calib_sf", nullptr, TOPBAR_ICON_SIZE);
+ wxBitmap calib_bitmap_inactive = create_scaled_bitmap("calib_sf_inactive", nullptr, TOPBAR_ICON_SIZE);
+ m_calib_item = this->AddTool(ID_CALIB, _L("Calibration"), calib_bitmap);
+ m_calib_item->SetDisabledBitmap(calib_bitmap_inactive);
+
this->AddSpacer(FromDIP(10));
this->AddStretchSpacer(1);
@@ -296,6 +305,7 @@ void BBLTopbar::Init(wxFrame* parent)
this->Bind(wxEVT_MENU_CLOSE, &BBLTopbar::OnMenuClose, this);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFileToolItem, this, ID_TOP_FILE_MENU);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnDropdownToolItem, this, ID_TOP_DROPDOWN_MENU);
+ this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnCalibToolItem, this, ID_CALIB);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnIconize, this, wxID_ICONIZE_FRAME);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFullScreen, this, wxID_MAXIMIZE_FRAME);
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnCloseFrame, this, wxID_CLOSE_FRAME);
@@ -355,6 +365,7 @@ void BBLTopbar::EnableUndoRedoItems()
{
this->EnableTool(m_undo_item->GetId(), true);
this->EnableTool(m_redo_item->GetId(), true);
+ this->EnableTool(m_calib_item->GetId(), true);
Refresh();
}
@@ -362,6 +373,7 @@ void BBLTopbar::DisableUndoRedoItems()
{
this->EnableTool(m_undo_item->GetId(), false);
this->EnableTool(m_redo_item->GetId(), false);
+ this->EnableTool(m_calib_item->GetId(), false);
Refresh();
}
@@ -417,6 +429,11 @@ wxMenu* BBLTopbar::GetTopMenu()
return &m_top_menu;
}
+wxMenu* BBLTopbar::GetCalibMenu()
+{
+ return &m_calib_menu;
+}
+
void BBLTopbar::SetTitle(wxString title)
{
wxGCDC dc(this);
@@ -469,6 +486,10 @@ void BBLTopbar::Rescale() {
item->SetBitmap(create_scaled_bitmap("topbar_redo", this, TOPBAR_ICON_SIZE));
item->SetDisabledBitmap(create_scaled_bitmap("topbar_redo_inactive", nullptr, TOPBAR_ICON_SIZE));
+ item = this->FindTool(ID_CALIB);
+ item->SetBitmap(create_scaled_bitmap("calib_sf", nullptr, TOPBAR_ICON_SIZE));
+ item->SetDisabledBitmap(create_scaled_bitmap("calib_sf_inactive", nullptr, TOPBAR_ICON_SIZE));
+
item = this->FindTool(ID_TITLE);
/*item = this->FindTool(ID_PUBLISH);
@@ -580,6 +601,23 @@ void BBLTopbar::OnDropdownToolItem(wxAuiToolBarEvent& evt)
tb->SetToolSticky(evt.GetId(), false);
}
+void BBLTopbar::OnCalibToolItem(wxAuiToolBarEvent &evt)
+{
+ wxAuiToolBar *tb = static_cast(evt.GetEventObject());
+
+ tb->SetToolSticky(evt.GetId(), true);
+
+ if (!m_skip_popup_calib_menu) {
+ auto rec = this->GetToolRect(ID_CALIB);
+ PopupMenu(&m_calib_menu, wxPoint(rec.GetLeft(), this->GetSize().GetHeight() - 2));
+ } else {
+ m_skip_popup_calib_menu = false;
+ }
+
+ // make sure the button is "un-stuck"
+ tb->SetToolSticky(evt.GetId(), false);
+}
+
void BBLTopbar::OnMouseLeftDown(wxMouseEvent& event)
{
wxPoint mouse_pos = ::wxGetMousePosition();
diff --git a/src/slic3r/GUI/BBLTopbar.hpp b/src/slic3r/GUI/BBLTopbar.hpp
index a69b298c9a..fbdfc2b8ad 100644
--- a/src/slic3r/GUI/BBLTopbar.hpp
+++ b/src/slic3r/GUI/BBLTopbar.hpp
@@ -23,6 +23,7 @@ public:
void OnCloseFrame(wxAuiToolBarEvent& event);
void OnFileToolItem(wxAuiToolBarEvent& evt);
void OnDropdownToolItem(wxAuiToolBarEvent& evt);
+ void OnCalibToolItem(wxAuiToolBarEvent &evt);
void OnMouseLeftDClock(wxMouseEvent& mouse);
void OnMouseLeftDown(wxMouseEvent& event);
void OnMouseLeftUp(wxMouseEvent& event);
@@ -43,6 +44,7 @@ public:
void AddDropDownSubMenu(wxMenu* sub_menu, const wxString& title);
void AddDropDownMenuItem(wxMenuItem* menu_item);
wxMenu *GetTopMenu();
+ wxMenu *GetCalibMenu();
void SetTitle(wxString title);
void SetMaximizedSize();
void SetWindowSize();
@@ -60,6 +62,7 @@ private:
wxPoint m_delta;
wxMenu m_top_menu;
wxMenu* m_file_menu;
+ wxMenu m_calib_menu;
wxAuiToolBarItem* m_title_item;
wxAuiToolBarItem* m_account_item;
wxAuiToolBarItem* m_model_store_item;
@@ -67,6 +70,7 @@ private:
wxAuiToolBarItem *m_publish_item;
wxAuiToolBarItem* m_undo_item;
wxAuiToolBarItem* m_redo_item;
+ wxAuiToolBarItem* m_calib_item;
wxAuiToolBarItem* maximize_btn;
wxBitmap m_publish_bitmap;
@@ -78,4 +82,5 @@ private:
int m_toolbar_h;
bool m_skip_popup_file_menu;
bool m_skip_popup_dropdown_menu;
+ bool m_skip_popup_calib_menu;
};
diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.hpp b/src/slic3r/GUI/BackgroundSlicingProcess.hpp
index 7d3ae23970..28db0b6f71 100644
--- a/src/slic3r/GUI/BackgroundSlicingProcess.hpp
+++ b/src/slic3r/GUI/BackgroundSlicingProcess.hpp
@@ -120,6 +120,7 @@ public:
// Get the current print. It is either m_fff_print or m_sla_print.
const PrintBase* current_print() const { return m_print; }
const Print* fff_print() const { return m_fff_print; }
+ Print * fff_print() { return m_fff_print; }
const SLAPrint* sla_print() const { return m_sla_print; }
// Take the project path (if provided), extract the name of the project, run it through the macro processor and save it next to the project file.
// If the project_path is empty, just run output_filepath().
diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp
index 7994e5dfe0..9fa99696e2 100644
--- a/src/slic3r/GUI/MainFrame.cpp
+++ b/src/slic3r/GUI/MainFrame.cpp
@@ -2648,6 +2648,77 @@ void MainFrame::init_menubar_as_editor()
//m_topbar->AddDropDownMenuItem(language_item);
//m_topbar->AddDropDownMenuItem(config_item);
m_topbar->AddDropDownSubMenu(helpMenu, _L("Help"));
+
+ // SoftFever calibrations
+ {
+ append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Temperature"), _L("Temperature Calibration"),
+ [this](wxCommandEvent&) {
+ if (!m_temp_calib_dlg)
+ m_temp_calib_dlg = new Temp_Calibration_Dlg((wxWindow*)this, wxID_ANY, m_plater);
+ m_temp_calib_dlg->ShowModal();
+ }, "", nullptr,
+ [this]() {return m_plater->is_view3D_shown();; }, this);
+ auto flowrate_menu = new wxMenu();
+ append_menu_item(
+ flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"),
+ [this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
+ [this]() {return m_plater->is_view3D_shown();; }, this);
+ append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 2"), _L("Flow rate test - Pass 2"),
+ [this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
+ [this]() {return m_plater->is_view3D_shown();; }, this);
+ m_topbar->GetCalibMenu()->AppendSubMenu(flowrate_menu, _L("Flow rate"));
+ append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
+ [this](wxCommandEvent&) {
+ if (!m_pa_calib_dlg)
+ m_pa_calib_dlg = new PA_Calibration_Dlg((wxWindow*)this, wxID_ANY, m_plater);
+ m_pa_calib_dlg->ShowModal();
+ }, "", nullptr,
+ [this]() {return m_plater->is_view3D_shown();; }, this);
+ append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Retraction test"), _L("Retraction test"),
+ [this](wxCommandEvent&) {
+ if (!m_retraction_calib_dlg)
+ m_retraction_calib_dlg = new Retraction_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
+ m_retraction_calib_dlg->ShowModal();
+ }, "", nullptr,
+ [this]() {return m_plater->is_view3D_shown();; }, this);
+
+ // Advance calibrations
+ auto advance_menu = new wxMenu(); // sub menu
+ {
+ append_menu_item(
+ advance_menu, wxID_ANY, _L("Max flowrate"), _L("Max flowrate"),
+ [this](wxCommandEvent &) {
+ if (!m_vol_test_dlg) m_vol_test_dlg = new MaxVolumetricSpeed_Test_Dlg((wxWindow *) this, wxID_ANY, m_plater);
+ m_vol_test_dlg->ShowModal();
+ },
+ "", nullptr,
+ [this]() {
+ return m_plater->is_view3D_shown();
+ ;
+ },
+ this);
+
+ append_menu_item(
+ advance_menu, wxID_ANY, _L("VFA"), _L("VFA"),
+ [this](wxCommandEvent &) {
+ if (!m_vfa_test_dlg) m_vfa_test_dlg = new VFA_Test_Dlg((wxWindow *) this, wxID_ANY, m_plater);
+ m_vfa_test_dlg->ShowModal();
+ },
+ "", nullptr,
+ [this]() {
+ return m_plater->is_view3D_shown();
+ ;
+ },
+ this);
+ m_topbar->GetCalibMenu()->AppendSubMenu(advance_menu, _L("More..."));
+ }
+
+ // help
+ append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Tutorial"), _L("Calibration help"),
+ [this](wxCommandEvent&) { wxLaunchDefaultBrowser("https://github.com/SoftFever/OrcaSlicer/wiki/Calibration", wxBROWSER_NEW_WINDOW); }, "", nullptr,
+ [this]() {return m_plater->is_view3D_shown();; }, this);
+
+ }
#else
m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File")));
if (editMenu)
diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp
index 065dda196c..6877fb09b9 100644
--- a/src/slic3r/GUI/MainFrame.hpp
+++ b/src/slic3r/GUI/MainFrame.hpp
@@ -29,6 +29,7 @@
// BBS
#include "BBLTopbar.hpp"
#include "PrinterWebView.hpp"
+#include "calib_dlg.hpp"
#define ENABEL_PRINT_ALL 0
@@ -336,6 +337,13 @@ public:
void RunScript(wxString js);
void show_device(bool bBBLPrinter);
+ // SoftFever calibration
+ PA_Calibration_Dlg * m_pa_calib_dlg{nullptr};
+ Temp_Calibration_Dlg * m_temp_calib_dlg{nullptr};
+ MaxVolumetricSpeed_Test_Dlg *m_vol_test_dlg{nullptr};
+ VFA_Test_Dlg * m_vfa_test_dlg{nullptr};
+ Retraction_Test_Dlg * m_retraction_calib_dlg{nullptr};
+
// BBS. Replace title bar and menu bar with top bar.
BBLTopbar* m_topbar{ nullptr };
PrintHostQueueDialog* printhost_queue_dlg() { return m_printhost_queue_dlg; }
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 4db08b89e8..45616422d8 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -7686,7 +7686,7 @@ Print& Plater::fff_print() { return p->fff_print; }
const SLAPrint& Plater::sla_print() const { return p->sla_print; }
SLAPrint& Plater::sla_print() { return p->sla_print; }
-int Plater::new_project(bool skip_confirm, bool silent)
+int Plater::new_project(bool skip_confirm, bool silent, const wxString &project_name)
{
bool transfer_preset_changes = false;
// BBS: save confirm
@@ -7729,7 +7729,10 @@ int Plater::new_project(bool skip_confirm, bool silent)
//reset project
p->project.reset();
//set project name
- p->set_project_name(_L("Untitled"));
+ if (project_name.empty())
+ p->set_project_name(_L("Untitled"));
+ else
+ p->set_project_name(project_name);
Plater::TakeSnapshot snapshot(this, "New Project", UndoRedo::SnapshotType::ProjectSeparator);
@@ -8131,16 +8134,22 @@ bool Plater::up_to_date(bool saved, bool backup)
!Slic3r::has_other_changes(backup));
}
-void Plater::add_model(bool imperial_units/* = false*/)
+void Plater::add_model(bool imperial_units, std::string fname)
{
wxArrayString input_files;
- wxGetApp().import_model(this, input_files);
- if (input_files.empty())
- return;
std::vector paths;
- for (const auto& file : input_files)
- paths.emplace_back(into_path(file));
+ if (fname.empty()) {
+ wxGetApp().import_model(this, input_files);
+ if (input_files.empty())
+ return;
+
+ for (const auto& file : input_files)
+ paths.emplace_back(into_path(file));
+ }
+ else {
+ paths.emplace_back(fname);
+ }
std::string snapshot_label;
assert(! paths.empty());
diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp
index f6b629e287..89bc1163e0 100644
--- a/src/slic3r/GUI/Plater.hpp
+++ b/src/slic3r/GUI/Plater.hpp
@@ -23,6 +23,7 @@
#include "Jobs/SendJob.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/PrintBase.hpp"
+#include "libslic3r/Calib.hpp"
#define FILAMENT_SYSTEM_COLORS_NUM 16
@@ -207,7 +208,7 @@ public:
const SLAPrint& sla_print() const;
SLAPrint& sla_print();
- int new_project(bool skip_confirm = false, bool silent = false);
+ int new_project(bool skip_confirm = false, bool silent = false, const wxString &project_name = wxString());
// BBS: save & backup
void load_project(wxString const & filename = "", wxString const & originfile = "-");
int save_project(bool saveAs = false);
@@ -222,7 +223,7 @@ public:
bool open_3mf_file(const fs::path &file_path);
int get_3mf_file_count(std::vector paths);
void add_file();
- void add_model(bool imperial_units = false);
+ void add_model(bool imperial_units = false, std::string fname = "");
void import_sl1_archive();
void extract_config_from_project();
void load_gcode();
@@ -230,6 +231,14 @@ public:
void reload_gcode_from_disk();
void refresh_print();
+ // SoftFever calibration
+ void calib_pa(const Calib_Params ¶ms);
+ void calib_flowrate(int pass);
+ void calib_temp(const Calib_Params ¶ms);
+ void calib_max_vol_speed(const Calib_Params ¶ms);
+ void calib_retraction(const Calib_Params ¶ms);
+ void calib_VFA(const Calib_Params ¶ms);
+
//BBS: add only gcode mode
bool only_gcode_mode() { return m_only_gcode; }
void set_only_gcode(bool only_gcode) { m_only_gcode = only_gcode; }
diff --git a/src/slic3r/GUI/calib_dlg.cpp b/src/slic3r/GUI/calib_dlg.cpp
new file mode 100644
index 0000000000..145d168f67
--- /dev/null
+++ b/src/slic3r/GUI/calib_dlg.cpp
@@ -0,0 +1,700 @@
+#include "calib_dlg.hpp"
+#include "GUI_App.hpp"
+#include "MsgDialog.hpp"
+#include "I18N.hpp"
+#include
+#include "MainFrame.hpp"
+#include
+namespace Slic3r { namespace GUI {
+
+wxBoxSizer* create_item_checkbox(wxString title, wxWindow* parent, bool* value, CheckBox*& checkbox)
+{
+ wxBoxSizer* m_sizer_checkbox = new wxBoxSizer(wxHORIZONTAL);
+
+ m_sizer_checkbox->Add(0, 0, 0, wxEXPAND | wxLEFT, 5);
+
+ checkbox = new ::CheckBox(parent);
+ m_sizer_checkbox->Add(checkbox, 0, wxALIGN_CENTER, 0);
+ m_sizer_checkbox->Add(0, 0, 0, wxEXPAND | wxLEFT, 8);
+
+ auto checkbox_title = new wxStaticText(parent, wxID_ANY, title, wxDefaultPosition, wxSize(-1, -1), 0);
+ checkbox_title->SetForegroundColour(wxColour(144, 144, 144));
+ checkbox_title->SetFont(::Label::Body_13);
+ checkbox_title->Wrap(-1);
+ m_sizer_checkbox->Add(checkbox_title, 0, wxALIGN_CENTER | wxALL, 3);
+
+ checkbox->SetValue(true);
+
+ checkbox->Bind(wxEVT_TOGGLEBUTTON, [parent, checkbox, value](wxCommandEvent& e) {
+ (*value) = (*value) ? false : true;
+ e.Skip();
+ });
+
+ return m_sizer_checkbox;
+}
+
+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)
+{
+ wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
+ SetSizer(v_sizer);
+ wxBoxSizer* choice_sizer = new wxBoxSizer(wxHORIZONTAL);
+
+ wxString m_rbExtruderTypeChoices[] = { _L("DDE"), _L("Bowden") };
+ int m_rbExtruderTypeNChoices = sizeof(m_rbExtruderTypeChoices) / sizeof(wxString);
+ m_rbExtruderType = new wxRadioBox(this, wxID_ANY, _L("Extruder type"), wxDefaultPosition, wxDefaultSize, m_rbExtruderTypeNChoices, m_rbExtruderTypeChoices, 2, wxRA_SPECIFY_COLS);
+ m_rbExtruderType->SetSelection(0);
+ choice_sizer->Add(m_rbExtruderType, 0, wxALL, 5);
+ choice_sizer->Add(FromDIP(5), 0, 0, wxEXPAND, 5);
+ wxString m_rbMethodChoices[] = { _L("PA Tower"), _L("PA Line") };
+ int m_rbMethodNChoices = sizeof(m_rbMethodChoices) / sizeof(wxString);
+ m_rbMethod = new wxRadioBox(this, wxID_ANY, _L("Method"), wxDefaultPosition, wxDefaultSize, m_rbMethodNChoices, m_rbMethodChoices, 2, wxRA_SPECIFY_COLS);
+ m_rbMethod->SetSelection(0);
+ choice_sizer->Add(m_rbMethod, 0, wxALL, 5);
+
+ v_sizer->Add(choice_sizer);
+
+ // Settings
+ //
+ wxString start_pa_str = _L("Start PA: ");
+ wxString end_pa_str = _L("End PA: ");
+ wxString PA_step_str = _L("PA step: ");
+ auto text_size = wxWindow::GetTextExtent(start_pa_str);
+ text_size.IncTo(wxWindow::GetTextExtent(end_pa_str));
+ text_size.IncTo(wxWindow::GetTextExtent(PA_step_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));
+ // start PA
+ auto start_PA_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto start_pa_text = new wxStaticText(this, wxID_ANY, start_pa_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiStartPA = new TextInput(this, wxString::FromDouble(0.0), "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
+ m_tiStartPA->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+
+ start_PA_sizer->Add(start_pa_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ start_PA_sizer->Add(m_tiStartPA, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(start_PA_sizer);
+
+ // end PA
+ auto end_PA_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto end_pa_text = new wxStaticText(this, wxID_ANY, end_pa_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiEndPA = new TextInput(this, wxString::FromDouble(0.1), "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
+ m_tiStartPA->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ end_PA_sizer->Add(end_pa_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ end_PA_sizer->Add(m_tiEndPA, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(end_PA_sizer);
+
+ // PA step
+ auto PA_step_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto PA_step_text = new wxStaticText(this, wxID_ANY, PA_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiPAStep = new TextInput(this, wxString::FromDouble(0.002), "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
+ m_tiStartPA->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ PA_step_sizer->Add(PA_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ PA_step_sizer->Add(m_tiPAStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(PA_step_sizer);
+
+ settings_sizer->Add(create_item_checkbox(_L("Print numbers"), this, &m_params.print_numbers, m_cbPrintNum));
+ m_cbPrintNum->SetValue(false);
+
+ 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(23, 129, 63), StateColor::Pressed),
+ std::pair(wxColour(48, 221, 112), StateColor::Hovered),
+ std::pair(0x00AE42, 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, &PA_Calibration_Dlg::on_start, this);
+ v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
+
+ // Connect Events
+ m_rbExtruderType->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_extruder_type_changed), NULL, this);
+ m_rbMethod->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_method_changed), NULL, this);
+ this->Connect(wxEVT_SHOW, wxShowEventHandler(PA_Calibration_Dlg::on_show));
+ //wxGetApp().UpdateDlgDarkUI(this);
+
+ Layout();
+ Fit();
+}
+
+PA_Calibration_Dlg::~PA_Calibration_Dlg() {
+ // Disconnect Events
+ m_rbExtruderType->Disconnect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_extruder_type_changed), NULL, this);
+ m_rbMethod->Disconnect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_method_changed), NULL, this);
+ m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PA_Calibration_Dlg::on_start), NULL, this);
+}
+
+void PA_Calibration_Dlg::on_start(wxCommandEvent& event) {
+ bool read_double = false;
+ read_double = m_tiStartPA->GetTextCtrl()->GetValue().ToDouble(&m_params.start);
+ read_double = read_double && m_tiEndPA->GetTextCtrl()->GetValue().ToDouble(&m_params.end);
+ read_double = read_double && m_tiPAStep->GetTextCtrl()->GetValue().ToDouble(&m_params.step);
+ if (!read_double || m_params.start < 0 || m_params.step < EPSILON || m_params.end < m_params.start + m_params.step) {
+ MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nStart PA: >= 0.0\nEnd PA: > Start PA\nPA step: >= 0.001)"), wxEmptyString, wxICON_WARNING | wxOK);
+ msg_dlg.ShowModal();
+ return;
+ }
+ m_params.mode = m_rbMethod->GetSelection() == 0 ? CalibMode::Calib_PA_Tower : CalibMode::Calib_PA_Line;
+ m_params.print_numbers = m_cbPrintNum->GetValue();
+
+ m_plater->calib_pa(m_params);
+ EndModal(wxID_OK);
+
+}
+void PA_Calibration_Dlg::on_extruder_type_changed(wxCommandEvent& event) {
+ int selection = event.GetSelection();
+ m_bDDE = selection == 0 ? true : false;
+ m_tiEndPA->GetTextCtrl()->SetValue(wxString::FromDouble(m_bDDE ? 0.1 : 1.0));
+ m_tiStartPA->GetTextCtrl()->SetValue(wxString::FromDouble(0.0));
+ m_tiPAStep->GetTextCtrl()->SetValue(wxString::FromDouble(m_bDDE ? 0.002 : 0.02));
+ event.Skip();
+}
+void PA_Calibration_Dlg::on_method_changed(wxCommandEvent& event) {
+ int selection = event.GetSelection();
+ m_params.mode = selection == 0 ? CalibMode::Calib_PA_Tower : CalibMode::Calib_PA_Line;
+ if (selection == 0) {
+ m_cbPrintNum->SetValue(false);
+ m_cbPrintNum->Enable(false);
+ }
+ else {
+ m_cbPrintNum->SetValue(true);
+ m_cbPrintNum->Enable(true);
+ }
+
+ event.Skip();
+}
+
+
+void PA_Calibration_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
+ this->Refresh();
+ Fit();
+
+}
+
+void PA_Calibration_Dlg::on_show(wxShowEvent& event) {
+
+ if (m_rbMethod->GetSelection() == 0)
+ m_cbPrintNum->Enable(false);
+ else
+ m_cbPrintNum->Enable(true);
+}
+
+// Temp Calib dlg
+//
+enum FILAMENT_TYPE : int
+{
+ tPLA = 0,
+ tABS_ASA,
+ tPETG,
+ tTPU,
+ tPA_CF,
+ tPET_CF,
+ tCustom
+};
+
+Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
+ : DPIDialog(parent, id, _L("Temperature calibration"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
+{
+ wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
+ SetSizer(v_sizer);
+ wxBoxSizer* choice_sizer = new wxBoxSizer(wxHORIZONTAL);
+
+ wxString m_rbFilamentTypeChoices[] = { _L("PLA"), _L("ABS/ASA"), _L("PETG"), _L("TPU"), _L("PA-CF"), _L("PET-CF"), _L("Custom") };
+ int m_rbFilamentTypeNChoices = sizeof(m_rbFilamentTypeChoices) / sizeof(wxString);
+ m_rbFilamentType = new wxRadioBox(this, wxID_ANY, _L("Filament type"), wxDefaultPosition, wxDefaultSize, m_rbFilamentTypeNChoices, m_rbFilamentTypeChoices, 2, wxRA_SPECIFY_COLS);
+ m_rbFilamentType->SetSelection(0);
+ m_rbFilamentType->Select(0);
+ choice_sizer->Add(m_rbFilamentType, 0, wxALL, 5);
+ choice_sizer->Add(FromDIP(5), 0, 0, wxEXPAND, 5);
+ wxString m_rbMethodChoices[] = { _L("PA Tower"), _L("PA Line") };
+
+ v_sizer->Add(choice_sizer);
+
+ // Settings
+ //
+ wxString start_temp_str = _L("Start temp: ");
+ wxString end_temp_str = _L("End end: ");
+ wxString temp_step_str = _L("Temp step: ");
+ auto text_size = wxWindow::GetTextExtent(start_temp_str);
+ text_size.IncTo(wxWindow::GetTextExtent(end_temp_str));
+ text_size.IncTo(wxWindow::GetTextExtent(temp_step_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));
+ // start temp
+ auto start_temp_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto start_temp_text = new wxStaticText(this, wxID_ANY, start_temp_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiStart = new TextInput(this, std::to_string(230), _L("\u2103"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+
+ start_temp_sizer->Add(start_temp_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ start_temp_sizer->Add(m_tiStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(start_temp_sizer);
+
+ // end temp
+ auto end_temp_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto end_temp_text = new wxStaticText(this, wxID_ANY, end_temp_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiEnd = new TextInput(this, std::to_string(190), _L("\u2103"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ end_temp_sizer->Add(end_temp_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ end_temp_sizer->Add(m_tiEnd, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(end_temp_sizer);
+
+ // temp step
+ auto temp_step_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto temp_step_text = new wxStaticText(this, wxID_ANY, temp_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiStep = new TextInput(this, wxString::FromDouble(5),_L("\u2103"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ m_tiStep->Enable(false);
+ temp_step_sizer->Add(temp_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ temp_step_sizer->Add(m_tiStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(temp_step_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(23, 129, 63), StateColor::Pressed),
+ std::pair(wxColour(48, 221, 112), StateColor::Hovered),
+ std::pair(0x00AE42, 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, &Temp_Calibration_Dlg::on_start, this);
+ v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
+
+ m_rbFilamentType->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(Temp_Calibration_Dlg::on_filament_type_changed), NULL, this);
+ m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Temp_Calibration_Dlg::on_start), NULL, this);
+
+ //wxGetApp().UpdateDlgDarkUI(this);
+
+ Layout();
+ Fit();
+
+ auto validate_text = [this](TextInput* ti){
+ unsigned long t = 0;
+ if(!ti->GetTextCtrl()->GetValue().ToULong(&t))
+ return;
+ if(t> 350 || t < 180){
+ MessageDialog msg_dlg(nullptr, wxString::Format(L"Supported range: 180%s - 350%s",_L("\u2103"),_L("\u2103")), wxEmptyString, wxICON_WARNING | wxOK);
+ msg_dlg.ShowModal();
+ if(t > 350)
+ t = 350;
+ else
+ t = 180;
+ }
+ t = (t / 5) * 5;
+ ti->GetTextCtrl()->SetValue(std::to_string(t));
+ };
+
+ m_tiStart->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [&](wxFocusEvent &e) {
+ validate_text(this->m_tiStart);
+ e.Skip();
+ });
+
+ m_tiEnd->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [&](wxFocusEvent &e) {
+ validate_text(this->m_tiEnd);
+ e.Skip();
+ });
+
+
+}
+
+Temp_Calibration_Dlg::~Temp_Calibration_Dlg() {
+ // Disconnect Events
+ m_rbFilamentType->Disconnect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(Temp_Calibration_Dlg::on_filament_type_changed), NULL, this);
+ m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Temp_Calibration_Dlg::on_start), NULL, this);
+}
+
+void Temp_Calibration_Dlg::on_start(wxCommandEvent& event) {
+ bool read_long = false;
+ unsigned long start=0,end=0;
+ read_long = m_tiStart->GetTextCtrl()->GetValue().ToULong(&start);
+ read_long = read_long && m_tiEnd->GetTextCtrl()->GetValue().ToULong(&end);
+
+ if (!read_long || start > 350 || end < 180 || end > (start - 5)) {
+ MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nStart temp: <= 350\nEnd temp: >= 180\nStart temp > End temp + 5)"), wxEmptyString, wxICON_WARNING | wxOK);
+ msg_dlg.ShowModal();
+ return;
+ }
+ m_params.start = start;
+ m_params.end = end;
+ m_params.mode =CalibMode::Calib_Temp_Tower;
+ m_plater->calib_temp(m_params);
+ EndModal(wxID_OK);
+
+}
+
+void Temp_Calibration_Dlg::on_filament_type_changed(wxCommandEvent& event) {
+ int selection = event.GetSelection();
+ unsigned long start,end;
+ switch(selection)
+ {
+ case tABS_ASA:
+ start = 270;
+ end = 230;
+ break;
+ case tPETG:
+ start = 250;
+ end = 230;
+ break;
+ case tTPU:
+ start = 240;
+ end = 210;
+ break;
+ case tPA_CF:
+ start = 320;
+ end = 280;
+ break;
+ case tPET_CF:
+ start = 320;
+ end = 280;
+ break;
+ case tPLA:
+ case tCustom:
+ start = 230;
+ end = 190;
+ break;
+ }
+
+ m_tiEnd->GetTextCtrl()->SetValue(std::to_string(end));
+ m_tiStart->GetTextCtrl()->SetValue(std::to_string(start));
+ event.Skip();
+}
+
+void Temp_Calibration_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
+ this->Refresh();
+ Fit();
+
+}
+
+
+// MaxVolumetricSpeed_Test_Dlg
+//
+
+MaxVolumetricSpeed_Test_Dlg::MaxVolumetricSpeed_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
+ : DPIDialog(parent, id, _L("Max volumetric speed test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
+{
+ wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
+ SetSizer(v_sizer);
+
+ // Settings
+ //
+ wxString start_vol_str = _L("Start volumetric speed: ");
+ wxString end_vol_str = _L("End volumetric speed: ");
+ wxString vol_step_str = _L("step: ");
+ auto text_size = wxWindow::GetTextExtent(start_vol_str);
+ text_size.IncTo(wxWindow::GetTextExtent(end_vol_str));
+ text_size.IncTo(wxWindow::GetTextExtent(vol_step_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));
+ // start vol
+ auto start_vol_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto start_vol_text = new wxStaticText(this, wxID_ANY, start_vol_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiStart = new TextInput(this, std::to_string(5), _L("mm³/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+
+ start_vol_sizer->Add(start_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ start_vol_sizer->Add(m_tiStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(start_vol_sizer);
+
+ // end vol
+ auto end_vol_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto end_vol_text = new wxStaticText(this, wxID_ANY, end_vol_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiEnd = new TextInput(this, std::to_string(20), _L("mm³/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ end_vol_sizer->Add(end_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ end_vol_sizer->Add(m_tiEnd, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(end_vol_sizer);
+
+ // vol step
+ auto vol_step_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto vol_step_text = new wxStaticText(this, wxID_ANY, vol_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiStep = new TextInput(this, wxString::FromDouble(0.5), _L("mm³/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ vol_step_sizer->Add(vol_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ vol_step_sizer->Add(m_tiStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(vol_step_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(23, 129, 63), StateColor::Pressed),
+ std::pair(wxColour(48, 221, 112), StateColor::Hovered),
+ std::pair(0x00AE42, 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, &MaxVolumetricSpeed_Test_Dlg::on_start, this);
+ v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
+
+ m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MaxVolumetricSpeed_Test_Dlg::on_start), NULL, this);
+
+ //wxGetApp().UpdateDlgDarkUI(this);
+
+ Layout();
+ Fit();
+}
+
+MaxVolumetricSpeed_Test_Dlg::~MaxVolumetricSpeed_Test_Dlg() {
+ // Disconnect Events
+ m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MaxVolumetricSpeed_Test_Dlg::on_start), NULL, this);
+}
+
+void MaxVolumetricSpeed_Test_Dlg::on_start(wxCommandEvent& event) {
+ bool read_double = false;
+ read_double = m_tiStart->GetTextCtrl()->GetValue().ToDouble(&m_params.start);
+ read_double = read_double && m_tiEnd->GetTextCtrl()->GetValue().ToDouble(&m_params.end);
+ read_double = read_double && m_tiStep->GetTextCtrl()->GetValue().ToDouble(&m_params.step);
+
+ if (!read_double || m_params.start <= 0 || m_params.step <= 0 || m_params.end < (m_params.start + m_params.step)) {
+ MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nstart > 0 \step >= 0\nend > start + step)"), wxEmptyString, wxICON_WARNING | wxOK);
+ msg_dlg.ShowModal();
+ return;
+ }
+
+ m_params.mode = CalibMode::Calib_Vol_speed_Tower;
+ m_plater->calib_max_vol_speed(m_params);
+ EndModal(wxID_OK);
+
+}
+
+void MaxVolumetricSpeed_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
+ this->Refresh();
+ Fit();
+
+}
+
+
+// VFA_Test_Dlg
+//
+
+VFA_Test_Dlg::VFA_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
+ : DPIDialog(parent, id, _L("VFA test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+ , m_plater(plater)
+{
+ wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
+ SetSizer(v_sizer);
+
+ // Settings
+ //
+ wxString start_str = _L("Start speed: ");
+ wxString end_vol_str = _L("End speed: ");
+ wxString vol_step_str = _L("step: ");
+ auto text_size = wxWindow::GetTextExtent(start_str);
+ text_size.IncTo(wxWindow::GetTextExtent(end_vol_str));
+ text_size.IncTo(wxWindow::GetTextExtent(vol_step_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));
+ // start vol
+ auto start_vol_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto start_vol_text = new wxStaticText(this, wxID_ANY, start_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiStart = new TextInput(this, std::to_string(40), _L("mm/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+
+ start_vol_sizer->Add(start_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ start_vol_sizer->Add(m_tiStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(start_vol_sizer);
+
+ // end vol
+ auto end_vol_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto end_vol_text = new wxStaticText(this, wxID_ANY, end_vol_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiEnd = new TextInput(this, std::to_string(200), _L("mm/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ end_vol_sizer->Add(end_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ end_vol_sizer->Add(m_tiEnd, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(end_vol_sizer);
+
+ // vol step
+ auto vol_step_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto vol_step_text = new wxStaticText(this, wxID_ANY, vol_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiStep = new TextInput(this, wxString::FromDouble(10), _L("mm/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ vol_step_sizer->Add(vol_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ vol_step_sizer->Add(m_tiStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(vol_step_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(23, 129, 63), StateColor::Pressed),
+ std::pair(wxColour(48, 221, 112), StateColor::Hovered),
+ std::pair(0x00AE42, 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, &VFA_Test_Dlg::on_start, this);
+ v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
+
+ m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(VFA_Test_Dlg::on_start), NULL, this);
+
+ // wxGetApp().UpdateDlgDarkUI(this);
+
+ Layout();
+ Fit();
+}
+
+VFA_Test_Dlg::~VFA_Test_Dlg()
+{
+ // Disconnect Events
+ m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(VFA_Test_Dlg::on_start), NULL, this);
+}
+
+void VFA_Test_Dlg::on_start(wxCommandEvent& event)
+{
+ bool read_double = false;
+ read_double = m_tiStart->GetTextCtrl()->GetValue().ToDouble(&m_params.start);
+ read_double = read_double && m_tiEnd->GetTextCtrl()->GetValue().ToDouble(&m_params.end);
+ read_double = read_double && m_tiStep->GetTextCtrl()->GetValue().ToDouble(&m_params.step);
+
+ if (!read_double || m_params.start <= 10 || m_params.step <= 0 || m_params.end < (m_params.start + m_params.step)) {
+ MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nstart > 10 \step >= 0\nend > start + step)"), wxEmptyString, wxICON_WARNING | wxOK);
+ msg_dlg.ShowModal();
+ return;
+ }
+
+ m_params.mode = CalibMode::Calib_VFA_Tower;
+ m_plater->calib_VFA(m_params);
+ EndModal(wxID_OK);
+}
+
+void VFA_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect)
+{
+ this->Refresh();
+ Fit();
+}
+
+
+
+// Retraction_Test_Dlg
+//
+
+Retraction_Test_Dlg::Retraction_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
+ : DPIDialog(parent, id, _L("Retraction test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
+{
+ wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
+ SetSizer(v_sizer);
+
+ // Settings
+ //
+ wxString start_length_str = _L("Start retraction length: ");
+ wxString end_length_str = _L("End retraction length: ");
+ wxString length_step_str = _L("step: ");
+ auto text_size = wxWindow::GetTextExtent(start_length_str);
+ text_size.IncTo(wxWindow::GetTextExtent(end_length_str));
+ text_size.IncTo(wxWindow::GetTextExtent(length_step_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));
+ // start 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_tiStart = new TextInput(this, std::to_string(0), _L("mm"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+
+ start_length_sizer->Add(start_length_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ start_length_sizer->Add(m_tiStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(start_length_sizer);
+
+ // end length
+ auto end_length_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto end_length_text = new wxStaticText(this, wxID_ANY, end_length_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiEnd = new TextInput(this, std::to_string(2), _L("mm"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ end_length_sizer->Add(end_length_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ end_length_sizer->Add(m_tiEnd, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(end_length_sizer);
+
+ // length step
+ auto length_step_sizer = new wxBoxSizer(wxHORIZONTAL);
+ auto length_step_text = new wxStaticText(this, wxID_ANY, length_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
+ m_tiStep = new TextInput(this, wxString::FromDouble(0.1), _L("mm/mm"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
+ m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+ length_step_sizer->Add(length_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ length_step_sizer->Add(m_tiStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
+ settings_sizer->Add(length_step_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(23, 129, 63), StateColor::Pressed),
+ std::pair(wxColour(48, 221, 112), StateColor::Hovered),
+ std::pair(0x00AE42, 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, &Retraction_Test_Dlg::on_start, this);
+ v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
+
+ m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Retraction_Test_Dlg::on_start), NULL, this);
+
+ //wxGetApp().UpdateDlgDarkUI(this);
+
+ Layout();
+ Fit();
+}
+
+Retraction_Test_Dlg::~Retraction_Test_Dlg() {
+ // Disconnect Events
+ m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Retraction_Test_Dlg::on_start), NULL, this);
+}
+
+void Retraction_Test_Dlg::on_start(wxCommandEvent& event) {
+ bool read_double = false;
+ read_double = m_tiStart->GetTextCtrl()->GetValue().ToDouble(&m_params.start);
+ read_double = read_double && m_tiEnd->GetTextCtrl()->GetValue().ToDouble(&m_params.end);
+ read_double = read_double && m_tiStep->GetTextCtrl()->GetValue().ToDouble(&m_params.step);
+
+ if (!read_double || m_params.start < 0 || m_params.step <= 0 || m_params.end < (m_params.start + m_params.step)) {
+ MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nstart > 0 \step >= 0\nend > start + step)"), wxEmptyString, wxICON_WARNING | wxOK);
+ msg_dlg.ShowModal();
+ return;
+ }
+
+ m_params.mode = CalibMode::Calib_Retraction_tower;
+ m_plater->calib_retraction(m_params);
+ EndModal(wxID_OK);
+
+}
+
+void Retraction_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
+ this->Refresh();
+ Fit();
+
+}
+
+
+}} // namespace Slic3r::GUI
diff --git a/src/slic3r/GUI/calib_dlg.hpp b/src/slic3r/GUI/calib_dlg.hpp
new file mode 100644
index 0000000000..a0b15e5d16
--- /dev/null
+++ b/src/slic3r/GUI/calib_dlg.hpp
@@ -0,0 +1,127 @@
+#ifndef slic3r_calib_dlg_hpp_
+#define slic3r_calib_dlg_hpp_
+
+#include "wxExtensions.hpp"
+#include "GUI_Utils.hpp"
+#include "Widgets/RadioBox.hpp"
+#include "Widgets/Button.hpp"
+#include "Widgets/RoundedRectangle.hpp"
+#include "Widgets/Label.hpp"
+#include "Widgets/CheckBox.hpp"
+#include "Widgets/ComboBox.hpp"
+#include "Widgets/TextInput.hpp"
+#include "GUI_App.hpp"
+#include "wx/hyperlink.h"
+#include
+#include "libslic3r/Calib.hpp"
+
+namespace Slic3r { namespace GUI {
+
+class PA_Calibration_Dlg : public DPIDialog
+{
+public:
+ PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater* plater);
+ ~PA_Calibration_Dlg();
+ void on_dpi_changed(const wxRect& suggested_rect) override;
+ void on_show(wxShowEvent& event);
+protected:
+ virtual void on_start(wxCommandEvent& event);
+ virtual void on_extruder_type_changed(wxCommandEvent& event);
+ virtual void on_method_changed(wxCommandEvent& event);
+
+protected:
+ bool m_bDDE;
+ Calib_Params m_params;
+
+
+ wxRadioBox* m_rbExtruderType;
+ wxRadioBox* m_rbMethod;
+ TextInput* m_tiStartPA;
+ TextInput* m_tiEndPA;
+ TextInput* m_tiPAStep;
+ CheckBox* m_cbPrintNum;
+ Button* m_btnStart;
+
+ Plater* m_plater;
+};
+
+class Temp_Calibration_Dlg : public DPIDialog
+{
+public:
+ Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater* plater);
+ ~Temp_Calibration_Dlg();
+ void on_dpi_changed(const wxRect& suggested_rect) override;
+
+protected:
+
+ virtual void on_start(wxCommandEvent& event);
+ virtual void on_filament_type_changed(wxCommandEvent& event);
+ Calib_Params m_params;
+
+ wxRadioBox* m_rbFilamentType;
+ TextInput* m_tiStart;
+ TextInput* m_tiEnd;
+ TextInput* m_tiStep;
+ Button* m_btnStart;
+ Plater* m_plater;
+};
+
+class MaxVolumetricSpeed_Test_Dlg : public DPIDialog
+{
+public:
+ MaxVolumetricSpeed_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater);
+ ~MaxVolumetricSpeed_Test_Dlg();
+ void on_dpi_changed(const wxRect& suggested_rect) override;
+
+protected:
+
+ virtual void on_start(wxCommandEvent& event);
+ Calib_Params m_params;
+
+ TextInput* m_tiStart;
+ TextInput* m_tiEnd;
+ TextInput* m_tiStep;
+ Button* m_btnStart;
+ Plater* m_plater;
+};
+
+class VFA_Test_Dlg : public DPIDialog {
+public:
+ VFA_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater);
+ ~VFA_Test_Dlg();
+ void on_dpi_changed(const wxRect& suggested_rect) override;
+
+protected:
+ virtual void on_start(wxCommandEvent& event);
+ Calib_Params m_params;
+
+ TextInput* m_tiStart;
+ TextInput* m_tiEnd;
+ TextInput* m_tiStep;
+ Button* m_btnStart;
+ Plater* m_plater;
+};
+
+
+class Retraction_Test_Dlg : public DPIDialog
+{
+public:
+ Retraction_Test_Dlg (wxWindow* parent, wxWindowID id, Plater* plater);
+ ~Retraction_Test_Dlg ();
+ void on_dpi_changed(const wxRect& suggested_rect) override;
+
+protected:
+
+ virtual void on_start(wxCommandEvent& event);
+ Calib_Params m_params;
+
+ TextInput* m_tiStart;
+ TextInput* m_tiEnd;
+ TextInput* m_tiStep;
+ Button* m_btnStart;
+ Plater* m_plater;
+};
+
+}} // namespace Slic3r::GUI
+
+#endif
diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp
index 8d84f7a21f..c225a296a2 100644
--- a/src/slic3r/Utils/CalibUtils.cpp
+++ b/src/slic3r/Utils/CalibUtils.cpp
@@ -64,7 +64,7 @@ static void read_model_from_file(const std::string& input_file, Model& model)
object->ensure_on_bed();
}
-std::array get_cut_plane(const BoundingBoxf3 &bbox, const double &cut_height)
+std::array get_cut_plane_points(const BoundingBoxf3 &bbox, const double &cut_height)
{
std::array plane_pts;
plane_pts[0] = Vec3d(bbox.min(0), bbox.min(1), cut_height);
@@ -576,7 +576,7 @@ void CalibUtils::calib_retraction(const CalibInfo &calib_info, std::string &erro
auto obj_bb = obj->bounding_box();
auto height = 1.0 + 0.4 + ((params.end - params.start)) / params.step;
if (height < obj_bb.size().z()) {
- std::array plane_pts = get_cut_plane(obj_bb, height);
+ std::array plane_pts = get_cut_plane_points(obj_bb, height);
cut_model(model, plane_pts, ModelObjectCutAttribute::KeepLower);
}