Ramming config improvements to enable support for Prusa MMU3 (#9935)

* Ported ramming configuration improvements from prusa slicer: Hold cmd to move all values, more granular time settings and higher maximum values.

* improve variable name, change space

* Move the label under the ramming chart

* Experimenting with values label for ramming chart

* Fix the label position and make the background 20% transparent

* update the way the multiline label is done

* reorder commands

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
Michele Stefanelli 2025-07-13 13:10:42 +01:00 committed by GitHub
parent b410154cb3
commit 686a9bd44a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 151 additions and 6 deletions

View file

@ -8004,6 +8004,10 @@ msgstr ""
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "" msgstr ""
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "" msgstr ""

View file

@ -8761,6 +8761,10 @@ msgstr "Ample de la línia de moldejat de punta( ramming )"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Espai entre línies de Moldejat de punta( Ramming )" msgstr "Espai entre línies de Moldejat de punta( Ramming )"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Calcular Automàticament" msgstr "Calcular Automàticament"

View file

@ -8494,6 +8494,10 @@ msgstr "Šířka linky při rapidní extruzi"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Rozestup linek při rapidní extruzi" msgstr "Rozestup linek při rapidní extruzi"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr "Pro konstantní průtok stiskněte %1% při přetahování."
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Automatický výpočet" msgstr "Automatický výpočet"

View file

@ -8840,6 +8840,10 @@ msgstr "Ramming-Linienbreite"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Ramming-Linienabstand" msgstr "Ramming-Linienabstand"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr "Um eine konstante Flussrate zu erhalten, halten Sie %1% gedrückt, während Sie ziehen."
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Automatisch berechnen" msgstr "Automatisch berechnen"

View file

@ -8174,6 +8174,10 @@ msgstr ""
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "" msgstr ""
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "" msgstr ""

View file

@ -8773,6 +8773,10 @@ msgstr "Ancho de línea de Moldeado de Extremo"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Separación de línea de moldeado de extremo" msgstr "Separación de línea de moldeado de extremo"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr "Para un flujo constante, mantén pulsado %1% mientras arrastras."
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Calculado automático" msgstr "Calculado automático"

View file

@ -8868,6 +8868,10 @@ msgstr "Largeur de ligne du pilonnage"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Espacement des lignes du pilonnage" msgstr "Espacement des lignes du pilonnage"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr "Pour un débit constant, maintenez %1% tout en faisant glisser."
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Auto-Calc" msgstr "Auto-Calc"

View file

@ -8406,6 +8406,10 @@ msgstr "Tömörítési vonal szélessége"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Tömörítési vonal térköze" msgstr "Tömörítési vonal térköze"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Automatikus számítás" msgstr "Automatikus számítás"

View file

@ -8799,6 +8799,11 @@ msgstr "Larghezza linea di modellazione del filamento"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Spaziatura tra linee di modellazione del filamento" msgstr "Spaziatura tra linee di modellazione del filamento"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
"Per ottenere un avanzamento costante, tieni premuto %1% mentre trascini."
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Calcolo automatico" msgstr "Calcolo automatico"

View file

@ -8202,6 +8202,10 @@ msgstr "ラミング線幅"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "ラミング線間距離" msgstr "ラミング線間距離"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr "流量を一定にするには、%1% を押したままドラッグします。"
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "自動計算" msgstr "自動計算"

View file

@ -8474,6 +8474,10 @@ msgstr "채워넣기 선 너비"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "채워넣기 선 간격" msgstr "채워넣기 선 간격"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "자동 계산" msgstr "자동 계산"

View file

@ -8738,6 +8738,10 @@ msgstr "Įspaudimo linijos plotis"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Įspaudimo tarpai tarp linijų" msgstr "Įspaudimo tarpai tarp linijų"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Automatinis skaičiavimas" msgstr "Automatinis skaičiavimas"

View file

@ -8555,6 +8555,10 @@ msgstr "Lijnbreedte voor ramming"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Lijnafstand voor ramming" msgstr "Lijnafstand voor ramming"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Automatisch berekenen" msgstr "Automatisch berekenen"

View file

@ -8719,6 +8719,10 @@ msgstr "Szerokość linii wyciskania"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Odstęp linii wyciskania" msgstr "Odstęp linii wyciskania"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr "Aby uzyskać stałe natężenie przepływu, przytrzymaj %1% podczas przeciągania."
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Auto-obliczenia" msgstr "Auto-obliczenia"

View file

@ -8750,6 +8750,10 @@ msgstr "Largura da linha de moldeamento"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Espaçamento da linha de moldeamento" msgstr "Espaçamento da linha de moldeamento"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Auto-Calc" msgstr "Auto-Calc"

View file

@ -8845,6 +8845,10 @@ msgstr "Ширина линии при рэмминге"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Расстояние между линиями при рэмминге" msgstr "Расстояние между линиями при рэмминге"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr "Для постоянного объёмного расхода удерживайте нажатой клавишу %1% при перетаскивании."
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Авторасчёт" msgstr "Авторасчёт"

View file

@ -8400,6 +8400,10 @@ msgstr ""
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "" msgstr ""
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Autoberäkna" msgstr "Autoberäkna"

View file

@ -8660,6 +8660,10 @@ msgstr "Sıkıştırma hattı genişliği"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Sıkıştırma hattı aralığı" msgstr "Sıkıştırma hattı aralığı"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Otomatik Hesaplama" msgstr "Otomatik Hesaplama"

View file

@ -8744,6 +8744,10 @@ msgstr "Ширина ліній раммінгу"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "Проміжки між лініями раммінгу" msgstr "Проміжки між лініями раммінгу"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "Автокалькулятор" msgstr "Автокалькулятор"

View file

@ -8263,6 +8263,10 @@ msgstr "尖端成型线宽"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "尖端成型线间距" msgstr "尖端成型线间距"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "自动计算" msgstr "自动计算"

View file

@ -8299,6 +8299,10 @@ msgstr "尖端成型線寬"
msgid "Ramming line spacing" msgid "Ramming line spacing"
msgstr "尖端成型線間距" msgstr "尖端成型線間距"
#. TRN: The placeholder expands to Ctrl or Cmd (on macOS).
msgid "For constant flow rate, hold %1% while dragging."
msgstr ""
msgid "Auto-Calc" msgid "Auto-Calc"
msgstr "自動計算" msgstr "自動計算"

View file

@ -95,6 +95,40 @@ void Chart::draw() {
label = _(L("Volumetric speed")) + " (" + _("mm³/s") + ")"; label = _(L("Volumetric speed")) + " (" + _("mm³/s") + ")";
dc.GetTextExtent(label,&text_width,&text_height); dc.GetTextExtent(label,&text_width,&text_height);
dc.DrawRotatedText(label,wxPoint(0,0.5*(m_rect.GetBottom()+m_rect.GetTop())+text_width/2.f),90); dc.DrawRotatedText(label,wxPoint(0,0.5*(m_rect.GetBottom()+m_rect.GetTop())+text_width/2.f),90);
// draw a label with the value above each button
for (auto& button : m_buttons) {
if (!visible_area.Contains(button.get_pos()))
continue;
wxPoint button_screen_pos = math_to_screen(button.get_pos());
wxString value_label = wxString().Format(wxT("%.1f"), button.get_pos().m_y);
int label_width, label_height;
dc.GetTextExtent(value_label, &label_width, &label_height);
const int padding = 4;
// Calculate label x position
int label_x = button_screen_pos.x - (label_width/2); // centered with button
label_x = std::clamp(label_x, m_rect.GetLeft() + (padding*2), m_rect.GetRight() - label_width - (padding*2)); // adjust to fit within chart bounds
// Calculate label y position
int label_y = button_screen_pos.y - (side/2) - label_height - (padding*2); // above button
if (label_y - (padding*2) < m_rect.GetTop()) { // move below the button if there isn't enough space
label_y = button_screen_pos.y + (side/2) + (padding*2);
}
// Draw label background
dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#DBDBDB")), 1));
wxColour bg_color = StateColor::darkModeColorFor(wxColour("#F1F1F1"));
dc.SetBrush(wxBrush(wxColour(bg_color.Red(), bg_color.Green(), bg_color.Blue(), 204))); // 80% opacity
wxRect label_rect(label_x - padding, label_y - padding, label_width + (2*padding), label_height + (2*padding));
dc.DrawRoundedRectangle(label_rect, 2);
// Draw the label text
dc.SetTextForeground(StateColor::darkModeColorFor("#363636"));
dc.DrawText(value_label, wxPoint(label_x, label_y));
}
} }
void Chart::mouse_right_button_clicked(wxMouseEvent& event) { void Chart::mouse_right_button_clicked(wxMouseEvent& event) {
@ -111,6 +145,7 @@ void Chart::mouse_right_button_clicked(wxMouseEvent& event) {
void Chart::mouse_clicked(wxMouseEvent& event) { void Chart::mouse_clicked(wxMouseEvent& event) {
m_uniform = (event.GetModifiers() == wxMOD_CONTROL);
wxPoint point = event.GetPosition(); wxPoint point = event.GetPosition();
int button_index = which_button_is_clicked(point); int button_index = which_button_is_clicked(point);
if ( button_index != -1) { if ( button_index != -1) {
@ -136,7 +171,15 @@ void Chart::mouse_moved(wxMouseEvent& event) {
} }
int delta_x = pos.x - m_previous_mouse.x; int delta_x = pos.x - m_previous_mouse.x;
int delta_y = pos.y - m_previous_mouse.y; int delta_y = pos.y - m_previous_mouse.y;
m_dragged->move(fixed_x?0:double(delta_x)/m_rect.GetWidth() * visible_area.m_width,-double(delta_y)/m_rect.GetHeight() * visible_area.m_height);
double new_y = m_dragged->get_pos().m_y - double(delta_y) / m_rect.GetHeight() * visible_area.m_height;
if (m_uniform)
for (ButtonToDrag& b : m_buttons)
b.move(fixed_x?0:double(delta_x)/m_rect.GetWidth() * visible_area.m_width, new_y - b.get_pos().m_y);
else
m_dragged->move(fixed_x?0:double(delta_x)/m_rect.GetWidth() * visible_area.m_width, new_y - m_dragged->get_pos().m_y);
m_previous_mouse = pos; m_previous_mouse = pos;
recalculate_line(); recalculate_line();
} }

View file

@ -22,7 +22,7 @@ public:
SetBackgroundColour(*wxWHITE); SetBackgroundColour(*wxWHITE);
SetBackgroundStyle(wxBG_STYLE_PAINT); SetBackgroundStyle(wxBG_STYLE_PAINT);
m_rect = wxRect(wxPoint(legend_side,0),rect.GetSize()-wxSize(legend_side,legend_side)); m_rect = wxRect(wxPoint(legend_side,0),rect.GetSize()-wxSize(legend_side,legend_side));
visible_area = wxRect2DDouble(0.0, 0.0, sampling*ramming_speed_size, 20.); visible_area = wxRect2DDouble(0.0, 0.0, sampling*ramming_speed_size, 60.);
m_buttons.clear(); m_buttons.clear();
if (initial_buttons.size()>0) if (initial_buttons.size()>0)
for (const auto& pair : initial_buttons) for (const auto& pair : initial_buttons)
@ -30,7 +30,7 @@ public:
recalculate_line(); recalculate_line();
} }
void set_xy_range(float x,float y) { void set_xy_range(float x,float y) {
x = int(x/0.5) * 0.5; x = int(x/0.25) * 0.25;
if (x>=0) visible_area.SetRight(x); if (x>=0) visible_area.SetRight(x);
if (y>=0) visible_area.SetBottom(y); if (y>=0) visible_area.SetBottom(y);
recalculate_line(); recalculate_line();
@ -116,6 +116,7 @@ private:
wxRect2DDouble visible_area; wxRect2DDouble visible_area;
ButtonToDrag* m_dragged = nullptr; ButtonToDrag* m_dragged = nullptr;
float m_total_volume = 0.f; float m_total_volume = 0.f;
bool m_uniform = false;
}; };

View file

@ -7,6 +7,7 @@
#include "I18N.hpp" #include "I18N.hpp"
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "MsgDialog.hpp" #include "MsgDialog.hpp"
#include "format.hpp"
#include "libslic3r/Color.hpp" #include "libslic3r/Color.hpp"
#include "Widgets/Button.hpp" #include "Widgets/Button.hpp"
#include "Widgets/StaticLine.hpp" #include "Widgets/StaticLine.hpp"
@ -14,6 +15,7 @@
#include "slic3r/Utils/ColorSpaceConvert.hpp" #include "slic3r/Utils/ColorSpaceConvert.hpp"
#include "MainFrame.hpp" #include "MainFrame.hpp"
#include "libslic3r/Config.hpp" #include "libslic3r/Config.hpp"
#include "Widgets/Label.hpp"
using namespace Slic3r; using namespace Slic3r;
using namespace Slic3r::GUI; using namespace Slic3r::GUI;
@ -115,10 +117,24 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters)
update_ui(m_chart); update_ui(m_chart);
sizer_chart->Add(m_chart, 0, wxALL, 5); sizer_chart->Add(m_chart, 0, wxALL, 5);
m_widget_time = new SpinInput(this, wxEmptyString, "ms" , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 0 , 5000 , 3000, 500); // Create help text for constant flow rate dragging
std::string ctrl_str = GUI::shortkey_ctrl_prefix();
if (!ctrl_str.empty() && ctrl_str.back() == '+')
ctrl_str.pop_back(); // Remove trailing '+'
wxString message = format_wxstr(_L("For constant flow rate, hold %1% while dragging."), ctrl_str);
Label* label = new Label(this, wxEmptyString);
wxClientDC dc(label);
wxString multiline_message;
label->SetFont(Label::Body_14);
label->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
label->split_lines(dc, scale(470), message, multiline_message);
label->SetLabel(multiline_message);
sizer_chart->Add(label, 0, wxEXPAND | wxALL, 5);
m_widget_time = new SpinInput(this, wxEmptyString, "ms" , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 0 , 5000 , 3000, 250);
m_widget_volume = new SpinInput(this, wxEmptyString, "mm³", wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 0 , 10000, 0 ); m_widget_volume = new SpinInput(this, wxEmptyString, "mm³", wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 0 , 10000, 0 );
m_widget_ramming_line_width_multiplicator = new SpinInput(this, wxEmptyString, "%" , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 10, 200 , 100 ); m_widget_ramming_line_width_multiplicator = new SpinInput(this, wxEmptyString, "%" , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 10, 300 , 100 );
m_widget_ramming_step_multiplicator = new SpinInput(this, wxEmptyString, "%" , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 10, 200 , 100 ); m_widget_ramming_step_multiplicator = new SpinInput(this, wxEmptyString, "%" , wxDefaultPosition, wxSize(scale(120), -1), wxSP_ARROW_KEYS, 10, 300 , 100 );
auto add_title = [this, sizer_param](wxString label){ auto add_title = [this, sizer_param](wxString label){
auto title = new StaticLine(this, 0, label); auto title = new StaticLine(this, 0, label);