From e8fd6951ad5d6387a0502e90275a2f64525b72e4 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 11 Mar 2024 16:22:20 +0100 Subject: [PATCH 01/10] Purging volumes new parameters --- src/libslic3r/Preset.cpp | 6 +++--- src/libslic3r/Print.cpp | 4 ++++ src/libslic3r/PrintConfig.cpp | 30 ++++++++++++++++++++++++++++++ src/libslic3r/PrintConfig.hpp | 4 ++++ src/slic3r/GUI/Tab.cpp | 4 ++++ 5 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index c62f6d8161..1f66091039 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -479,7 +479,7 @@ static std::vector s_Preset_filament_options { "filament_colour", "filament_diameter", "filament_type", "filament_soluble", "filament_notes", "filament_max_volumetric_speed", "extrusion_multiplier", "filament_density", "filament_cost", "filament_spool_weight", "filament_loading_speed", "filament_loading_speed_start", "filament_load_time", "filament_unloading_speed", "filament_unloading_speed_start", "filament_unload_time", "filament_toolchange_delay", "filament_cooling_moves", "filament_stamping_loading_speed", "filament_stamping_distance", - "filament_cooling_initial_speed", "filament_cooling_final_speed", "filament_ramming_parameters", "filament_minimal_purge_on_wipe_tower", + "filament_cooling_initial_speed", "filament_loading_purge_multiplier", "filament_unloading_purge_multiplier", "filament_cooling_final_speed", "filament_ramming_parameters", "filament_minimal_purge_on_wipe_tower", "filament_multitool_ramming", "filament_multitool_ramming_volume", "filament_multitool_ramming_flow", "temperature", "idle_temperature", "first_layer_temperature", "bed_temperature", "first_layer_bed_temperature", "fan_always_on", "cooling", "min_fan_speed", "max_fan_speed", "bridge_fan_speed", "disable_fan_first_layers", "full_fan_speed_layer", "fan_below_layer_time", "slowdown_below_layer_time", "min_print_speed", @@ -510,8 +510,8 @@ static std::vector s_Preset_printer_options { "single_extruder_multi_material", "start_gcode", "end_gcode", "before_layer_gcode", "layer_gcode", "toolchange_gcode", "color_change_gcode", "pause_print_gcode", "template_custom_gcode", "between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction", - "cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "max_print_height", - "default_print_profile", "inherits", + "cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "multimaterial_purging_for_unload", "multimaterial_purging_for_load", + "max_print_height", "default_print_profile", "inherits", "remaining_times", "silent_mode", "machine_limits_usage", "thumbnails", "thumbnails_format" }; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 0263657885..65e3ab3631 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -224,6 +224,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "filament_minimal_purge_on_wipe_tower" || opt_key == "filament_cooling_initial_speed" || opt_key == "filament_cooling_final_speed" + || opt_key == "filament_loading_purge_multiplier" + || opt_key == "filament_unloading_purge_multiplier" || opt_key == "filament_ramming_parameters" || opt_key == "filament_multitool_ramming" || opt_key == "filament_multitool_ramming_volume" @@ -249,6 +251,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "cooling_tube_retraction" || opt_key == "cooling_tube_length" || opt_key == "extra_loading_move" + || opt_key == "multimaterial_purging_for_unload" + || opt_key == "multimaterial_purging_for_load" || opt_key == "travel_speed" || opt_key == "travel_speed_z" || opt_key == "first_layer_speed" diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index ffb19ce88d..938f217859 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1144,6 +1144,22 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloats { 3.4 }); + def = this->add("filament_loading_purge_multiplier", coPercents); + def->label = L("loading purge multiplier"); + def->tooltip = L(""); + def->sidetext = L("%"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionPercents { 100 }); + + def = this->add("filament_unloading_purge_multiplier", coPercents); + def->label = L("unloading purge multiplier"); + def->tooltip = L(""); + def->sidetext = L("%"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionPercents { 100 }); + def = this->add("filament_load_time", coFloats); def->label = L("Filament load time"); def->tooltip = L("Time for the printer firmware (or the Multi Material Unit 2.0) to load a new filament during a tool change (when executing the T code). This time is added to the total print time by the G-code time estimator."); @@ -2136,6 +2152,20 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(-2.)); + def = this->add("multimaterial_purging_for_unload", coFloat); + def->label = L("unloading"); + def->tooltip = L(""); + def->sidetext = L("mm krychlovy"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(70)); + + def = this->add("multimaterial_purging_for_load", coFloat); + def->label = L("loading"); + def->tooltip = L(""); + def->sidetext = L("mm krychlovy"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(70)); + def = this->add("perimeter_acceleration", coFloat); def->label = L("Perimeters"); def->tooltip = L("This is the acceleration your printer will use for perimeters. " diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 6e4793bf7d..2efbaaabd8 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -727,6 +727,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloats, filament_cooling_initial_speed)) ((ConfigOptionFloats, filament_minimal_purge_on_wipe_tower)) ((ConfigOptionFloats, filament_cooling_final_speed)) + ((ConfigOptionPercents, filament_loading_purge_multiplier)) + ((ConfigOptionPercents, filament_unloading_purge_multiplier)) ((ConfigOptionStrings, filament_ramming_parameters)) ((ConfigOptionBools, filament_multitool_ramming)) ((ConfigOptionFloats, filament_multitool_ramming_volume)) @@ -779,6 +781,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, remaining_times)) ((ConfigOptionBool, silent_mode)) ((ConfigOptionFloat, extra_loading_move)) + ((ConfigOptionFloat, multimaterial_purging_for_unload)) + ((ConfigOptionFloat, multimaterial_purging_for_load)) ((ConfigOptionString, color_change_gcode)) ((ConfigOptionString, pause_print_gcode)) ((ConfigOptionString, template_custom_gcode)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index a80df44e5f..c529e926f0 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2273,6 +2273,8 @@ void TabFilament::build() optgroup->append_single_option_line("filament_cooling_final_speed"); optgroup->append_single_option_line("filament_stamping_loading_speed"); optgroup->append_single_option_line("filament_stamping_distance"); + optgroup->append_single_option_line("filament_loading_purge_multiplier"); + optgroup->append_single_option_line("filament_unloading_purge_multiplier"); create_line_with_widget(optgroup.get(), "filament_ramming_parameters", "", [this](wxWindow* parent) { auto ramming_dialog_btn = new wxButton(parent, wxID_ANY, _(L("Ramming settings"))+dots, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); @@ -3379,6 +3381,8 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) optgroup->append_single_option_line("cooling_tube_length"); optgroup->append_single_option_line("parking_pos_retraction"); optgroup->append_single_option_line("extra_loading_move"); + optgroup->append_single_option_line("multimaterial_purging_for_unload"); + optgroup->append_single_option_line("multimaterial_purging_for_load"); optgroup->append_single_option_line("high_current_on_filament_swap"); if (from_initial_build) page->clear(); From 8345a82b1cd2f3bb7d5c301e6d438c38445d0c65 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 12 Mar 2024 14:26:06 +0100 Subject: [PATCH 02/10] Remove wiping_volumes_extruders --- src/libslic3r/PresetBundle.cpp | 17 +--- src/libslic3r/PrintConfig.cpp | 10 +-- src/libslic3r/PrintConfig.hpp | 1 - src/slic3r/GUI/Plater.cpp | 5 +- src/slic3r/GUI/WipeTowerDialog.cpp | 134 +++-------------------------- src/slic3r/GUI/WipeTowerDialog.hpp | 20 +---- 6 files changed, 24 insertions(+), 163 deletions(-) diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 7547030b68..2e1d87d7a9 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -38,7 +38,6 @@ namespace Slic3r { static std::vector s_project_options { "colorprint_heights", - "wiping_volumes_extruders", "wiping_volumes_matrix" }; @@ -1732,18 +1731,10 @@ void PresetBundle::update_multi_material_filament_presets() // Now verify if wiping_volumes_matrix has proper size (it is used to deduce number of extruders in wipe tower generator): std::vector old_matrix = this->project_config.option("wiping_volumes_matrix")->values; - size_t old_number_of_extruders = size_t(sqrt(old_matrix.size())+EPSILON); + size_t old_number_of_extruders = size_t(std::sqrt(old_matrix.size())+EPSILON); if (num_extruders != old_number_of_extruders) { - // First verify if purging volumes presets for each extruder matches number of extruders - std::vector& extruders = this->project_config.option("wiping_volumes_extruders")->values; - while (extruders.size() < 2*num_extruders) { - extruders.push_back(extruders.size()>1 ? extruders[0] : 50.); // copy the values from the first extruder - extruders.push_back(extruders.size()>1 ? extruders[1] : 50.); - } - while (extruders.size() > 2*num_extruders) { - extruders.pop_back(); - extruders.pop_back(); - } + const double default_loading_purge = static_cast(printers.get_edited_preset().config.option("multimaterial_purging_for_load"))->value; + const double default_unloading_purge = static_cast(printers.get_edited_preset().config.option("multimaterial_purging_for_unload"))->value; std::vector new_matrix; for (unsigned int i=0;iproject_config.option("wiping_volumes_matrix")->values = new_matrix; } diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 938f217859..86273b921c 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3315,13 +3315,6 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionBool(false)); - def = this->add("wiping_volumes_extruders", coFloats); - def->label = L("Purging volumes - load/unload volumes"); - def->tooltip = L("This vector saves required volumes to change from/to each tool used on the " - "wipe tower. These values are used to simplify creation of the full purging " - "volumes below."); - def->set_default_value(new ConfigOptionFloats { 70., 70., 70., 70., 70., 70., 70., 70., 70., 70. }); - def = this->add("wiping_volumes_matrix", coFloats); def->label = L("Purging volumes - matrix"); def->tooltip = L("This matrix describes volumes (in cubic milimetres) required to purge the" @@ -4415,7 +4408,8 @@ static std::set PrintConfigDef_ignore = { "ensure_vertical_shell_thickness", // Disabled in 2.6.0-alpha6, this option is problematic "infill_only_where_needed", - "gcode_binary" // Introduced in 2.7.0-alpha1, removed in 2.7.1 (replaced by binary_gcode). + "gcode_binary", // Introduced in 2.7.0-alpha1, removed in 2.7.1 (replaced by binary_gcode). + "wiping_volumes_extruders" // Removed in 2.7.3-alpha1. }; void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &value) diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 2efbaaabd8..0e1778985e 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -885,7 +885,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionFloat, wipe_tower_bridging)) ((ConfigOptionInt, wipe_tower_extruder)) ((ConfigOptionFloats, wiping_volumes_matrix)) - ((ConfigOptionFloats, wiping_volumes_extruders)) ((ConfigOptionFloat, z_offset)) ) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index e74ba64cfc..3921c5c354 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -520,17 +520,14 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) : { auto &project_config = wxGetApp().preset_bundle->project_config; const std::vector &init_matrix = (project_config.option("wiping_volumes_matrix"))->values; - const std::vector &init_extruders = (project_config.option("wiping_volumes_extruders"))->values; const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); - WipingDialog dlg(parent, cast(init_matrix), cast(init_extruders), extruder_colours); + WipingDialog dlg(parent, cast(init_matrix), extruder_colours); if (dlg.ShowModal() == wxID_OK) { std::vector matrix = dlg.get_matrix(); - std::vector extruders = dlg.get_extruders(); (project_config.option("wiping_volumes_matrix"))->values = std::vector(matrix.begin(), matrix.end()); - (project_config.option("wiping_volumes_extruders"))->values = std::vector(extruders.begin(), extruders.end()); // Update Project dirty state, update application title bar. wxGetApp().plater()->update_project_dirty_from_presets(); wxPostEvent(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent)); diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index da56e2c305..7bf51fb027 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -72,14 +72,6 @@ RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters) } -#ifdef _WIN32 -#define style wxSP_ARROW_KEYS | wxBORDER_SIMPLE -#else -#define style wxSP_ARROW_KEYS -#endif - - - RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize/*,wxPoint(50,50), wxSize(800,350),wxBORDER_RAISED*/) { @@ -110,6 +102,12 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters) #endif sizer_chart->Add(m_chart, 0, wxALL, 5); +#ifdef _WIN32 + const long style = wxSP_ARROW_KEYS | wxBORDER_SIMPLE; +#else + const long style = wxSP_ARROW_KEYS; +#endif + m_widget_time = new ::SpinInputDouble(this,"", wxEmptyString, wxDefaultPosition, wxSize(ITEM_WIDTH(), -1), style, 0., 5., 3., 0.25); m_widget_time->SetDigits(2); m_widget_volume = new ::SpinInput(this,"",wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,0,10000,0); @@ -190,8 +188,8 @@ std::string RammingPanel::get_parameters() } -// Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button to toggle simple/advanced mode: -WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruders, const std::vector& extruder_colours) +// Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button. +WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours) : wxDialog(parent, wxID_ANY, _(L("Wipe tower - Purging volume adjustment")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/) { SetFont(wxGetApp().normal_font()); @@ -199,7 +197,7 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c auto widget_button = new wxButton(this,wxID_ANY,"-",wxPoint(0,0),wxDefaultSize); update_ui(widget_button); wxGetApp().SetWindowVariantForButton(widget_button); - m_panel_wiping = new WipingPanel(this,matrix,extruders, extruder_colours, widget_button); + m_panel_wiping = new WipingPanel(this,matrix, extruder_colours, widget_button); auto main_sizer = new wxBoxSizer(wxVERTICAL); @@ -223,14 +221,13 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c this->Bind(wxEVT_BUTTON,[this](wxCommandEvent&) { // if OK button is clicked.. m_output_matrix = m_panel_wiping->read_matrix_values(); // ..query wiping panel and save returned values - m_output_extruders = m_panel_wiping->read_extruders_values(); // so they can be recovered later by calling get_...() EndModal(wxID_OK); },wxID_OK); this->Show(); } -// This function allows to "play" with sizers parameters (like align or border) +// This function allows to "play" with sizrs parameters (like align or border) void WipingPanel::format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& info, const wxString& table_title, int table_lshift/*=0*/) { wxSize text_size = GetTextExtent(info); @@ -243,12 +240,12 @@ void WipingPanel::format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_ table_sizer->Add(grid_sizer, 0, wxALIGN_CENTER | wxTOP, 10); } -// This panel contains all control widgets for both simple and advanced mode (these reside in separate sizers) -WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruders, const std::vector& extruder_colours, wxButton* widget_button) + +WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, wxButton* widget_button) : wxPanel(parent,wxID_ANY, wxDefaultPosition, wxDefaultSize/*,wxBORDER_RAISED*/) { m_widget_button = widget_button; // pointer to the button in parent dialog - m_widget_button->Bind(wxEVT_BUTTON,[this](wxCommandEvent&){ toggle_advanced(true); }); + m_widget_button->Bind(wxEVT_BUTTON,[this](wxCommandEvent&){ }); m_number_of_extruders = (int)(sqrt(matrix.size())+0.001); @@ -259,17 +256,12 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, con } // Create two switched panels with their own sizers - m_sizer_simple = new wxBoxSizer(wxVERTICAL); m_sizer_advanced = new wxBoxSizer(wxVERTICAL); - m_page_simple = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); m_page_advanced = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); - m_page_simple->SetSizer(m_sizer_simple); m_page_advanced->SetSizer(m_sizer_advanced); - update_ui(m_page_simple); update_ui(m_page_advanced); - auto gridsizer_simple = new wxGridSizer(3, 5, 10); m_gridsizer_advanced = new wxGridSizer(m_number_of_extruders+1, 5, 1); // First create controls for advanced mode and assign them to m_page_advanced: @@ -326,53 +318,13 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, con _(L("Here you can adjust required purging volume (mm³) for any given pair of tools.")), _(L("Extruder changed to"))); - // Hide preview page before new page creating - // It allows to do that from a beginning of the main panel - m_page_advanced->Hide(); - - // Now the same for simple mode: - gridsizer_simple->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString("")), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - gridsizer_simple->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString(_(L("unloaded")))), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - gridsizer_simple->Add(new wxStaticText(m_page_simple,wxID_ANY,wxString(_(L("loaded")))), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - - auto add_spin_ctrl = [this](std::vector<::SpinInput*>& vec, float initial) - { - ::SpinInput* spin_ctrl = new ::SpinInput(m_page_simple, "", wxEmptyString, wxDefaultPosition, wxSize(ITEM_WIDTH(), -1), style | wxALIGN_RIGHT, 0, 300, (int)initial); - update_ui(spin_ctrl); - vec.push_back(spin_ctrl); - }; - - for (unsigned int i=0;iSetCanFocus(false); - w->SetBackgroundColour(m_colours[i]); - hsizer->Add(w, wxALIGN_CENTER_VERTICAL); - hsizer->AddSpacer(10); - hsizer->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString(_(L("Tool #"))) << i + 1 << ": "), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - - gridsizer_simple->Add(hsizer, 1, wxEXPAND); - gridsizer_simple->Add(m_old.back(),0); - gridsizer_simple->Add(m_new.back(),0); - } - - // collect and format sizer - format_sizer(m_sizer_simple, m_page_simple, gridsizer_simple, - _(L("Total purging volume is calculated by summing two values below, depending on which tools are loaded/unloaded.")), - _(L("Volume to purge (mm³) when the filament is being")), 50); m_sizer = new wxBoxSizer(wxVERTICAL); - m_sizer->Add(m_page_simple, 0, wxEXPAND | wxALL, 25); m_sizer->Add(m_page_advanced, 0, wxEXPAND | wxALL, 25); m_sizer->SetSizeHints(this); SetSizer(m_sizer); - toggle_advanced(); // to show/hide what is appropriate - m_page_advanced->Bind(wxEVT_PAINT,[this](wxPaintEvent&) { wxPaintDC dc(m_page_advanced); int y_pos = 0.5 * (edit_boxes[0][0]->GetPosition().y + edit_boxes[0][edit_boxes.size()-1]->GetPosition().y + edit_boxes[0][edit_boxes.size()-1]->GetSize().y); @@ -390,8 +342,6 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, con // Reads values from the (advanced) wiping matrix: std::vector WipingPanel::read_matrix_values() { - if (!m_advanced) - fill_in_matrix(); std::vector output; for (unsigned int i=0;i WipingPanel::read_matrix_values() { } return output; } - -// Reads values from simple mode to save them for next time: -std::vector WipingPanel::read_extruders_values() { - std::vector output; - for (unsigned int i=0;iGetValue()); - output.push_back(m_new[i]->GetValue()); - } - return output; -} - -// This updates the "advanced" matrix based on values from "simple" mode -void WipingPanel::fill_in_matrix() { - for (unsigned i=0;iSetValue(wxString("")<< (m_old[i]->GetValue() + m_new[j]->GetValue())); - } - } -} - - - -// Function to check if simple and advanced settings are matching -bool WipingPanel::advanced_matches_simple() { - for (unsigned i=0;iGetValue() != (wxString("")<< (m_old[i]->GetValue() + m_new[j]->GetValue()))) - return false; - } - } - return true; -} - - -// Switches the dialog from simple to advanced mode and vice versa -void WipingPanel::toggle_advanced(bool user_action) { - if (m_advanced && !advanced_matches_simple() && user_action) { - if (MessageDialog(this, _L("Switching to simple settings will discard changes done in the advanced mode!\n\nDo you want to proceed?"), - _L("Warning"),wxYES_NO|wxICON_EXCLAMATION).ShowModal() != wxID_YES) - return; - } - if (user_action) - m_advanced = !m_advanced; // user demands a change -> toggle - else - m_advanced = !advanced_matches_simple(); // if called from constructor, show what is appropriate - - (m_advanced ? m_page_advanced : m_page_simple)->Show(); - (!m_advanced ? m_page_advanced : m_page_simple)->Hide(); - - m_widget_button->SetLabel(m_advanced ? _(L("Show simplified settings")) : _(L("Show advanced settings"))); - if (m_advanced) - if (user_action) fill_in_matrix(); // otherwise keep values loaded from config - - m_sizer->Layout(); - Refresh(); -} diff --git a/src/slic3r/GUI/WipeTowerDialog.hpp b/src/slic3r/GUI/WipeTowerDialog.hpp index f6dd110262..ae71ff14e4 100644 --- a/src/slic3r/GUI/WipeTowerDialog.hpp +++ b/src/slic3r/GUI/WipeTowerDialog.hpp @@ -51,26 +51,16 @@ private: class WipingPanel : public wxPanel { public: - WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruders, const std::vector& extruder_colours, wxButton* widget_button); + WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, wxButton* widget_button); std::vector read_matrix_values(); - std::vector read_extruders_values(); - void toggle_advanced(bool user_action = false); void format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& info, const wxString& table_title, int table_lshift=0); -private: - void fill_in_matrix(); - bool advanced_matches_simple(); - - std::vector<::SpinInput*> m_old; - std::vector<::SpinInput*> m_new; +private: std::vector> edit_boxes; std::vector m_colours; unsigned int m_number_of_extruders = 0; - bool m_advanced = false; - wxPanel* m_page_simple = nullptr; - wxPanel* m_page_advanced = nullptr; + wxPanel* m_page_advanced = nullptr; wxBoxSizer* m_sizer = nullptr; - wxBoxSizer* m_sizer_simple = nullptr; wxBoxSizer* m_sizer_advanced = nullptr; wxGridSizer* m_gridsizer_advanced = nullptr; wxButton* m_widget_button = nullptr; @@ -82,15 +72,13 @@ private: class WipingDialog : public wxDialog { public: - WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruders, const std::vector& extruder_colours); + WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours); std::vector get_matrix() const { return m_output_matrix; } - std::vector get_extruders() const { return m_output_extruders; } private: WipingPanel* m_panel_wiping = nullptr; std::vector m_output_matrix; - std::vector m_output_extruders; }; #endif // _WIPE_TOWER_DIALOG_H_ \ No newline at end of file From cf8bada03623e18f357554b3c468265235664458 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 12 Mar 2024 12:31:30 +0100 Subject: [PATCH 03/10] Updated WipingDialog --- src/slic3r/GUI/WipeTowerDialog.cpp | 59 +++++++++++++++++++++--------- src/slic3r/GUI/WipeTowerDialog.hpp | 5 ++- 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 7bf51fb027..9dab4d96e9 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -194,19 +194,42 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c { SetFont(wxGetApp().normal_font()); update_ui(this); - auto widget_button = new wxButton(this,wxID_ANY,"-",wxPoint(0,0),wxDefaultSize); - update_ui(widget_button); - wxGetApp().SetWindowVariantForButton(widget_button); - m_panel_wiping = new WipingPanel(this,matrix, extruder_colours, widget_button); + m_widget_button = new wxButton(this,wxID_ANY,_L("Set default values"), wxPoint(0, 0), wxDefaultSize); + update_ui(m_widget_button); + wxGetApp().SetWindowVariantForButton(m_widget_button); - auto main_sizer = new wxBoxSizer(wxVERTICAL); + m_radio_button1 = new wxRadioButton(this, wxID_ANY, _L("Default from configuration")); + m_radio_button2 = new wxRadioButton(this, wxID_ANY, _L("Custom project-specific settings")); + auto stb = new wxStaticBox(this, wxID_ANY, wxEmptyString); + + m_panel_wiping = new WipingPanel(this,matrix, extruder_colours, m_widget_button); + + update_ui(m_radio_button1); + update_ui(m_radio_button2); + update_ui(stb); + + + + wxString info = _(L("Here you can adjust required purging volume (mm³) for any given pair of tools.")); + wxSize text_size = GetTextExtent(info); + auto info_str = new wxStaticText(this, wxID_ANY, info ,wxDefaultPosition, wxDefaultSize); // set min sizer width according to extruders count - const auto sizer_width = (int)((sqrt(matrix.size()) + 2.8)*ITEM_WIDTH()); + const auto sizer_width = (int)((std::sqrt(matrix.size()) + 2.8)*ITEM_WIDTH()); + auto main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->SetMinSize(wxSize(sizer_width, -1)); - main_sizer->Add(m_panel_wiping, 0, wxEXPAND | wxALL, 5); - main_sizer->Add(widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 5); + main_sizer->Add(info_str, 0, wxALL, 10); + main_sizer->Add(m_radio_button1, 0, wxALL, 10); + main_sizer->Add(m_radio_button2, 0, wxALL, 10); + + auto stb_sizer = new wxStaticBoxSizer(stb, wxVERTICAL); + stb_sizer->Add(m_panel_wiping, 0, wxEXPAND | wxALL, 5); + stb_sizer->Add(m_widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 5); + + main_sizer->Add(stb_sizer, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 20); + + auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL); wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton()); wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton()); @@ -224,19 +247,22 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c EndModal(wxID_OK); },wxID_OK); + this->Bind(wxEVT_RADIOBUTTON, [this](wxCommandEvent& evt) { + wxRadioButton* rdb = dynamic_cast(FindWindowById(evt.GetId())); + m_widget_button->Enable(rdb == m_radio_button2); + m_panel_wiping->Enable(rdb == m_radio_button2); + }); + this->Show(); + } // This function allows to "play" with sizrs parameters (like align or border) -void WipingPanel::format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& info, const wxString& table_title, int table_lshift/*=0*/) +void WipingPanel::format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& table_title, int table_lshift/*=0*/) { - wxSize text_size = GetTextExtent(info); - auto info_str = new wxStaticText(page, wxID_ANY, info ,wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER); - info_str->Wrap(int(0.6*text_size.x)); - sizer->Add( info_str, 0, wxEXPAND); auto table_sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(table_sizer, 0, wxALIGN_CENTER | wxCENTER, table_lshift); - table_sizer->Add(new wxStaticText(page, wxID_ANY, table_title), 0, wxALIGN_CENTER | wxTOP, 50); + table_sizer->Add(new wxStaticText(page, wxID_ANY, table_title), 0, wxALIGN_CENTER | wxTOP, 10); table_sizer->Add(grid_sizer, 0, wxALIGN_CENTER | wxTOP, 10); } @@ -255,7 +281,6 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, con m_colours.push_back(wxColor(rgb.r_uchar(), rgb.g_uchar(), rgb.b_uchar())); } - // Create two switched panels with their own sizers m_sizer_advanced = new wxBoxSizer(wxVERTICAL); m_page_advanced = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); m_page_advanced->SetSizer(m_sizer_advanced); @@ -314,9 +339,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, con } // collect and format sizer - format_sizer(m_sizer_advanced, m_page_advanced, m_gridsizer_advanced, - _(L("Here you can adjust required purging volume (mm³) for any given pair of tools.")), - _(L("Extruder changed to"))); + format_sizer(m_sizer_advanced, m_page_advanced, m_gridsizer_advanced, _(L("Extruder changed to"))); m_sizer = new wxBoxSizer(wxVERTICAL); diff --git a/src/slic3r/GUI/WipeTowerDialog.hpp b/src/slic3r/GUI/WipeTowerDialog.hpp index ae71ff14e4..b7daf33fc2 100644 --- a/src/slic3r/GUI/WipeTowerDialog.hpp +++ b/src/slic3r/GUI/WipeTowerDialog.hpp @@ -53,7 +53,7 @@ class WipingPanel : public wxPanel { public: WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, wxButton* widget_button); std::vector read_matrix_values(); - void format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& info, const wxString& table_title, int table_lshift=0); + void format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& table_title, int table_lshift=0); private: std::vector> edit_boxes; @@ -79,6 +79,9 @@ public: private: WipingPanel* m_panel_wiping = nullptr; std::vector m_output_matrix; + wxRadioButton* m_radio_button1 = nullptr; + wxRadioButton* m_radio_button2 = nullptr; + wxButton* m_widget_button = nullptr; }; #endif // _WIPE_TOWER_DIALOG_H_ \ No newline at end of file From 0988bf29984dcf2d919e1bc6f3e92f0c8e17c529 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 12 Mar 2024 14:36:25 +0100 Subject: [PATCH 04/10] Removed some of the new parameters --- src/libslic3r/Preset.cpp | 4 ++-- src/libslic3r/PresetBundle.cpp | 5 ++--- src/libslic3r/Print.cpp | 6 ++---- src/libslic3r/PrintConfig.cpp | 25 +++++-------------------- src/libslic3r/PrintConfig.hpp | 6 ++---- src/slic3r/GUI/Tab.cpp | 6 ++---- 6 files changed, 15 insertions(+), 37 deletions(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 1f66091039..846cdb3881 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -479,7 +479,7 @@ static std::vector s_Preset_filament_options { "filament_colour", "filament_diameter", "filament_type", "filament_soluble", "filament_notes", "filament_max_volumetric_speed", "extrusion_multiplier", "filament_density", "filament_cost", "filament_spool_weight", "filament_loading_speed", "filament_loading_speed_start", "filament_load_time", "filament_unloading_speed", "filament_unloading_speed_start", "filament_unload_time", "filament_toolchange_delay", "filament_cooling_moves", "filament_stamping_loading_speed", "filament_stamping_distance", - "filament_cooling_initial_speed", "filament_loading_purge_multiplier", "filament_unloading_purge_multiplier", "filament_cooling_final_speed", "filament_ramming_parameters", "filament_minimal_purge_on_wipe_tower", + "filament_cooling_initial_speed", "filament_purge_multiplier", "filament_cooling_final_speed", "filament_ramming_parameters", "filament_minimal_purge_on_wipe_tower", "filament_multitool_ramming", "filament_multitool_ramming_volume", "filament_multitool_ramming_flow", "temperature", "idle_temperature", "first_layer_temperature", "bed_temperature", "first_layer_bed_temperature", "fan_always_on", "cooling", "min_fan_speed", "max_fan_speed", "bridge_fan_speed", "disable_fan_first_layers", "full_fan_speed_layer", "fan_below_layer_time", "slowdown_below_layer_time", "min_print_speed", @@ -510,7 +510,7 @@ static std::vector s_Preset_printer_options { "single_extruder_multi_material", "start_gcode", "end_gcode", "before_layer_gcode", "layer_gcode", "toolchange_gcode", "color_change_gcode", "pause_print_gcode", "template_custom_gcode", "between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction", - "cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "multimaterial_purging_for_unload", "multimaterial_purging_for_load", + "cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "multimaterial_purging", "max_print_height", "default_print_profile", "inherits", "remaining_times", "silent_mode", "machine_limits_usage", "thumbnails", "thumbnails_format" diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 2e1d87d7a9..b5e9c6ff09 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -1733,8 +1733,7 @@ void PresetBundle::update_multi_material_filament_presets() std::vector old_matrix = this->project_config.option("wiping_volumes_matrix")->values; size_t old_number_of_extruders = size_t(std::sqrt(old_matrix.size())+EPSILON); if (num_extruders != old_number_of_extruders) { - const double default_loading_purge = static_cast(printers.get_edited_preset().config.option("multimaterial_purging_for_load"))->value; - const double default_unloading_purge = static_cast(printers.get_edited_preset().config.option("multimaterial_purging_for_unload"))->value; + const double default_purge = static_cast(printers.get_edited_preset().config.option("multimaterial_purging"))->value; std::vector new_matrix; for (unsigned int i=0;iproject_config.option("wiping_volumes_matrix")->values = new_matrix; } diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 65e3ab3631..94fee1e1fc 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -224,8 +224,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "filament_minimal_purge_on_wipe_tower" || opt_key == "filament_cooling_initial_speed" || opt_key == "filament_cooling_final_speed" - || opt_key == "filament_loading_purge_multiplier" - || opt_key == "filament_unloading_purge_multiplier" + || opt_key == "filament_purge_multiplier" || opt_key == "filament_ramming_parameters" || opt_key == "filament_multitool_ramming" || opt_key == "filament_multitool_ramming_volume" @@ -251,8 +250,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "cooling_tube_retraction" || opt_key == "cooling_tube_length" || opt_key == "extra_loading_move" - || opt_key == "multimaterial_purging_for_unload" - || opt_key == "multimaterial_purging_for_load" + || opt_key == "multimaterial_purging" || opt_key == "travel_speed" || opt_key == "travel_speed_z" || opt_key == "first_layer_speed" diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 86273b921c..bb18a4d787 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1144,16 +1144,8 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloats { 3.4 }); - def = this->add("filament_loading_purge_multiplier", coPercents); - def->label = L("loading purge multiplier"); - def->tooltip = L(""); - def->sidetext = L("%"); - def->min = 0; - def->mode = comExpert; - def->set_default_value(new ConfigOptionPercents { 100 }); - - def = this->add("filament_unloading_purge_multiplier", coPercents); - def->label = L("unloading purge multiplier"); + def = this->add("filament_purge_multiplier", coPercents); + def->label = L("Purge multiplier"); def->tooltip = L(""); def->sidetext = L("%"); def->min = 0; @@ -2152,17 +2144,10 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(-2.)); - def = this->add("multimaterial_purging_for_unload", coFloat); - def->label = L("unloading"); + def = this->add("multimaterial_purging", coFloat); + def->label = L("Purging volume"); def->tooltip = L(""); - def->sidetext = L("mm krychlovy"); - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(70)); - - def = this->add("multimaterial_purging_for_load", coFloat); - def->label = L("loading"); - def->tooltip = L(""); - def->sidetext = L("mm krychlovy"); + def->sidetext = L("mm³"); def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(70)); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 0e1778985e..f5f63c5720 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -727,8 +727,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloats, filament_cooling_initial_speed)) ((ConfigOptionFloats, filament_minimal_purge_on_wipe_tower)) ((ConfigOptionFloats, filament_cooling_final_speed)) - ((ConfigOptionPercents, filament_loading_purge_multiplier)) - ((ConfigOptionPercents, filament_unloading_purge_multiplier)) + ((ConfigOptionPercents, filament_purge_multiplier)) ((ConfigOptionStrings, filament_ramming_parameters)) ((ConfigOptionBools, filament_multitool_ramming)) ((ConfigOptionFloats, filament_multitool_ramming_volume)) @@ -781,8 +780,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, remaining_times)) ((ConfigOptionBool, silent_mode)) ((ConfigOptionFloat, extra_loading_move)) - ((ConfigOptionFloat, multimaterial_purging_for_unload)) - ((ConfigOptionFloat, multimaterial_purging_for_load)) + ((ConfigOptionFloat, multimaterial_purging)) ((ConfigOptionString, color_change_gcode)) ((ConfigOptionString, pause_print_gcode)) ((ConfigOptionString, template_custom_gcode)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index c529e926f0..70a45aa9e7 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2273,8 +2273,7 @@ void TabFilament::build() optgroup->append_single_option_line("filament_cooling_final_speed"); optgroup->append_single_option_line("filament_stamping_loading_speed"); optgroup->append_single_option_line("filament_stamping_distance"); - optgroup->append_single_option_line("filament_loading_purge_multiplier"); - optgroup->append_single_option_line("filament_unloading_purge_multiplier"); + optgroup->append_single_option_line("filament_purge_multiplier"); create_line_with_widget(optgroup.get(), "filament_ramming_parameters", "", [this](wxWindow* parent) { auto ramming_dialog_btn = new wxButton(parent, wxID_ANY, _(L("Ramming settings"))+dots, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); @@ -3381,8 +3380,7 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) optgroup->append_single_option_line("cooling_tube_length"); optgroup->append_single_option_line("parking_pos_retraction"); optgroup->append_single_option_line("extra_loading_move"); - optgroup->append_single_option_line("multimaterial_purging_for_unload"); - optgroup->append_single_option_line("multimaterial_purging_for_load"); + optgroup->append_single_option_line("multimaterial_purging"); optgroup->append_single_option_line("high_current_on_filament_swap"); if (from_initial_build) page->clear(); From e1b2bd41551b1f23aa2c4b71acf519b2899e9e6c Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 12 Mar 2024 15:28:01 +0100 Subject: [PATCH 05/10] WipeTowerDialog now uses filament_purging_multiplier --- src/libslic3r/PresetBundle.cpp | 12 +++++-- src/libslic3r/PresetBundle.hpp | 24 ++++++++++++++ src/libslic3r/PrintConfig.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 10 ++++-- src/slic3r/GUI/WipeTowerDialog.cpp | 50 ++++++++++++++++++++++++------ src/slic3r/GUI/WipeTowerDialog.hpp | 19 ++++++++---- 6 files changed, 95 insertions(+), 22 deletions(-) diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index b5e9c6ff09..762c5cdaae 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -1710,6 +1710,8 @@ std::pair PresetBundle::load_configbundle( return std::make_pair(std::move(substitutions), presets_loaded + ph_printers_loaded); } + + void PresetBundle::update_multi_material_filament_presets() { if (printers.get_edited_preset().printer_technology() != ptFFF) @@ -1733,17 +1735,21 @@ void PresetBundle::update_multi_material_filament_presets() std::vector old_matrix = this->project_config.option("wiping_volumes_matrix")->values; size_t old_number_of_extruders = size_t(std::sqrt(old_matrix.size())+EPSILON); if (num_extruders != old_number_of_extruders) { - const double default_purge = static_cast(printers.get_edited_preset().config.option("multimaterial_purging"))->value; + + // Extract the relevant config options, even values from possibly modified presets. + const double default_purge = static_cast(this->printers.get_edited_preset().config.option("multimaterial_purging"))->value; + const std::vector filament_purging_multipliers = get_config_options_for_current_filaments("filament_purge_multiplier"); std::vector new_matrix; - for (unsigned int i=0;iproject_config.option("wiping_volumes_matrix")->values = new_matrix; } } diff --git a/src/libslic3r/PresetBundle.hpp b/src/libslic3r/PresetBundle.hpp index 1e6aa1caa1..bb9d9ee41a 100644 --- a/src/libslic3r/PresetBundle.hpp +++ b/src/libslic3r/PresetBundle.hpp @@ -63,6 +63,30 @@ public: void cache_extruder_filaments_names(); void reset_extruder_filaments(); + // Another hideous function related to current ExtruderFilaments hack. Returns a vector of values + // of a given config option for all currently used filaments. Modified value is returned for modified preset. + // Must be called with the vector ConfigOption type, e.g. ConfigOptionPercents. + template + auto get_config_options_for_current_filaments(const t_config_option_key& key) + { + decltype(T::values) out; + const Preset& edited_preset = this->filaments.get_edited_preset(); + for (const ExtruderFilaments& extr_filament : this->extruders_filaments) { + const Preset& selected_preset = *extr_filament.get_selected_preset(); + const Preset& preset = edited_preset.name == selected_preset.name ? edited_preset : selected_preset; + const T* co = preset.config.opt(key); + if (co) { + assert(co->values.size() == 1); + out.push_back(co->values.back()); + } else { + // Key is missing or type mismatch. + } + } + return out; + } + + + PresetCollection& get_presets(Preset::Type preset_type); // The project configuration values are kept separated from the print/filament/printer preset, diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index bb18a4d787..21968281bd 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2149,7 +2149,7 @@ void PrintConfigDef::init_fff_params() def->tooltip = L(""); def->sidetext = L("mm³"); def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(70)); + def->set_default_value(new ConfigOptionFloat(140.)); def = this->add("perimeter_acceleration", coFloat); def->label = L("Perimeters"); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 3921c5c354..bb96ebe41e 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -518,12 +518,16 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) : sizer->Add(m_wiping_dialog_button, 0, wxALIGN_CENTER_VERTICAL); m_wiping_dialog_button->Bind(wxEVT_BUTTON, ([parent](wxCommandEvent& e) { - auto &project_config = wxGetApp().preset_bundle->project_config; + PresetBundle* preset_bundle = wxGetApp().preset_bundle; + DynamicPrintConfig& project_config = preset_bundle->project_config; const std::vector &init_matrix = (project_config.option("wiping_volumes_matrix"))->values; - const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); - WipingDialog dlg(parent, cast(init_matrix), extruder_colours); + // Extract the relevant config options, even values from possibly modified presets. + const double default_purge = static_cast(preset_bundle->printers.get_edited_preset().config.option("multimaterial_purging"))->value; + std::vector filament_purging_multipliers = preset_bundle->get_config_options_for_current_filaments("filament_purge_multiplier"); + + WipingDialog dlg(parent, cast(init_matrix), extruder_colours, default_purge, filament_purging_multipliers); if (dlg.ShowModal() == wxID_OK) { std::vector matrix = dlg.get_matrix(); diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 9dab4d96e9..6ad1a5644a 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -189,8 +189,9 @@ std::string RammingPanel::get_parameters() // Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button. -WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours) -: wxDialog(parent, wxID_ANY, _(L("Wipe tower - Purging volume adjustment")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/) +WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, + double printer_purging_volume, const std::vector& filament_purging_multipliers) + : wxDialog(parent, wxID_ANY, _(L("Wipe tower - Purging volume adjustment")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/) { SetFont(wxGetApp().normal_font()); update_ui(this); @@ -202,7 +203,7 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c m_radio_button2 = new wxRadioButton(this, wxID_ANY, _L("Custom project-specific settings")); auto stb = new wxStaticBox(this, wxID_ANY, wxEmptyString); - m_panel_wiping = new WipingPanel(this,matrix, extruder_colours, m_widget_button); + m_panel_wiping = new WipingPanel(this, matrix, extruder_colours, filament_purging_multipliers, printer_purging_volume, m_widget_button); update_ui(m_radio_button1); update_ui(m_radio_button2); @@ -247,12 +248,15 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c EndModal(wxID_OK); },wxID_OK); - this->Bind(wxEVT_RADIOBUTTON, [this](wxCommandEvent& evt) { - wxRadioButton* rdb = dynamic_cast(FindWindowById(evt.GetId())); - m_widget_button->Enable(rdb == m_radio_button2); - m_panel_wiping->Enable(rdb == m_radio_button2); + this->Bind(wxEVT_RADIOBUTTON, [this](wxCommandEvent&) { + enable_or_disable_panel(); }); + const bool start_default = should_start_as_default(); + m_radio_button1->SetValue(start_default); + m_radio_button2->SetValue(! start_default); + enable_or_disable_panel(); + this->Show(); } @@ -267,11 +271,24 @@ void WipingPanel::format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_ } -WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, wxButton* widget_button) +WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, + const std::vector& filament_purging_multipliers, double printer_purging_volume, wxButton* widget_button) : wxPanel(parent,wxID_ANY, wxDefaultPosition, wxDefaultSize/*,wxBORDER_RAISED*/) { + m_filament_purging_multipliers = filament_purging_multipliers; + m_printer_purging_volume = printer_purging_volume; m_widget_button = widget_button; // pointer to the button in parent dialog - m_widget_button->Bind(wxEVT_BUTTON,[this](wxCommandEvent&){ }); + m_widget_button->Bind(wxEVT_BUTTON,[this](wxCommandEvent&){ + // Set the matrix to defaults. + for (size_t i = 0; i < m_number_of_extruders; ++i) { + for (size_t j = 0; j < m_number_of_extruders; ++j) { + if (i != j) { + double def_val = m_printer_purging_volume * m_filament_purging_multipliers[j] / 100.; + edit_boxes[j][i]->SetValue(wxString("") << int(def_val)); + } + } + } + }); m_number_of_extruders = (int)(sqrt(matrix.size())+0.001); @@ -375,3 +392,18 @@ std::vector WipingPanel::read_matrix_values() { } return output; } + + + +bool WipingDialog::should_start_as_default() const +{ + return true; +} + + +void WipingDialog::enable_or_disable_panel() +{ + bool enable = m_radio_button2->GetValue(); + m_widget_button->Enable(enable); + m_panel_wiping->Enable(enable); +} \ No newline at end of file diff --git a/src/slic3r/GUI/WipeTowerDialog.hpp b/src/slic3r/GUI/WipeTowerDialog.hpp index b7daf33fc2..d07ecfdf66 100644 --- a/src/slic3r/GUI/WipeTowerDialog.hpp +++ b/src/slic3r/GUI/WipeTowerDialog.hpp @@ -51,7 +51,8 @@ private: class WipingPanel : public wxPanel { public: - WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, wxButton* widget_button); + WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, + const std::vector& filament_purging_multipliers, double printer_purging_volume, wxButton* widget_button); std::vector read_matrix_values(); void format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& table_title, int table_lshift=0); @@ -64,6 +65,8 @@ private: wxBoxSizer* m_sizer_advanced = nullptr; wxGridSizer* m_gridsizer_advanced = nullptr; wxButton* m_widget_button = nullptr; + double m_printer_purging_volume; + std::vector m_filament_purging_multipliers; // In percents ! }; @@ -72,16 +75,20 @@ private: class WipingDialog : public wxDialog { public: - WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours); + WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, + double printer_purging_volume, const std::vector& filament_purging_multipliers); std::vector get_matrix() const { return m_output_matrix; } private: - WipingPanel* m_panel_wiping = nullptr; + bool should_start_as_default() const; + void enable_or_disable_panel(); + + WipingPanel* m_panel_wiping = nullptr; std::vector m_output_matrix; - wxRadioButton* m_radio_button1 = nullptr; - wxRadioButton* m_radio_button2 = nullptr; - wxButton* m_widget_button = nullptr; + wxRadioButton* m_radio_button1 = nullptr; + wxRadioButton* m_radio_button2 = nullptr; + wxButton* m_widget_button = nullptr; }; #endif // _WIPE_TOWER_DIALOG_H_ \ No newline at end of file From c0aba8e2ca894386a86b9cc192afbbf2235375ec Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 15 Mar 2024 15:10:56 +0100 Subject: [PATCH 06/10] Add the default/custom switch into project settings --- src/libslic3r/PresetBundle.cpp | 3 ++- src/libslic3r/Print.cpp | 1 + src/libslic3r/PrintConfig.cpp | 25 +++++++++++++++++++++++++ src/libslic3r/PrintConfig.hpp | 1 + src/slic3r/GUI/Plater.cpp | 4 +++- src/slic3r/GUI/WipeTowerDialog.cpp | 14 +++----------- src/slic3r/GUI/WipeTowerDialog.hpp | 4 ++-- 7 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 762c5cdaae..b8b4f82b52 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -38,7 +38,8 @@ namespace Slic3r { static std::vector s_project_options { "colorprint_heights", - "wiping_volumes_matrix" + "wiping_volumes_matrix", + "wiping_volumes_use_custom_matrix" }; const char *PresetBundle::PRUSA_BUNDLE = "PrusaResearch"; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 94fee1e1fc..146994c201 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -246,6 +246,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "wipe_tower_no_sparse_layers" || opt_key == "wipe_tower_extruder" || opt_key == "wiping_volumes_matrix" + || opt_key == "wiping_volumes_use_custom_matrix" || opt_key == "parking_pos_retraction" || opt_key == "cooling_tube_retraction" || opt_key == "cooling_tube_length" diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 21968281bd..62a12bf0eb 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3310,6 +3310,11 @@ void PrintConfigDef::init_fff_params() 140., 140., 140., 0., 140., 140., 140., 140., 140., 0. }); + def = this->add("wiping_volumes_use_custom_matrix", coBool); + def->label = L(""); + def->tooltip = L(""); + def->set_default_value(new ConfigOptionBool{ false }); + def = this->add("wipe_tower_x", coFloat); def->label = L("Position X"); def->tooltip = L("X coordinate of the left front corner of a wipe tower"); @@ -4526,6 +4531,26 @@ void PrintConfigDef::handle_legacy_composite(DynamicPrintConfig &config) config.set_key_value("thumbnails", new ConfigOptionString(thumbnails_str)); } } + + if (config.has("wiping_volumes_matrix") && !config.has("wiping_volumes_use_custom_matrix")) { + // This is apparently some pre-2.7.3 config, where the wiping_volumes_matrix was always used. + // The 2.7.3 introduced an option to use defaults derived from config. In case the matrix + // contains only default values, switch it to default behaviour. The default values + // were zeros on the diagonal and 140 otherwise. + std::vector matrix = config.opt("wiping_volumes_matrix")->values; + int num_of_extruders = int(std::sqrt(matrix.size()) + 0.5); + int i = -1; + bool custom = false; + for (int j = 0; j < int(matrix.size()); ++j) { + if (j % num_of_extruders == 0) + ++i; + if (i != j % num_of_extruders && !is_approx(matrix[j], 140.)) { + custom = true; + break; + } + } + config.set_key_value("wiping_volumes_use_custom_matrix", new ConfigOptionBool(custom)); + } } const PrintConfigDef print_config_def; diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index f5f63c5720..09e6612d3b 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -883,6 +883,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionFloat, wipe_tower_bridging)) ((ConfigOptionInt, wipe_tower_extruder)) ((ConfigOptionFloats, wiping_volumes_matrix)) + ((ConfigOptionBool, wiping_volumes_use_custom_matrix)) ((ConfigOptionFloat, z_offset)) ) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index bb96ebe41e..a8d5ba2df0 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -520,6 +520,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) : { PresetBundle* preset_bundle = wxGetApp().preset_bundle; DynamicPrintConfig& project_config = preset_bundle->project_config; + const bool use_custom_matrix = (project_config.option("wiping_volumes_use_custom_matrix"))->value; const std::vector &init_matrix = (project_config.option("wiping_volumes_matrix"))->values; const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); @@ -527,11 +528,12 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) : const double default_purge = static_cast(preset_bundle->printers.get_edited_preset().config.option("multimaterial_purging"))->value; std::vector filament_purging_multipliers = preset_bundle->get_config_options_for_current_filaments("filament_purge_multiplier"); - WipingDialog dlg(parent, cast(init_matrix), extruder_colours, default_purge, filament_purging_multipliers); + WipingDialog dlg(parent, cast(init_matrix), extruder_colours, default_purge, filament_purging_multipliers, use_custom_matrix); if (dlg.ShowModal() == wxID_OK) { std::vector matrix = dlg.get_matrix(); (project_config.option("wiping_volumes_matrix"))->values = std::vector(matrix.begin(), matrix.end()); + (project_config.option("wiping_volumes_use_custom_matrix"))->value = dlg.get_use_custom_matrix(); // Update Project dirty state, update application title bar. wxGetApp().plater()->update_project_dirty_from_presets(); wxPostEvent(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent)); diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 6ad1a5644a..3f77e7b62f 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -190,7 +190,7 @@ std::string RammingPanel::get_parameters() // Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button. WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, - double printer_purging_volume, const std::vector& filament_purging_multipliers) + double printer_purging_volume, const std::vector& filament_purging_multipliers, bool use_custom_matrix) : wxDialog(parent, wxID_ANY, _(L("Wipe tower - Purging volume adjustment")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/) { SetFont(wxGetApp().normal_font()); @@ -252,9 +252,8 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c enable_or_disable_panel(); }); - const bool start_default = should_start_as_default(); - m_radio_button1->SetValue(start_default); - m_radio_button2->SetValue(! start_default); + m_radio_button1->SetValue(! use_custom_matrix); + m_radio_button2->SetValue(use_custom_matrix); enable_or_disable_panel(); this->Show(); @@ -394,13 +393,6 @@ std::vector WipingPanel::read_matrix_values() { } - -bool WipingDialog::should_start_as_default() const -{ - return true; -} - - void WipingDialog::enable_or_disable_panel() { bool enable = m_radio_button2->GetValue(); diff --git a/src/slic3r/GUI/WipeTowerDialog.hpp b/src/slic3r/GUI/WipeTowerDialog.hpp index d07ecfdf66..f5e9f855cc 100644 --- a/src/slic3r/GUI/WipeTowerDialog.hpp +++ b/src/slic3r/GUI/WipeTowerDialog.hpp @@ -76,12 +76,12 @@ private: class WipingDialog : public wxDialog { public: WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, - double printer_purging_volume, const std::vector& filament_purging_multipliers); + double printer_purging_volume, const std::vector& filament_purging_multipliers, bool use_custom_matrix); std::vector get_matrix() const { return m_output_matrix; } + bool get_use_custom_matrix() const { return m_radio_button2->GetValue(); } private: - bool should_start_as_default() const; void enable_or_disable_panel(); WipingPanel* m_panel_wiping = nullptr; From 59874190027ee42d553849712c7baf5be6ea785a Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 18 Mar 2024 10:28:29 +0100 Subject: [PATCH 07/10] Purging volumes: update backend --- src/libslic3r/GCode/WipeTower.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index 1cd4135472..504c88e142 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -1510,9 +1510,20 @@ std::vector> WipeTower::extract_wipe_volumes(const PrintConfi // Extract purging volumes for each extruder pair: std::vector> wipe_volumes; const unsigned int number_of_extruders = (unsigned int)(sqrt(wiping_matrix.size())+EPSILON); - for (unsigned int i = 0; i(wiping_matrix.begin()+i*number_of_extruders, wiping_matrix.begin()+(i+1)*number_of_extruders)); + // For SEMM printers, the project can be configured to use defaults from configuration, + // in which case the custom matrix shall be ignored. We will overwrite the values. + if (config.single_extruder_multi_material && ! config.wiping_volumes_use_custom_matrix) { + for (size_t i = 0; i < number_of_extruders; ++i) { + for (size_t j = 0; j < number_of_extruders; ++j) { + if (i != j) + wipe_volumes[i][j] = (i == j ? 0.f : config.multimaterial_purging.value * config.filament_purge_multiplier.get_at(j) / 100.f); + } + } + } + // Also include filament_minimal_purge_on_wipe_tower. This is needed for the preview. for (unsigned int i = 0; i Date: Mon, 18 Mar 2024 15:21:13 +0100 Subject: [PATCH 08/10] WipeTowerDialog fixed rotated text --- src/slic3r/GUI/WipeTowerDialog.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 3f77e7b62f..4e14527e28 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -266,7 +266,7 @@ void WipingPanel::format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_ auto table_sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(table_sizer, 0, wxALIGN_CENTER | wxCENTER, table_lshift); table_sizer->Add(new wxStaticText(page, wxID_ANY, table_title), 0, wxALIGN_CENTER | wxTOP, 10); - table_sizer->Add(grid_sizer, 0, wxALIGN_CENTER | wxTOP, 10); + table_sizer->Add(grid_sizer, 0, wxALIGN_CENTER | wxTOP | wxLEFT, 15); } @@ -371,8 +371,24 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, con int text_width = 0; int text_height = 0; dc.GetTextExtent(label,&text_width,&text_height); + int xpos = m_gridsizer_advanced->GetPosition().x; - dc.DrawRotatedText(label,xpos-text_height,y_pos + text_width/2.f,90); + if (!m_page_advanced->IsEnabled()) { + dc.SetTextForeground(wxSystemSettings::GetColour( +#if defined (__linux__) && defined (__WXGTK2__) + wxSYS_COLOUR_BTNTEXT +#else + wxSYS_COLOUR_GRAYTEXT +#endif + )); + dc.DrawRotatedText(label, xpos - text_height, y_pos + text_width / 2.f, 90); +#ifdef _WIN32 + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT)); + dc.DrawRotatedText(label, xpos - text_height-1, y_pos + text_width / 2.f+1, 90); +#endif + } + else + dc.DrawRotatedText(label, xpos - text_height, y_pos + text_width / 2.f, 90); }); } @@ -398,4 +414,5 @@ void WipingDialog::enable_or_disable_panel() bool enable = m_radio_button2->GetValue(); m_widget_button->Enable(enable); m_panel_wiping->Enable(enable); + m_panel_wiping->Refresh(); } \ No newline at end of file From 37d6b7ea1bf724c5475fd2a488e5a4bd0b1a8fbd Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 20 Mar 2024 05:50:04 +0100 Subject: [PATCH 09/10] Polishing the dialog, added parameter tooltips, fixed warnings --- src/libslic3r/GCode/WipeTower.cpp | 4 +-- src/libslic3r/PrintConfig.cpp | 9 ++++--- src/slic3r/GUI/WipeTowerDialog.cpp | 43 +++++++++++++++++------------- src/slic3r/GUI/WipeTowerDialog.hpp | 1 + 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index 504c88e142..65cf2b6136 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -1558,8 +1558,8 @@ void WipeTower::plan_toolchange(float z_par, float layer_height_par, unsigned in if (old_tool == new_tool) // new layer without toolchanges - we are done return; - // this is an actual toolchange - let's calculate depth to reserve on the wipe tower - float width = m_wipe_tower_width - 3*m_perimeter_width; + // this is an actual toolchange - let's calculate depth to reserve on the wipe tower + float width = m_wipe_tower_width - 3*m_perimeter_width; float length_to_extrude = volume_to_length(0.25f * std::accumulate(m_filpar[old_tool].ramming_speed.begin(), m_filpar[old_tool].ramming_speed.end(), 0.f), m_perimeter_width * m_filpar[old_tool].ramming_line_width_multiplicator, layer_height_par); diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 62a12bf0eb..df6c630bdc 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1145,8 +1145,10 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloats { 3.4 }); def = this->add("filament_purge_multiplier", coPercents); - def->label = L("Purge multiplier"); - def->tooltip = L(""); + def->label = L("Purge volume multiplier"); + def->tooltip = L("Purging volume on the wipe tower is determined by 'multimaterial_purging' in Printer Settings. " + "This option allows to modify the volume on filament level. " + "Note that the project can override this by setting project-specific values."); def->sidetext = L("%"); def->min = 0; def->mode = comExpert; @@ -2146,7 +2148,8 @@ void PrintConfigDef::init_fff_params() def = this->add("multimaterial_purging", coFloat); def->label = L("Purging volume"); - def->tooltip = L(""); + def->tooltip = L("Determines purging volume on the wipe tower. This can be modified in Filament Settings " + "('filament_purge_multiplier') or overridden using project-specific settings."); def->sidetext = L("mm³"); def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(140.)); diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 4e14527e28..ccf4d0268a 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -195,41 +195,45 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c { SetFont(wxGetApp().normal_font()); update_ui(this); - m_widget_button = new wxButton(this,wxID_ANY,_L("Set default values"), wxPoint(0, 0), wxDefaultSize); + m_widget_button = new wxButton(this,wxID_ANY,_L("Set values from configuration"), wxPoint(0, 0), wxDefaultSize); update_ui(m_widget_button); wxGetApp().SetWindowVariantForButton(m_widget_button); - m_radio_button1 = new wxRadioButton(this, wxID_ANY, _L("Default from configuration")); - m_radio_button2 = new wxRadioButton(this, wxID_ANY, _L("Custom project-specific settings")); - auto stb = new wxStaticBox(this, wxID_ANY, wxEmptyString); + m_radio_button1 = new wxRadioButton(this, wxID_ANY, _L("Use values from configuration")); + m_radio_button2 = new wxRadioButton(this, wxID_ANY, _L("Use custom project-specific settings")); + auto stb1 = new wxStaticBox(this, wxID_ANY, wxEmptyString); + auto stb2 = new wxStaticBox(this, wxID_ANY, wxEmptyString); m_panel_wiping = new WipingPanel(this, matrix, extruder_colours, filament_purging_multipliers, printer_purging_volume, m_widget_button); update_ui(m_radio_button1); update_ui(m_radio_button2); - update_ui(stb); + update_ui(stb1); + update_ui(stb2); - - - wxString info = _(L("Here you can adjust required purging volume (mm³) for any given pair of tools.")); - wxSize text_size = GetTextExtent(info); - auto info_str = new wxStaticText(this, wxID_ANY, info ,wxDefaultPosition, wxDefaultSize); + auto heading_text = new wxStaticText(this, wxID_ANY, _L("The project uses single-extruder multimaterial printer with the wipe tower.\nThe volume of material used for purging can be configured here.") ,wxDefaultPosition, wxDefaultSize); + m_info_text1 = new wxStaticText(this, wxID_ANY, _L("Options 'multimaterial_purging' and 'filament_purge_multiplier' will be used.") ,wxDefaultPosition, wxDefaultSize); // set min sizer width according to extruders count const auto sizer_width = (int)((std::sqrt(matrix.size()) + 2.8)*ITEM_WIDTH()); auto main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->SetMinSize(wxSize(sizer_width, -1)); - main_sizer->Add(info_str, 0, wxALL, 10); + main_sizer->Add(heading_text, 0, wxALL, 10); + main_sizer->Add(m_radio_button1, 0, wxALL, 10); + auto stb_sizer1 = new wxStaticBoxSizer(stb1, wxHORIZONTAL); + stb_sizer1->Add(m_info_text1, 0, wxALIGN_CENTER_HORIZONTAL, 0); + main_sizer->Add(stb_sizer1, 0, wxALIGN_CENTER_HORIZONTAL, 0); + + auto t = new wxStaticText(this, wxID_ANY, _L("(all values in mm³)"), wxDefaultPosition, wxDefaultSize); + main_sizer->Add(m_radio_button2, 0, wxALL, 10); - - auto stb_sizer = new wxStaticBoxSizer(stb, wxVERTICAL); - stb_sizer->Add(m_panel_wiping, 0, wxEXPAND | wxALL, 5); - stb_sizer->Add(m_widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 5); - - main_sizer->Add(stb_sizer, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 20); - + auto stb_sizer2 = new wxStaticBoxSizer(stb2, wxVERTICAL); + stb_sizer2->Add(m_panel_wiping, 0, wxEXPAND | wxALL, 5); + stb_sizer2->Add(t, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 0); + stb_sizer2->Add(m_widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, 5); + main_sizer->Add(stb_sizer2, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 20); auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL); wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton()); @@ -359,7 +363,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, con m_sizer = new wxBoxSizer(wxVERTICAL); - m_sizer->Add(m_page_advanced, 0, wxEXPAND | wxALL, 25); + m_sizer->Add(m_page_advanced, 0, wxEXPAND | wxALL, 5); m_sizer->SetSizeHints(this); SetSizer(m_sizer); @@ -412,6 +416,7 @@ std::vector WipingPanel::read_matrix_values() { void WipingDialog::enable_or_disable_panel() { bool enable = m_radio_button2->GetValue(); + m_info_text1->Enable(! enable); m_widget_button->Enable(enable); m_panel_wiping->Enable(enable); m_panel_wiping->Refresh(); diff --git a/src/slic3r/GUI/WipeTowerDialog.hpp b/src/slic3r/GUI/WipeTowerDialog.hpp index f5e9f855cc..f5427c8936 100644 --- a/src/slic3r/GUI/WipeTowerDialog.hpp +++ b/src/slic3r/GUI/WipeTowerDialog.hpp @@ -89,6 +89,7 @@ private: wxRadioButton* m_radio_button1 = nullptr; wxRadioButton* m_radio_button2 = nullptr; wxButton* m_widget_button = nullptr; + wxStaticText* m_info_text1 = nullptr; }; #endif // _WIPE_TOWER_DIALOG_H_ \ No newline at end of file From 614ff46b7866e5228da794b468d772d706223373 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 20 Mar 2024 11:06:08 +0100 Subject: [PATCH 10/10] WipeTowerDialog: Fixed layout of StaticBoxes --- src/slic3r/GUI/WipeTowerDialog.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index ccf4d0268a..c0a058a337 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -223,17 +223,17 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c main_sizer->Add(m_radio_button1, 0, wxALL, 10); auto stb_sizer1 = new wxStaticBoxSizer(stb1, wxHORIZONTAL); - stb_sizer1->Add(m_info_text1, 0, wxALIGN_CENTER_HORIZONTAL, 0); - main_sizer->Add(stb_sizer1, 0, wxALIGN_CENTER_HORIZONTAL, 0); + stb_sizer1->Add(m_info_text1, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5); + main_sizer->Add(stb_sizer1, 0, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxLEFT | wxRIGHT, 20); auto t = new wxStaticText(this, wxID_ANY, _L("(all values in mm³)"), wxDefaultPosition, wxDefaultSize); main_sizer->Add(m_radio_button2, 0, wxALL, 10); auto stb_sizer2 = new wxStaticBoxSizer(stb2, wxVERTICAL); stb_sizer2->Add(m_panel_wiping, 0, wxEXPAND | wxALL, 5); - stb_sizer2->Add(t, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 0); - stb_sizer2->Add(m_widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, 5); - main_sizer->Add(stb_sizer2, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 20); + stb_sizer2->Add(t, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 5); + stb_sizer2->Add(m_widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10); + main_sizer->Add(stb_sizer2, 0, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 20); auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL); wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton());