OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
WipeTowerDialog.hpp File Reference
#include <string>
#include <vector>
#include <wx/colour.h>
#include <cstddef>
#include <wx/dialog.h>
#include <wx/panel.h>
#include <wx/event.h>
#include <wx/string.h>
#include <wx/webview.h>
#include "libslic3r/FlushVolCalc.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "Widgets/SpinInput.hpp"
#include "RammingChart.hpp"
Include dependency graph for WipeTowerDialog.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  RammingPanel
class  RammingDialog
class  WipingDialog

Functions

bool is_flush_config_modified ()
void open_flushing_dialog (wxEvtHandler *parent, const wxEvent &event)

Function Documentation

◆ is_flush_config_modified()

bool is_flush_config_modified ( )
240{
241 const auto &project_config = wxGetApp().preset_bundle->project_config;
242 const std::vector<double> &config_matrix = (project_config.option<ConfigOptionFloats>("flush_volumes_matrix"))->values;
243 const std::vector<double> &config_multiplier = (project_config.option<ConfigOptionFloats>("flush_multiplier"))->values;
244 // The config matrix is N x N per nozzle over every slot, while CalcFlushingVolumes is p x p
245 // over the physical slots (mixed slots never flush): map each default cell to its config index.
246 const auto physical_indices = wxGetApp().preset_bundle->physical_filament_config_indices();
247 const size_t full_n = project_config.option<ConfigOptionStrings>("filament_colour")->values.size();
248
249 bool has_modify = false;
250 for (int i = 0; i < config_multiplier.size(); i++) {
251 if (config_multiplier[i] != 1) {
252 has_modify = true;
253 break;
254 }
255 std::vector<std::vector<double>> default_matrix = WipingDialog::CalcFlushingVolumes(i);
256 size_t p_len = default_matrix.size();
257 size_t nozzle_offset = i * full_n * full_n;
258 for (size_t m = 0; m < p_len; m++) {
259 for (size_t n = 0; n < p_len; n++) {
260 size_t cfg_idx = nozzle_offset + physical_indices[m] * full_n + physical_indices[n];
261 if (cfg_idx < config_matrix.size() && config_matrix[cfg_idx] != default_matrix[m][n] * config_multiplier[i]) {
262 has_modify = true;
263 break;
264 }
265 }
266 if (has_modify) break;
267 }
268 if (has_modify) break;
269 }
270 return has_modify;
271}
Definition Config.hpp:1190
size_t size() const override
Definition Config.hpp:722
static VolumeMatrix CalcFlushingVolumes(int extruder_id)
Definition WipeTowerDialog.cpp:620
ConfigOptionFloatsTempl< false > ConfigOptionFloats
Definition Config.hpp:1015

References WipingDialog::CalcFlushingVolumes(), and Slic3r::ConfigOptionVector< T >::size().

Referenced by Slic3r::GUI::Sidebar::Sidebar(), Slic3r::GUI::Sidebar::auto_calc_flushing_volumes(), Slic3r::GUI::Plater::load_project(), Slic3r::GUI::Sidebar::msw_rescale(), open_flushing_dialog(), and Slic3r::GUI::Sidebar::sys_color_changed().

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

◆ open_flushing_dialog()

void open_flushing_dialog ( wxEvtHandler * parent,
const wxEvent & event )
274{
275 auto &project_config = wxGetApp().preset_bundle->project_config;
276
277 WipingDialog dlg(static_cast<wxWindow *>(wxGetApp().mainframe));
278 dlg.ShowModal();
279 if (dlg.GetSubmitFlag()) {
280 auto matrix = dlg.GetFlattenMatrix();
281 auto flush_multipliers = dlg.GetMultipliers();
282 (project_config.option<ConfigOptionFloats>("flush_volumes_matrix"))->values = std::vector<double>(matrix.begin(), matrix.end());
283 (project_config.option<ConfigOptionFloats>("flush_multiplier"))->values = std::vector<double>(flush_multipliers.begin(), flush_multipliers.end());
284 bool flushing_volume_modify = is_flush_config_modified();
285 wxGetApp().sidebar().set_flushing_volume_warning(flushing_volume_modify);
286 wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
287 wxGetApp().plater()->update_project_dirty_from_presets();
288 wxPostEvent(parent, event);
289 }
290}
bool is_flush_config_modified()
Definition WipeTowerDialog.cpp:239
Definition WipeTowerDialog.hpp:54

References WipingDialog::GetFlattenMatrix(), WipingDialog::GetMultipliers(), WipingDialog::GetSubmitFlag(), and is_flush_config_modified().

Referenced by Slic3r::GUI::Sidebar::Sidebar(), and Slic3r::GUI::GLCanvas3D::_set_warning_notification().

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