mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 03:07:55 -06:00
NEW: add calibration for 3rd printer
cherry pick from SoftFever Change-Id: Ibb2b4693c3f2e800dbef1542cbada6736154ce48
This commit is contained in:
parent
8a34f6b606
commit
4b23192d6f
13 changed files with 1014 additions and 12 deletions
15
resources/images/calib_sf.svg
Normal file
15
resources/images/calib_sf.svg
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<svg width="14" height="15" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_8074_35820)">
|
||||||
|
<path d="M2.1084 3.09195C2.1084 2.81581 2.33226 2.59195 2.6084 2.59195H11.3915C11.6677 2.59195 11.8915 2.81581 11.8915 3.09195V11.8751C11.8915 12.1512 11.6677 12.3751 11.3915 12.3751H2.6084C2.33226 12.3751 2.1084 12.1512 2.1084 11.8751V3.09195Z" fill="#505050"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.1084 3.59195V11.3751H10.8915V3.59195H3.1084ZM2.6084 2.59195C2.33226 2.59195 2.1084 2.81581 2.1084 3.09195V11.8751C2.1084 12.1512 2.33226 12.3751 2.6084 12.3751H11.3915C11.6677 12.3751 11.8915 12.1512 11.8915 11.8751V3.09195C11.8915 2.81581 11.6677 2.59195 11.3915 2.59195H2.6084Z" fill="#F7F7F7"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.6709 5.48537L6.6709 0.48352L7.6709 0.483521L7.6709 5.48537L6.6709 5.48537Z" fill="#F7F7F7"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.6709 14.4835L6.6709 9.48166L7.6709 9.48166L7.6709 14.4835L6.6709 14.4835Z" fill="#F7F7F7"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.99815 6.93469L14 6.93469L14 7.93469L8.99815 7.93469L8.99815 6.93469Z" fill="#F7F7F7"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.000104992 6.93469L5.00195 6.93469L5.00195 7.93469L0.000104904 7.93469L0.000104992 6.93469Z" fill="#F7F7F7"/>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip0_8074_35820">
|
||||||
|
<rect width="14" height="14" fill="white" transform="translate(0 14.4835) rotate(-90)"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
17
resources/images/calib_sf_inactive.svg
Normal file
17
resources/images/calib_sf_inactive.svg
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<svg width="14" height="15" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g opacity="0.5">
|
||||||
|
<g clip-path="url(#clip0_8074_35820)">
|
||||||
|
<path d="M2.1084 3.09195C2.1084 2.81581 2.33226 2.59195 2.6084 2.59195H11.3915C11.6677 2.59195 11.8915 2.81581 11.8915 3.09195V11.8751C11.8915 12.1512 11.6677 12.3751 11.3915 12.3751H2.6084C2.33226 12.3751 2.1084 12.1512 2.1084 11.8751V3.09195Z" fill="#505050"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.1084 3.59195V11.3751H10.8915V3.59195H3.1084ZM2.6084 2.59195C2.33226 2.59195 2.1084 2.81581 2.1084 3.09195V11.8751C2.1084 12.1512 2.33226 12.3751 2.6084 12.3751H11.3915C11.6677 12.3751 11.8915 12.1512 11.8915 11.8751V3.09195C11.8915 2.81581 11.6677 2.59195 11.3915 2.59195H2.6084Z" fill="#F7F7F7"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.6709 5.48537L6.6709 0.48352L7.6709 0.483521L7.6709 5.48537L6.6709 5.48537Z" fill="#F7F7F7"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.6709 14.4835L6.6709 9.48166L7.6709 9.48166L7.6709 14.4835L6.6709 14.4835Z" fill="#F7F7F7"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.99815 6.93469L14 6.93469L14 7.93469L8.99815 7.93469L8.99815 6.93469Z" fill="#F7F7F7"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.000104992 6.93469L5.00195 6.93469L5.00195 7.93469L0.000104904 7.93469L0.000104992 6.93469Z" fill="#F7F7F7"/>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip0_8074_35820">
|
||||||
|
<rect width="14" height="14" fill="white" transform="translate(0 14.4835) rotate(-90)"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
|
@ -398,6 +398,8 @@ set(SLIC3R_GUI_SOURCES
|
||||||
GUI/CalibrationWizard.cpp
|
GUI/CalibrationWizard.cpp
|
||||||
GUI/CalibrationWizardPage.cpp
|
GUI/CalibrationWizardPage.cpp
|
||||||
GUI/CalibrationWizardPage.hpp
|
GUI/CalibrationWizardPage.hpp
|
||||||
|
GUI/calib_dlg.cpp
|
||||||
|
GUI/calib_dlg.hpp
|
||||||
GUI/Calibration.hpp
|
GUI/Calibration.hpp
|
||||||
GUI/Calibration.cpp
|
GUI/Calibration.cpp
|
||||||
GUI/PrintOptionsDialog.hpp
|
GUI/PrintOptionsDialog.hpp
|
||||||
|
|
|
@ -24,6 +24,7 @@ enum CUSTOM_ID
|
||||||
ID_TITLE,
|
ID_TITLE,
|
||||||
ID_MODEL_STORE,
|
ID_MODEL_STORE,
|
||||||
ID_PUBLISH,
|
ID_PUBLISH,
|
||||||
|
ID_CALIB,
|
||||||
ID_TOOL_BAR = 3200,
|
ID_TOOL_BAR = 3200,
|
||||||
ID_AMS_NOTEBOOK,
|
ID_AMS_NOTEBOOK,
|
||||||
};
|
};
|
||||||
|
@ -194,6 +195,7 @@ void BBLTopbar::Init(wxFrame* parent)
|
||||||
m_frame = parent;
|
m_frame = parent;
|
||||||
m_skip_popup_file_menu = false;
|
m_skip_popup_file_menu = false;
|
||||||
m_skip_popup_dropdown_menu = false;
|
m_skip_popup_dropdown_menu = false;
|
||||||
|
m_skip_popup_calib_menu = false;
|
||||||
|
|
||||||
wxInitAllImageHandlers();
|
wxInitAllImageHandlers();
|
||||||
|
|
||||||
|
@ -241,6 +243,13 @@ void BBLTopbar::Init(wxFrame* parent)
|
||||||
wxBitmap redo_inactive_bitmap = create_scaled_bitmap("topbar_redo_inactive", nullptr, TOPBAR_ICON_SIZE);
|
wxBitmap redo_inactive_bitmap = create_scaled_bitmap("topbar_redo_inactive", nullptr, TOPBAR_ICON_SIZE);
|
||||||
m_redo_item->SetDisabledBitmap(redo_inactive_bitmap);
|
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->AddSpacer(FromDIP(10));
|
||||||
this->AddStretchSpacer(1);
|
this->AddStretchSpacer(1);
|
||||||
|
|
||||||
|
@ -296,6 +305,7 @@ void BBLTopbar::Init(wxFrame* parent)
|
||||||
this->Bind(wxEVT_MENU_CLOSE, &BBLTopbar::OnMenuClose, this);
|
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::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::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::OnIconize, this, wxID_ICONIZE_FRAME);
|
||||||
this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFullScreen, this, wxID_MAXIMIZE_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);
|
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_undo_item->GetId(), true);
|
||||||
this->EnableTool(m_redo_item->GetId(), true);
|
this->EnableTool(m_redo_item->GetId(), true);
|
||||||
|
this->EnableTool(m_calib_item->GetId(), true);
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,6 +373,7 @@ void BBLTopbar::DisableUndoRedoItems()
|
||||||
{
|
{
|
||||||
this->EnableTool(m_undo_item->GetId(), false);
|
this->EnableTool(m_undo_item->GetId(), false);
|
||||||
this->EnableTool(m_redo_item->GetId(), false);
|
this->EnableTool(m_redo_item->GetId(), false);
|
||||||
|
this->EnableTool(m_calib_item->GetId(), false);
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,6 +429,11 @@ wxMenu* BBLTopbar::GetTopMenu()
|
||||||
return &m_top_menu;
|
return &m_top_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxMenu* BBLTopbar::GetCalibMenu()
|
||||||
|
{
|
||||||
|
return &m_calib_menu;
|
||||||
|
}
|
||||||
|
|
||||||
void BBLTopbar::SetTitle(wxString title)
|
void BBLTopbar::SetTitle(wxString title)
|
||||||
{
|
{
|
||||||
wxGCDC dc(this);
|
wxGCDC dc(this);
|
||||||
|
@ -469,6 +486,10 @@ void BBLTopbar::Rescale() {
|
||||||
item->SetBitmap(create_scaled_bitmap("topbar_redo", this, TOPBAR_ICON_SIZE));
|
item->SetBitmap(create_scaled_bitmap("topbar_redo", this, TOPBAR_ICON_SIZE));
|
||||||
item->SetDisabledBitmap(create_scaled_bitmap("topbar_redo_inactive", nullptr, 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_TITLE);
|
||||||
|
|
||||||
/*item = this->FindTool(ID_PUBLISH);
|
/*item = this->FindTool(ID_PUBLISH);
|
||||||
|
@ -580,6 +601,23 @@ void BBLTopbar::OnDropdownToolItem(wxAuiToolBarEvent& evt)
|
||||||
tb->SetToolSticky(evt.GetId(), false);
|
tb->SetToolSticky(evt.GetId(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BBLTopbar::OnCalibToolItem(wxAuiToolBarEvent &evt)
|
||||||
|
{
|
||||||
|
wxAuiToolBar *tb = static_cast<wxAuiToolBar *>(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)
|
void BBLTopbar::OnMouseLeftDown(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
wxPoint mouse_pos = ::wxGetMousePosition();
|
wxPoint mouse_pos = ::wxGetMousePosition();
|
||||||
|
|
|
@ -23,6 +23,7 @@ public:
|
||||||
void OnCloseFrame(wxAuiToolBarEvent& event);
|
void OnCloseFrame(wxAuiToolBarEvent& event);
|
||||||
void OnFileToolItem(wxAuiToolBarEvent& evt);
|
void OnFileToolItem(wxAuiToolBarEvent& evt);
|
||||||
void OnDropdownToolItem(wxAuiToolBarEvent& evt);
|
void OnDropdownToolItem(wxAuiToolBarEvent& evt);
|
||||||
|
void OnCalibToolItem(wxAuiToolBarEvent &evt);
|
||||||
void OnMouseLeftDClock(wxMouseEvent& mouse);
|
void OnMouseLeftDClock(wxMouseEvent& mouse);
|
||||||
void OnMouseLeftDown(wxMouseEvent& event);
|
void OnMouseLeftDown(wxMouseEvent& event);
|
||||||
void OnMouseLeftUp(wxMouseEvent& event);
|
void OnMouseLeftUp(wxMouseEvent& event);
|
||||||
|
@ -43,6 +44,7 @@ public:
|
||||||
void AddDropDownSubMenu(wxMenu* sub_menu, const wxString& title);
|
void AddDropDownSubMenu(wxMenu* sub_menu, const wxString& title);
|
||||||
void AddDropDownMenuItem(wxMenuItem* menu_item);
|
void AddDropDownMenuItem(wxMenuItem* menu_item);
|
||||||
wxMenu *GetTopMenu();
|
wxMenu *GetTopMenu();
|
||||||
|
wxMenu *GetCalibMenu();
|
||||||
void SetTitle(wxString title);
|
void SetTitle(wxString title);
|
||||||
void SetMaximizedSize();
|
void SetMaximizedSize();
|
||||||
void SetWindowSize();
|
void SetWindowSize();
|
||||||
|
@ -60,6 +62,7 @@ private:
|
||||||
wxPoint m_delta;
|
wxPoint m_delta;
|
||||||
wxMenu m_top_menu;
|
wxMenu m_top_menu;
|
||||||
wxMenu* m_file_menu;
|
wxMenu* m_file_menu;
|
||||||
|
wxMenu m_calib_menu;
|
||||||
wxAuiToolBarItem* m_title_item;
|
wxAuiToolBarItem* m_title_item;
|
||||||
wxAuiToolBarItem* m_account_item;
|
wxAuiToolBarItem* m_account_item;
|
||||||
wxAuiToolBarItem* m_model_store_item;
|
wxAuiToolBarItem* m_model_store_item;
|
||||||
|
@ -67,6 +70,7 @@ private:
|
||||||
wxAuiToolBarItem *m_publish_item;
|
wxAuiToolBarItem *m_publish_item;
|
||||||
wxAuiToolBarItem* m_undo_item;
|
wxAuiToolBarItem* m_undo_item;
|
||||||
wxAuiToolBarItem* m_redo_item;
|
wxAuiToolBarItem* m_redo_item;
|
||||||
|
wxAuiToolBarItem* m_calib_item;
|
||||||
wxAuiToolBarItem* maximize_btn;
|
wxAuiToolBarItem* maximize_btn;
|
||||||
|
|
||||||
wxBitmap m_publish_bitmap;
|
wxBitmap m_publish_bitmap;
|
||||||
|
@ -78,4 +82,5 @@ private:
|
||||||
int m_toolbar_h;
|
int m_toolbar_h;
|
||||||
bool m_skip_popup_file_menu;
|
bool m_skip_popup_file_menu;
|
||||||
bool m_skip_popup_dropdown_menu;
|
bool m_skip_popup_dropdown_menu;
|
||||||
|
bool m_skip_popup_calib_menu;
|
||||||
};
|
};
|
||||||
|
|
|
@ -120,6 +120,7 @@ public:
|
||||||
// Get the current print. It is either m_fff_print or m_sla_print.
|
// Get the current print. It is either m_fff_print or m_sla_print.
|
||||||
const PrintBase* current_print() const { return m_print; }
|
const PrintBase* current_print() const { return m_print; }
|
||||||
const Print* fff_print() const { return m_fff_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; }
|
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.
|
// 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().
|
// If the project_path is empty, just run output_filepath().
|
||||||
|
|
|
@ -2648,6 +2648,77 @@ void MainFrame::init_menubar_as_editor()
|
||||||
//m_topbar->AddDropDownMenuItem(language_item);
|
//m_topbar->AddDropDownMenuItem(language_item);
|
||||||
//m_topbar->AddDropDownMenuItem(config_item);
|
//m_topbar->AddDropDownMenuItem(config_item);
|
||||||
m_topbar->AddDropDownSubMenu(helpMenu, _L("Help"));
|
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
|
#else
|
||||||
m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File")));
|
m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File")));
|
||||||
if (editMenu)
|
if (editMenu)
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
// BBS
|
// BBS
|
||||||
#include "BBLTopbar.hpp"
|
#include "BBLTopbar.hpp"
|
||||||
#include "PrinterWebView.hpp"
|
#include "PrinterWebView.hpp"
|
||||||
|
#include "calib_dlg.hpp"
|
||||||
|
|
||||||
#define ENABEL_PRINT_ALL 0
|
#define ENABEL_PRINT_ALL 0
|
||||||
|
|
||||||
|
@ -336,6 +337,13 @@ public:
|
||||||
void RunScript(wxString js);
|
void RunScript(wxString js);
|
||||||
void show_device(bool bBBLPrinter);
|
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.
|
// BBS. Replace title bar and menu bar with top bar.
|
||||||
BBLTopbar* m_topbar{ nullptr };
|
BBLTopbar* m_topbar{ nullptr };
|
||||||
PrintHostQueueDialog* printhost_queue_dlg() { return m_printhost_queue_dlg; }
|
PrintHostQueueDialog* printhost_queue_dlg() { return m_printhost_queue_dlg; }
|
||||||
|
|
|
@ -7686,7 +7686,7 @@ Print& Plater::fff_print() { return p->fff_print; }
|
||||||
const SLAPrint& Plater::sla_print() const { return p->sla_print; }
|
const SLAPrint& Plater::sla_print() const { return p->sla_print; }
|
||||||
SLAPrint& Plater::sla_print() { 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;
|
bool transfer_preset_changes = false;
|
||||||
// BBS: save confirm
|
// BBS: save confirm
|
||||||
|
@ -7729,7 +7729,10 @@ int Plater::new_project(bool skip_confirm, bool silent)
|
||||||
//reset project
|
//reset project
|
||||||
p->project.reset();
|
p->project.reset();
|
||||||
//set project name
|
//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);
|
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));
|
!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;
|
wxArrayString input_files;
|
||||||
wxGetApp().import_model(this, input_files);
|
|
||||||
if (input_files.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::vector<fs::path> paths;
|
std::vector<fs::path> paths;
|
||||||
for (const auto& file : input_files)
|
if (fname.empty()) {
|
||||||
paths.emplace_back(into_path(file));
|
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;
|
std::string snapshot_label;
|
||||||
assert(! paths.empty());
|
assert(! paths.empty());
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "Jobs/SendJob.hpp"
|
#include "Jobs/SendJob.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
#include "libslic3r/PrintBase.hpp"
|
#include "libslic3r/PrintBase.hpp"
|
||||||
|
#include "libslic3r/Calib.hpp"
|
||||||
|
|
||||||
#define FILAMENT_SYSTEM_COLORS_NUM 16
|
#define FILAMENT_SYSTEM_COLORS_NUM 16
|
||||||
|
|
||||||
|
@ -207,7 +208,7 @@ public:
|
||||||
const SLAPrint& sla_print() const;
|
const SLAPrint& sla_print() const;
|
||||||
SLAPrint& sla_print();
|
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
|
// BBS: save & backup
|
||||||
void load_project(wxString const & filename = "", wxString const & originfile = "-");
|
void load_project(wxString const & filename = "", wxString const & originfile = "-");
|
||||||
int save_project(bool saveAs = false);
|
int save_project(bool saveAs = false);
|
||||||
|
@ -222,7 +223,7 @@ public:
|
||||||
bool open_3mf_file(const fs::path &file_path);
|
bool open_3mf_file(const fs::path &file_path);
|
||||||
int get_3mf_file_count(std::vector<fs::path> paths);
|
int get_3mf_file_count(std::vector<fs::path> paths);
|
||||||
void add_file();
|
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 import_sl1_archive();
|
||||||
void extract_config_from_project();
|
void extract_config_from_project();
|
||||||
void load_gcode();
|
void load_gcode();
|
||||||
|
@ -230,6 +231,14 @@ public:
|
||||||
void reload_gcode_from_disk();
|
void reload_gcode_from_disk();
|
||||||
void refresh_print();
|
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
|
//BBS: add only gcode mode
|
||||||
bool only_gcode_mode() { return m_only_gcode; }
|
bool only_gcode_mode() { return m_only_gcode; }
|
||||||
void set_only_gcode(bool only_gcode) { m_only_gcode = only_gcode; }
|
void set_only_gcode(bool only_gcode) { m_only_gcode = only_gcode; }
|
||||||
|
|
700
src/slic3r/GUI/calib_dlg.cpp
Normal file
700
src/slic3r/GUI/calib_dlg.cpp
Normal file
|
@ -0,0 +1,700 @@
|
||||||
|
#include "calib_dlg.hpp"
|
||||||
|
#include "GUI_App.hpp"
|
||||||
|
#include "MsgDialog.hpp"
|
||||||
|
#include "I18N.hpp"
|
||||||
|
#include <wx/dcgraph.h>
|
||||||
|
#include "MainFrame.hpp"
|
||||||
|
#include <string>
|
||||||
|
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, int>(wxColour(23, 129, 63), StateColor::Pressed),
|
||||||
|
std::pair<wxColour, int>(wxColour(48, 221, 112), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(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, int>(wxColour(23, 129, 63), StateColor::Pressed),
|
||||||
|
std::pair<wxColour, int>(wxColour(48, 221, 112), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(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, int>(wxColour(23, 129, 63), StateColor::Pressed),
|
||||||
|
std::pair<wxColour, int>(wxColour(48, 221, 112), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(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, int>(wxColour(23, 129, 63), StateColor::Pressed),
|
||||||
|
std::pair<wxColour, int>(wxColour(48, 221, 112), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(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, int>(wxColour(23, 129, 63), StateColor::Pressed),
|
||||||
|
std::pair<wxColour, int>(wxColour(48, 221, 112), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(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
|
127
src/slic3r/GUI/calib_dlg.hpp
Normal file
127
src/slic3r/GUI/calib_dlg.hpp
Normal file
|
@ -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 <wx/radiobox.h>
|
||||||
|
#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
|
|
@ -64,7 +64,7 @@ static void read_model_from_file(const std::string& input_file, Model& model)
|
||||||
object->ensure_on_bed();
|
object->ensure_on_bed();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<Vec3d, 4> get_cut_plane(const BoundingBoxf3 &bbox, const double &cut_height)
|
std::array<Vec3d, 4> get_cut_plane_points(const BoundingBoxf3 &bbox, const double &cut_height)
|
||||||
{
|
{
|
||||||
std::array<Vec3d, 4> plane_pts;
|
std::array<Vec3d, 4> plane_pts;
|
||||||
plane_pts[0] = Vec3d(bbox.min(0), bbox.min(1), cut_height);
|
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 obj_bb = obj->bounding_box();
|
||||||
auto height = 1.0 + 0.4 + ((params.end - params.start)) / params.step;
|
auto height = 1.0 + 0.4 + ((params.end - params.start)) / params.step;
|
||||||
if (height < obj_bb.size().z()) {
|
if (height < obj_bb.size().z()) {
|
||||||
std::array<Vec3d, 4> plane_pts = get_cut_plane(obj_bb, height);
|
std::array<Vec3d, 4> plane_pts = get_cut_plane_points(obj_bb, height);
|
||||||
cut_model(model, plane_pts, ModelObjectCutAttribute::KeepLower);
|
cut_model(model, plane_pts, ModelObjectCutAttribute::KeepLower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue