OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::VFA_Test_Dlg Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/calib_dlg.hpp>

Inheritance diagram for Slic3r::GUI::VFA_Test_Dlg:
Collaboration diagram for Slic3r::GUI::VFA_Test_Dlg:

Public Member Functions

 VFA_Test_Dlg (wxWindow *parent, wxWindowID id, Plater *plater)
 ~VFA_Test_Dlg ()
void on_dpi_changed (const wxRect &suggested_rect) override
void EndModal (int retCode) override
float scale_factor () const
float prev_scale_factor () const
void set_scale_factor (float v)
void set_prev_scale_factor (float v)
void set_em_unit (int v)
bool force_rescale () const
int em_unit () const
const wxFont & normal_font () const
void enable_force_rescale ()
int ShowModal ()

Protected Member Functions

virtual void on_start (wxCommandEvent &event)
virtual void on_sys_color_changed ()

Protected Attributes

Calib_Params m_params
TextInput * m_tiStart
TextInput * m_tiEnd
TextInput * m_tiStep
CheckBox * m_cbAutoAdjust
CheckBox * m_cbResize
Plater * m_plater

Private Member Functions

void update_em_unit ()
bool is_new_scale_factor () const
void rescale (const wxRect &suggested_rect)

Private Attributes

float m_scale_factor
int m_em_unit
wxFont m_normal_font
float m_prev_scale_factor
bool m_can_rescale
bool m_force_rescale
int m_new_font_point_size

Detailed Description

Constructor & Destructor Documentation

◆ VFA_Test_Dlg()

Slic3r::GUI::VFA_Test_Dlg::VFA_Test_Dlg ( wxWindow * parent,
wxWindowID id,
Plater * plater )
782 : DPIDialog(parent, id, _L("VFA test"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
784{
785 SetBackgroundColour(*wxWHITE); // make sure background color set for dialog
786 SetForegroundColour(wxColour("#363636"));
787 SetFont(Label::Body_14);
788
789 wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
790 SetSizer(v_sizer);
791
792 // Settings
793 wxString start_str = _L("Start speed: ");
794 wxString end_vol_str = _L("End speed: ");
795 wxString vol_step_str = _L_CONTEXT("Step", "Increment") + ": ";
796 int text_max = GetTextMax(this, std::vector<wxString>{start_str, end_vol_str, vol_step_str});
797
798 auto st_size = wxSize(text_max, -1);
799 auto ti_size = FromDIP(wxSize(120, -1));
800
801 LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Settings"));
802 wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
803
804 settings_sizer->AddSpacer(FromDIP(5));
805
806 // start vol
807 auto start_vol_sizer = new wxBoxSizer(wxHORIZONTAL);
808 auto start_vol_text = new wxStaticText(this, wxID_ANY, start_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
809 m_tiStart = new TextInput(this, std::to_string(40), _L("mm/s"), "", wxDefaultPosition, ti_size);
810 m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
811
812 start_vol_sizer->Add(start_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
813 start_vol_sizer->Add(m_tiStart , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
814 settings_sizer->Add(start_vol_sizer, 0, wxLEFT, FromDIP(3));
815
816 // end vol
817 auto end_vol_sizer = new wxBoxSizer(wxHORIZONTAL);
818 auto end_vol_text = new wxStaticText(this, wxID_ANY, end_vol_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
819 m_tiEnd = new TextInput(this, std::to_string(200), _L("mm/s"), "", wxDefaultPosition, ti_size);
820 m_tiEnd->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
821 end_vol_sizer->Add(end_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
822 end_vol_sizer->Add(m_tiEnd , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
823 settings_sizer->Add(end_vol_sizer, 0, wxLEFT, FromDIP(3));
824
825 // vol step
826 auto vol_step_sizer = new wxBoxSizer(wxHORIZONTAL);
827 auto vol_step_text = new wxStaticText(this, wxID_ANY, vol_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
828 m_tiStep = new TextInput(this, wxString::FromDouble(10), _L("mm/s"), "", wxDefaultPosition, ti_size);
829 m_tiStep->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
830 vol_step_sizer->Add(vol_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
831 vol_step_sizer->Add(m_tiStep , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
832 settings_sizer->Add(vol_step_sizer, 0, wxLEFT, FromDIP(3));
833
834 // Resize the model to the nozzle diameter (recommended)
835 m_cbResize = add_scale_checkbox(this, settings_sizer);
836
837 // Auto-adjust parameters to the filament's max volumetric speed
838 auto auto_adjust_sizer = new wxBoxSizer(wxHORIZONTAL);
839 m_cbAutoAdjust = new CheckBox(this);
840 m_cbAutoAdjust->SetValue(true);
841 auto auto_adjust_text = new wxStaticText(this, wxID_ANY, _L("Auto-adjust to max volumetric speed"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
842 m_cbAutoAdjust->SetToolTip(_L("If the end speed would exceed the filament's maximum volumetric speed, automatically lower the layer "
843 "height (keeping standard values and staying within the machine's limits) to reach it. If even the "
844 "minimum layer height is not enough, lower the end speed instead."));
845 auto_adjust_text->SetToolTip(m_cbAutoAdjust->GetToolTipText());
846 auto_adjust_sizer->Add(m_cbAutoAdjust , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
847 auto_adjust_sizer->Add(auto_adjust_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
848 settings_sizer->Add(auto_adjust_sizer, 0, wxLEFT | wxTOP, FromDIP(3));
849
850 settings_sizer->AddSpacer(FromDIP(5));
851
852 v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
853 v_sizer->AddSpacer(FromDIP(5));
854
855 auto dlg_btns = new DialogButtons(this, {"OK"});
856
857 auto bottom_sizer = new wxBoxSizer(wxHORIZONTAL);
858
859 auto wiki_btn = new Button(this, "", "toolbar_wiki", 0, 15);
860 auto wiki_url = "https://www.orcaslicer.com/wiki/vfa_calib";
861 wiki_btn->SetToolTip(_L("Wiki Guide") + "\n" + wiki_url);
862 wiki_btn->SetStyle(ButtonStyle::Confirm, ButtonType::Circle);
863 wiki_btn->SetCanFocus(false);
864 wiki_btn->Bind(wxEVT_LEFT_DOWN, ([wiki_url](auto& e) {wxLaunchDefaultBrowser(wiki_url);}));
865
866 bottom_sizer->Add(wiki_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(10));
867 bottom_sizer->AddStretchSpacer();
868 bottom_sizer->Add(dlg_btns, 0, wxEXPAND);
869 v_sizer->Add(bottom_sizer, 0, wxEXPAND);
870
871 dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &VFA_Test_Dlg::on_start, this);
872
873 wxGetApp().UpdateDlgDarkUI(this);
874
875 Layout();
876 Fit();
877 v_sizer->SetSizeHints(this);
878}
@ Confirm
Definition Button.hpp:25
@ Circle
Definition Button.hpp:37
#define _L(s)
Definition OBJ.cpp:34
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
static wxFont Body_14
Definition Label.hpp:53
CheckBox * m_cbAutoAdjust
Definition calib_dlg.hpp:110
TextInput * m_tiEnd
Definition calib_dlg.hpp:108
CheckBox * m_cbResize
Definition calib_dlg.hpp:111
Plater * m_plater
Definition calib_dlg.hpp:112
TextInput * m_tiStart
Definition calib_dlg.hpp:107
TextInput * m_tiStep
Definition calib_dlg.hpp:109
virtual void on_start(wxCommandEvent &event)
Definition calib_dlg.cpp:885
CheckBox * add_scale_checkbox(wxWindow *parent, wxSizer *settings_sizer)
Definition calib_dlg.cpp:67
int GetTextMax(wxWindow *parent, const std::vector< wxString > &labels)
Definition calib_dlg.cpp:59
static Plater * plater()
Definition GUI_Factories.cpp:400
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15

References _L, _L_CONTEXT, Label::Body_14, Circle, Confirm, Slic3r::GUI::DialogButtons::GetOK(), m_cbAutoAdjust, m_cbResize, m_plater, m_tiEnd, m_tiStart, m_tiStep, on_start(), Slic3r::GUI::plater(), and wxStaticText.

Here is the call graph for this function:

◆ ~VFA_Test_Dlg()

Slic3r::GUI::VFA_Test_Dlg::~VFA_Test_Dlg ( )
881{
882 // Disconnect Events
883}

Member Function Documentation

◆ em_unit()

int Slic3r::GUI::DPIAware< wxDialog >::em_unit ( ) const
inlineinherited
203{ return m_em_unit; }
Definition GUI_Utils.hpp:107

Referenced by Slic3r::GUI::AuxiliaryDialog::AuxiliaryDialog(), Slic3r::GUI::CopyrightsDialog::CopyrightsDialog(), Slic3r::GUI::DesignTextDialog::DesignTextDialog(), Slic3r::GUI::EditGCodeDialog::EditGCodeDialog(), Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::GUI::MsgNoUpdates::MsgNoUpdates(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::OAuthDialog::OAuthDialog(), Slic3r::GUI::ParamsDialog::ParamsDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::SettingsDialog::SettingsDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), anonymous_namespace{3DPrinterOS.cpp}::UploadOptionsDialog::UploadOptionsDialog(), Slic3r::GUI::PublishSettingsDialog::add_row_ui(), Slic3r::GUI::DiffPresetDialog::complete_dialog_creation(), Slic3r::GUI::DiffPresetDialog::create_edit_sizer(), Slic3r::GUI::DiffPresetDialog::create_presets_sizer(), Slic3r::GUI::DiffPresetDialog::create_tree(), Slic3r::GUI::ElegooPrintHostSendDialog::init(), Slic3r::GUI::FlashforgePrintHostSendDialog::init(), Slic3r::GUI::PrintHostSendDialog::init(), Slic3r::GUI::AboutDialog::on_dpi_changed(), Slic3r::GUI::AuxiliaryDialog::on_dpi_changed(), Slic3r::GUI::BedShapeDialog::on_dpi_changed(), Slic3r::GUI::ConfigWizard::on_dpi_changed(), Slic3r::GUI::CopyrightsDialog::on_dpi_changed(), Slic3r::GUI::DiffPresetDialog::on_dpi_changed(), Slic3r::GUI::EditGCodeDialog::on_dpi_changed(), Slic3r::GUI::FileArchiveDialog::on_dpi_changed(), Slic3r::GUI::OAuthDialog::on_dpi_changed(), Slic3r::GUI::ObjectTableDialog::on_dpi_changed(), Slic3r::GUI::ParamsDialog::on_dpi_changed(), Slic3r::GUI::PhysicalPrinterDialog::on_dpi_changed(), Slic3r::GUI::PrintHostQueueDialog::on_dpi_changed(), Slic3r::GUI::PurgeModeDialog::on_dpi_changed(), Slic3r::GUI::SavePresetDialog::on_dpi_changed(), Slic3r::GUI::SendSystemInfoDialog::on_dpi_changed(), Slic3r::GUI::SettingsDialog::on_dpi_changed(), and Slic3r::GUI::UnsavedChangesDialog::on_dpi_changed().

Here is the caller graph for this function:

◆ enable_force_rescale()

void Slic3r::GUI::DPIAware< wxDialog >::enable_force_rescale ( )
inlineinherited
206{ m_force_rescale = true; }

◆ EndModal()

void Slic3r::GUI::DPIDialog::EndModal ( int retCode)
inlineoverrideinherited
306 {
307 if (!dialogStack.empty() && dialogStack.front() != this) {
308 // This is a bug in wxWidgets
309 // when the dialog is not top modal dialog, EndModal() just hide dialog without quit
310 // the modal event loop. And the modal event loop blocks us from bottom widgets.
311 // Solution: let user click it manually or close outside. FIXME
312 BOOST_LOG_TRIVIAL(warning) << "DPIAware::EndModal Error: dialogStack is not empty, but top dialog is not this one. retCode=" << retCode;
313 return;
314 }
315
316 return wxDialog::EndModal(retCode);
317 }
std::deque< wxDialog * > dialogStack
Definition GUI_Utils.cpp:549

References Slic3r::GUI::dialogStack.

Referenced by Slic3r::GUI::CloneDialog::CloneDialog(), Slic3r::GUI::ConfigWizard::ConfigWizard(), Slic3r::GUI::CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(), Slic3r::GUI::DeleteConfirmDialog::DeleteConfirmDialog(), Slic3r::GUI::DesignVariableDialog::DesignVariableDialog(), Slic3r::GUI::anonymous_namespace{PrintHostDialogs.cpp}::FlashforgeSlotDialog::FlashforgeSlotDialog(), Slic3r::GUI::GuideFrame::GuideFrame(), Slic3r::GUI::InputIpAddressDialog::InputIpAddressDialog(), Slic3r::GUI::ManualNozzleCountDialog::ManualNozzleCountDialog(), Slic3r::GUI::MsgUpdateConfig::MsgUpdateConfig(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::MultiChoiceDialog::MultiChoiceDialog(), Slic3r::GUI::NetworkErrorDialog::NetworkErrorDialog(), Slic3r::GUI::NetworkPluginRestartDialog::NetworkPluginRestartDialog(), Slic3r::GUI::PartSkipConfirmDialog::PartSkipConfirmDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::PlateNameEditDialog::PlateNameEditDialog(), Slic3r::GUI::PlateSettingsDialog::PlateSettingsDialog(), Slic3r::GUI::PublishSettingsDialog::PublishSettingsDialog(), Slic3r::GUI::SelectMachineDialog::SelectMachineDialog(), Slic3r::GUI::SendFailedConfirm::SendFailedConfirm(), Slic3r::GUI::SendSystemInfoDialog::SendSystemInfoDialog(), Slic3r::GUI::ShortcutCaptureDialog::ShortcutCaptureDialog(), Slic3r::GUI::SingleChoiceDialog::SingleChoiceDialog(), StepMeshDialog::StepMeshDialog(), Slic3r::GUI::SyncAmsInfoDialog::SyncAmsInfoDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), Slic3r::GUI::UpdatePluginDialog::UpdatePluginDialog(), Slic3r::GUI::UpdateVersionDialog::UpdateVersionDialog(), Slic3r::GUI::wgtDeviceNozzleRackUpgradeDlg::wgtDeviceNozzleRackUpgradeDlg(), Slic3r::GUI::SavePresetDialog::accept(), Slic3r::GUI::MsgDialog::add_button(), Slic3r::GUI::TipsDialog::add_button(), Slic3r::GUI::FilamentPickerDialog::BindEvents(), Slic3r::GUI::PluginPickerDialog::build_capability_ui(), Slic3r::GUI::BedShapeDialog::build_dialog(), Slic3r::GUI::PluginPickerDialog::build_ui(), Slic3r::GUI::UnsavedChangesDialog::close(), Slic3r::GUI::FileArchiveDialog::create_btn_sizer(), Slic3r::GUI::ColorDecomposeDialog::create_button_panel(), Slic3r::GUI::MixedFilamentDialog::create_button_panel(), Slic3r::GUI::CreateFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::CreatePresetForPrinterDialog::create_dialog_buttons(), Slic3r::GUI::EditFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::create_dialog_buttons(), Slic3r::GUI::PreferencesDialog::create_item_language_combobox(), Slic3r::GUI::PreferencesDialog::create_item_region_combobox(), Slic3r::GUI::PreferencesDialog::create_items(), Slic3r::GUI::CreatePrinterPresetDialog::create_page1_dialog_buttons(), Slic3r::GUI::CreatePrinterPresetDialog::create_page2_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::data_init(), Slic3r::GUI::WebDialog::destroy_silently(), Slic3r::GUI::EditFilamentPresetDialog::edit_preset(), Slic3r::GUI::ConnectPrinterDialog::end_modal(), Slic3r::GUI::PrintHostSendDialog::EndModal(), Slic3r::GUI::ColorPickerDialog::finish(), Slic3r::GUI::WebDialog::finish(), Slic3r::GUI::Newer3mfVersionDialog::get_btn_sizer(), Slic3r::GUI::ScoreDialog::get_button_sizer(), Slic3r::GUI::WebViewHostDialog::handle_common_script_command(), Slic3r::GUI::ExportPresetBundleDialog::InitExportData(), Slic3r::GUI::SelectMachineDialog::navigate_to_timelapse_page(), Slic3r::GUI::BindMachineDialog::on_bind_success(), Slic3r::GUI::ConnectPrinterDialog::on_button_confirm(), Slic3r::GUI::RecenterDialog::on_button_confirm(), Slic3r::GUI::BindMachineDialog::on_cancel(), Slic3r::GUI::EditCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::InputIpAddressDialog::on_cancel(), Slic3r::GUI::NewCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::OAuthDialog::on_cancel(), Slic3r::GUI::PingCodeBindDialog::on_cancel(), Slic3r::GUI::SelectMachineDialog::on_cancel(), Slic3r::GUI::SendToPrinterDialog::on_cancel(), Slic3r::GUI::SyncAmsInfoDialog::on_cancel(), Slic3r::GUI::UnBindMachineDialog::on_cancel(), Slic3r::GUI::WebDialog::on_close_window(), Slic3r::GUI::NetworkPluginDownloadDialog::on_dont_ask(), Slic3r::GUI::NetworkPluginDownloadDialog::on_download(), Slic3r::GUI::EditDevNameDialog::on_edit_name(), Slic3r::GUI::ConfirmBeforeSendDialog::on_hide(), Slic3r::GUI::PrivacyUpdateDialog::on_hide(), Slic3r::GUI::ShortcutCaptureDialog::on_key(), Slic3r::GUI::TextureImportDialog::on_ok_clicked(), Slic3r::GUI::FileArchiveDialog::on_open_button(), Slic3r::GUI::NetworkPluginDownloadDialog::on_remind_later(), Slic3r::GUI::ProjectDropDialog::on_select_cancel(), Slic3r::GUI::SavePresetDialog::on_select_cancel(), Slic3r::GUI::ProjectDropDialog::on_select_ok(), Slic3r::GUI::SendMultiMachinePage::on_send(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip(), Slic3r::GUI::TextureImportDialog::on_skip_clicked(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip_version(), Slic3r::GUI::Cornering_Test_Dlg::on_start(), Slic3r::GUI::FlowRateCalibrationDialog::on_start(), Slic3r::GUI::Input_Shaping_Damp_Test_Dlg::on_start(), Slic3r::GUI::Input_Shaping_Freq_Test_Dlg::on_start(), Slic3r::GUI::MaxVolumetricSpeed_Test_Dlg::on_start(), Slic3r::GUI::PA_Calibration_Dlg::on_start(), Slic3r::GUI::Retraction_Test_Dlg::on_start(), Slic3r::GUI::Temp_Calibration_Dlg::on_start(), Slic3r::GUI::VFA_Test_Dlg::on_start(), Slic3r::GUI::CalibrationDialog::on_start_calibration(), Slic3r::GUI::UnBindMachineDialog::on_unbind_printer(), Slic3r::GUI::PartSkipDialog::OnApplyDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::OnCancel(), Slic3r::GUI::AboutDialog::onCloseDialog(), Slic3r::GUI::CopyrightsDialog::onCloseDialog(), Slic3r::GUI::MultiNozzleSyncDialog::OnRackStatusReadingFinished(), Slic3r::GUI::GuideFrame::OnScriptMessage(), Slic3r::GUI::InputIpAddressDialog::OnTimer(), Slic3r::GUI::KBShortcutsDialog::open_mouse_preferences(), Slic3r::GUI::TroubleshootDialog::PackAll(), Slic3r::GUI::TroubleshootDialog::RebuildSystemProfiles(), Slic3r::GUI::SpeedDialWebDialog::run_action(), Slic3r::GUI::OAuthDialog::Show(), Slic3r::GUI::MultiNozzleSyncDialog::UpdateButton(), and Slic3r::GUI::CreatePrinterPresetDialog::validate_input_valid().

◆ force_rescale()

bool Slic3r::GUI::DPIAware< wxDialog >::force_rescale ( ) const
inlineinherited
201{ return m_force_rescale; }

◆ is_new_scale_factor()

bool Slic3r::GUI::DPIAware< wxDialog >::is_new_scale_factor ( ) const
inlineprivateinherited
262{ return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }

◆ normal_font()

◆ on_dpi_changed()

void Slic3r::GUI::VFA_Test_Dlg::on_dpi_changed ( const wxRect & suggested_rect)
overridevirtual

Implements Slic3r::GUI::DPIAware< wxDialog >.

1034{
1035 this->Refresh();
1036 Fit();
1037}

◆ on_start()

void Slic3r::GUI::VFA_Test_Dlg::on_start ( wxCommandEvent & event)
protectedvirtual
886{
887 bool read_double = false;
888 read_double = m_tiStart->GetTextCtrl()->GetValue().ToDouble(&m_params.start);
889 read_double = read_double && m_tiEnd->GetTextCtrl()->GetValue().ToDouble(&m_params.end);
890 read_double = read_double && m_tiStep->GetTextCtrl()->GetValue().ToDouble(&m_params.step);
891
892 if (!read_double || m_params.start <= 10 || m_params.step <= 0 || m_params.end < (m_params.start + m_params.step)) {
893 MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nstart > 10\nstep >= 0\nend > start + step"), wxEmptyString, wxICON_WARNING | wxOK);
894 msg_dlg.ShowModal();
895 return;
896 }
897
898 // If the requested end speed would exceed the filament's maximum volumetric speed, the slicer clamps the
899 // outer wall speed, so the upper blocks of the tower would all print at the same (clamped) speed instead of
900 // the requested one. Depending on the "Auto-adjust" option, either fix it automatically or just warn.
901 m_params.vfa_layer_height = 0.0; // 0 = auto (nozzle/2); overridden below when auto-adjusting
902 m_params.nozzle_based_resize = m_cbResize->GetValue();
903 if (const auto* preset_bundle = wxGetApp().preset_bundle) {
904 const auto& printer_config = preset_bundle->printers.get_edited_preset().config;
905 const auto& print_config = preset_bundle->prints.get_edited_preset().config;
906 const auto& filament_config = preset_bundle->filaments.get_edited_preset().config;
907
908 const int extruder_id = std::max(m_params.extruder_id, 0);
909 auto get_at = [extruder_id](const ConfigOptionFloats* opt, double fallback) {
910 if (opt == nullptr || opt->values.empty())
911 return fallback;
912 return opt->values[std::min(static_cast<size_t>(extruder_id), opt->values.size() - 1)];
913 };
914
915 const double nozzle_diameter = get_at(printer_config.option<ConfigOptionFloats>("nozzle_diameter"), vfa_base_nozzle_diameter);
916 double preset_lh = nozzle_diameter / 2.0;
917 if (const auto* lh_opt = print_config.option<ConfigOptionFloat>("layer_height"))
918 if (lh_opt->value > 0.0)
919 preset_lh = lh_opt->value;
920 // Layer height the tower will actually print at: nozzle/2 when resizing, else the preset value.
921 const double default_lh = m_params.nozzle_based_resize ? nozzle_diameter / 2.0 : preset_lh;
922 const double max_vol_speed = get_at(filament_config.option<ConfigOptionFloats>("filament_max_volumetric_speed"), 0.0);
923 const double machine_min_lh = get_at(printer_config.option<ConfigOptionFloats>("min_layer_height"), 0.0);
924 const double machine_max_lh = get_at(printer_config.option<ConfigOptionFloats>("max_layer_height"), 0.0);
925
926 double line_width = print_config.get_abs_value("outer_wall_line_width", nozzle_diameter);
927 if (line_width <= 0.0)
928 line_width = print_config.get_abs_value("line_width", nozzle_diameter);
929 if (line_width <= 0.0)
930 line_width = nozzle_diameter;
931
932 // Max outer-wall speed printable at a given layer height without exceeding the volumetric limit.
933 auto speed_limit_for_lh = [&](double lh) -> double {
934 const double mm3_per_mm = Flow(line_width, lh, nozzle_diameter).mm3_per_mm();
935 return mm3_per_mm > 0.0 ? max_vol_speed / mm3_per_mm : 1e9;
936 };
937
938 auto confirm_clamp = [&](const wxString& question) -> bool {
939 MessageDialog msg_dlg(nullptr,
940 wxString::Format(_L("The end speed (%.0f mm/s) exceeds the filament's maximum volumetric speed "
941 "(%.1f mm³/s), which limits the outer wall to about %.0f mm/s at this line width and "
942 "layer height.\n Speeds above this will be clamped, so the upper blocks of the tower "
943 "will not print at the requested speed.\n\n%s"),
944 m_params.end, max_vol_speed, speed_limit_for_lh(default_lh), question),
945 _L("VFA test"), wxICON_WARNING | wxYES_NO | wxNO_DEFAULT);
946 return msg_dlg.ShowModal() == wxID_YES;
947 };
948
949 if (max_vol_speed > 0.0 && nozzle_diameter > 0.0 && m_params.end > speed_limit_for_lh(default_lh)) {
950 // The layer-height auto-adjust only applies when resizing is enabled (it changes the layer height).
951 if (m_cbAutoAdjust->GetValue() && m_params.nozzle_based_resize) {
952 // Candidate layer heights are the ones actually used by the process profiles compatible with the
953 // current printer (clamped to the machine's layer-height limits, when set). A smaller layer height
954 // means a smaller cross-section, hence a higher printable speed under the volumetric limit; pick the
955 // largest candidate that still reaches the end speed to keep the change from the default minimal.
956 std::vector<double> candidates;
957 for (const auto& preset : preset_bundle->prints.get_presets()) {
958 if (!preset.is_compatible || preset.is_default)
959 continue;
960 const auto* lh_opt = preset.config.option<ConfigOptionFloat>("layer_height");
961 if (lh_opt == nullptr || lh_opt->value <= 0.0)
962 continue;
963 const double lh = lh_opt->value;
964 if ((machine_min_lh > 0.0 && lh < machine_min_lh - 1e-6) ||
965 (machine_max_lh > 0.0 && lh > machine_max_lh + 1e-6))
966 continue;
967 candidates.push_back(lh);
968 }
969 std::sort(candidates.begin(), candidates.end());
970 candidates.erase(std::unique(candidates.begin(), candidates.end(),
971 [](double a, double b) { return std::abs(a - b) < 1e-6; }),
972 candidates.end());
973
974 // Largest candidate <= the default layer height that still reaches the end speed (smallest change).
975 double chosen_lh = 0.0;
976 for (auto it = candidates.rbegin(); it != candidates.rend(); ++it) {
977 if (*it > default_lh + 1e-6)
978 continue; // never increase the layer height above the default
979 if (speed_limit_for_lh(*it) >= m_params.end) { chosen_lh = *it; break; }
980 }
981
982 if (chosen_lh > 0.0) {
983 // Reducing the layer height is enough to reach the requested end speed.
984 m_params.vfa_layer_height = chosen_lh;
985 MessageDialog msg_dlg(nullptr,
986 wxString::Format(_L("The end speed (%.0f mm/s) exceeds the filament's maximum volumetric speed "
987 "(%.1f mm³/s) at the default layer height (%.2f mm).\n\n"
988 "The layer height has been reduced to %.2f mm (a value used by this printer's "
989 "profiles) so the tower can reach the requested speed."),
990 m_params.end, max_vol_speed, default_lh, chosen_lh),
991 _L("VFA test"), wxICON_INFORMATION | wxOK);
992 msg_dlg.ShowModal();
993 } else if (!candidates.empty()) {
994 // Even the smallest available layer height cannot reach the end speed; propose a lower end speed
995 // based on that layer height, the line width and the maximum volumetric speed.
996 const double min_lh = candidates.front();
997 const double reachable = speed_limit_for_lh(min_lh);
998 double new_end = std::floor(reachable / m_params.step) * m_params.step; // snap down to a step multiple
999 if (new_end < m_params.start + m_params.step)
1000 new_end = m_params.start + m_params.step;
1001 MessageDialog msg_dlg(nullptr,
1002 wxString::Format(_L("Even at the smallest layer height used by this printer's profiles (%.2f mm) the "
1003 "end speed (%.0f mm/s) exceeds the filament's maximum volumetric speed "
1004 "(%.1f mm³/s).\n\n"
1005 "The layer height will be set to %.2f mm and the end speed lowered to %.0f mm/s.\n\n"
1006 "Continue?"),
1007 min_lh, m_params.end, max_vol_speed, min_lh, new_end),
1008 _L("VFA test"), wxICON_WARNING | wxYES_NO | wxNO_DEFAULT);
1009 if (msg_dlg.ShowModal() != wxID_YES)
1010 return;
1011 m_params.end = new_end;
1012 m_params.vfa_layer_height = min_lh;
1013 } else {
1014 // No compatible process profiles to draw layer heights from: warn and let the user decide.
1015 if (!confirm_clamp(_L("Continue anyway?")))
1016 return;
1017 }
1018 } else {
1019 // Auto-adjust off, or resizing disabled (which forbids changing the layer height): just warn.
1020 if (!confirm_clamp(m_params.nozzle_based_resize
1021 ? _L("Enable \"Auto-adjust\" to fix this automatically, or continue anyway?")
1022 : _L("Enable \"Auto-scale for nozzle\" and \"Auto-adjust\" to fix this automatically, or continue anyway?")))
1023 return;
1024 }
1025 }
1026 }
1027
1029 m_plater->calib_VFA(m_params);
1030 EndModal(wxID_OK);
1031}
ConfigOption * option(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:2768
void EndModal(int retCode) override
Definition GUI_Utils.hpp:305
Calib_Params m_params
Definition calib_dlg.hpp:105
static DynamicPrintConfig & printer_config()
Definition GUI_ObjectList.cpp:131
zaa_minimize_perimeter_height ConfigOptionFloat
Definition PrintConfig.hpp:1954
zaa_minimize_perimeter_height nozzle_diameter((ConfigOptionBool, reduce_infill_retraction))((ConfigOptionBool
@ Calib_VFA_Tower
Definition calib.hpp:32
static constexpr double vfa_base_nozzle_diameter
Definition calib.hpp:66
ConfigOptionFloatsTempl< false > ConfigOptionFloats
Definition Config.hpp:1015

References _L, Slic3r::Calib_VFA_Tower, Slic3r::GUI::DPIDialog::EndModal(), m_cbAutoAdjust, m_cbResize, m_params, m_plater, m_tiEnd, m_tiStart, m_tiStep, Slic3r::Flow::mm3_per_mm(), Slic3r::nozzle_diameter(), Slic3r::GUI::printer_config(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::ConfigOptionSingle< T >::value, and Slic3r::vfa_base_nozzle_diameter.

Referenced by VFA_Test_Dlg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_sys_color_changed()

◆ prev_scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::prev_scale_factor ( ) const
inlineinherited
196{ return m_prev_scale_factor; }

◆ rescale()

void Slic3r::GUI::DPIAware< wxDialog >::rescale ( const wxRect & suggested_rect)
inlineprivateinherited
265 {
266 this->Freeze();
267
268 m_force_rescale = false;
269
270 // set normal application font as a current window font
271 m_normal_font = this->GetFont();
272
274
275 // rescale missed controls sizes and images
277
278 this->Layout();
279 this->Thaw();
280
281 // reset previous scale factor from current scale factor value
283 }
virtual void on_dpi_changed(const wxRect &suggested_rect)=0
void update_em_unit()
Definition GUI_Utils.hpp:249

◆ scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::scale_factor ( ) const
inlineinherited
195{ return m_scale_factor; }

◆ set_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::set_em_unit ( int v)
inlineinherited
200{ m_em_unit = v; }

◆ set_prev_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_prev_scale_factor ( float v)
inlineinherited

◆ set_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_scale_factor ( float v)
inlineinherited
198{ m_scale_factor = v; }

◆ ShowModal()

◆ update_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::update_em_unit ( )
inlineprivateinherited
250 {
251 // Linux specific issue : get_dpi_for_window(this) still doesn't responce to the Display's scale in new wxWidgets(3.1.3).
252 // So, calculate the m_em_unit value from the font size, as before
253#if !defined(__WXGTK__)
255#else
256 // initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
257 m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
258#endif // __WXGTK__
259 }

Member Data Documentation

◆ m_can_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_can_rescale
privateinherited
235{ true };

◆ m_cbAutoAdjust

CheckBox* Slic3r::GUI::VFA_Test_Dlg::m_cbAutoAdjust
protected

Referenced by VFA_Test_Dlg(), and on_start().

◆ m_cbResize

CheckBox* Slic3r::GUI::VFA_Test_Dlg::m_cbResize
protected

Referenced by VFA_Test_Dlg(), and on_start().

◆ m_em_unit

int Slic3r::GUI::DPIAware< wxDialog >::m_em_unit
privateinherited

◆ m_force_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_force_rescale
privateinherited
236{ false };

◆ m_new_font_point_size

int Slic3r::GUI::DPIAware< wxDialog >::m_new_font_point_size
privateinherited

◆ m_normal_font

wxFont Slic3r::GUI::DPIAware< wxDialog >::m_normal_font
privateinherited

◆ m_params

Calib_Params Slic3r::GUI::VFA_Test_Dlg::m_params
protected

Referenced by on_start().

◆ m_plater

Plater* Slic3r::GUI::VFA_Test_Dlg::m_plater
protected

Referenced by VFA_Test_Dlg(), and on_start().

◆ m_prev_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_prev_scale_factor
privateinherited

◆ m_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_scale_factor
privateinherited

◆ m_tiEnd

TextInput* Slic3r::GUI::VFA_Test_Dlg::m_tiEnd
protected

Referenced by VFA_Test_Dlg(), and on_start().

◆ m_tiStart

TextInput* Slic3r::GUI::VFA_Test_Dlg::m_tiStart
protected

Referenced by VFA_Test_Dlg(), and on_start().

◆ m_tiStep

TextInput* Slic3r::GUI::VFA_Test_Dlg::m_tiStep
protected

Referenced by VFA_Test_Dlg(), and on_start().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/calib_dlg.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/calib_dlg.cpp