From 575422c7b74c2fe71bedf0ea20a3d0b253d97418 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 23 Feb 2023 10:12:29 +0100 Subject: [PATCH] Follow-up of 3b174c37a0291d630df3ac37b292c3c1dd360197 - Fixed update of wipe tower brim width after loading a 3mf project --- src/slic3r/GUI/GCodeViewer.cpp | 6 +++--- src/slic3r/GUI/GLCanvas3D.cpp | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 186f1f4ff..24f692d11 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2250,9 +2250,9 @@ void GCodeViewer::load_shells(const Print& print) const PrintConfig& config = print.config(); const size_t extruders_count = config.nozzle_diameter.size(); if (extruders_count > 1 && config.wipe_tower && !config.complete_objects) { - const float depth = print.wipe_tower_data(extruders_count).depth; - const float brim_width = print.wipe_tower_data(extruders_count).brim_width; - + const WipeTowerData& wipe_tower_data = print.wipe_tower_data(extruders_count); + const float depth = wipe_tower_data.depth; + const float brim_width = wipe_tower_data.brim_width; m_shells.volumes.load_wipe_tower_preview(config.wipe_tower_x, config.wipe_tower_y, config.wipe_tower_width, depth, max_z, config.wipe_tower_rotation_angle, !print.is_step_done(psWipeTower), brim_width); } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 79ceae9ec..427c0e99f 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1972,31 +1972,30 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re // Should the wipe tower be visualized ? unsigned int extruders_count = (unsigned int)dynamic_cast(m_config->option("nozzle_diameter"))->values.size(); - bool wt = dynamic_cast(m_config->option("wipe_tower"))->value; - bool co = dynamic_cast(m_config->option("complete_objects"))->value; + const bool wt = dynamic_cast(m_config->option("wipe_tower"))->value; + const bool co = dynamic_cast(m_config->option("complete_objects"))->value; if (extruders_count > 1 && wt && !co) { // Height of a print (Show at least a slab) - double height = std::max(m_model->bounding_box().max(2), 10.0); + const double height = std::max(m_model->bounding_box().max.z(), 10.0); - float x = dynamic_cast(m_config->option("wipe_tower_x"))->value; - float y = dynamic_cast(m_config->option("wipe_tower_y"))->value; - float w = dynamic_cast(m_config->option("wipe_tower_width"))->value; - float a = dynamic_cast(m_config->option("wipe_tower_rotation_angle"))->value; + const float x = dynamic_cast(m_config->option("wipe_tower_x"))->value; + const float y = dynamic_cast(m_config->option("wipe_tower_y"))->value; + const float w = dynamic_cast(m_config->option("wipe_tower_width"))->value; + const float a = dynamic_cast(m_config->option("wipe_tower_rotation_angle"))->value; + const float bw = dynamic_cast(m_config->option("wipe_tower_brim_width"))->value; const Print *print = m_process->fff_print(); - - float depth = print->wipe_tower_data(extruders_count).depth; - float brim_width = print->wipe_tower_data(extruders_count).brim_width; + const float depth = print->wipe_tower_data(extruders_count).depth; #if ENABLE_OPENGL_ES int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview( x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower), - brim_width, &m_wipe_tower_mesh); + bw, &m_wipe_tower_mesh); #else int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview( x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower), - brim_width); + bw); #endif // ENABLE_OPENGL_ES if (volume_idx_wipe_tower_old != -1) map_glvolume_old_to_new[volume_idx_wipe_tower_old] = volume_idx_wipe_tower_new;