Follow-up of 3b174c37a0 - Fixed update of wipe tower brim width after loading a 3mf project

This commit is contained in:
enricoturri1966 2023-02-23 10:12:29 +01:00
parent be74338e53
commit 575422c7b7
2 changed files with 14 additions and 15 deletions

View File

@ -2250,9 +2250,9 @@ void GCodeViewer::load_shells(const Print& print)
const PrintConfig& config = print.config(); const PrintConfig& config = print.config();
const size_t extruders_count = config.nozzle_diameter.size(); const size_t extruders_count = config.nozzle_diameter.size();
if (extruders_count > 1 && config.wipe_tower && !config.complete_objects) { if (extruders_count > 1 && config.wipe_tower && !config.complete_objects) {
const float depth = print.wipe_tower_data(extruders_count).depth; const WipeTowerData& wipe_tower_data = print.wipe_tower_data(extruders_count);
const float brim_width = print.wipe_tower_data(extruders_count).brim_width; 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, 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); !print.is_step_done(psWipeTower), brim_width);
} }

View File

@ -1972,31 +1972,30 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
// Should the wipe tower be visualized ? // Should the wipe tower be visualized ?
unsigned int extruders_count = (unsigned int)dynamic_cast<const ConfigOptionFloats*>(m_config->option("nozzle_diameter"))->values.size(); unsigned int extruders_count = (unsigned int)dynamic_cast<const ConfigOptionFloats*>(m_config->option("nozzle_diameter"))->values.size();
bool wt = dynamic_cast<const ConfigOptionBool*>(m_config->option("wipe_tower"))->value; const bool wt = dynamic_cast<const ConfigOptionBool*>(m_config->option("wipe_tower"))->value;
bool co = dynamic_cast<const ConfigOptionBool*>(m_config->option("complete_objects"))->value; const bool co = dynamic_cast<const ConfigOptionBool*>(m_config->option("complete_objects"))->value;
if (extruders_count > 1 && wt && !co) { if (extruders_count > 1 && wt && !co) {
// Height of a print (Show at least a slab) // 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<const ConfigOptionFloat*>(m_config->option("wipe_tower_x"))->value; const float x = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_x"))->value;
float y = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_y"))->value; const float y = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_y"))->value;
float w = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_width"))->value; const float w = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_width"))->value;
float a = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_rotation_angle"))->value; const float a = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_rotation_angle"))->value;
const float bw = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_brim_width"))->value;
const Print *print = m_process->fff_print(); const Print *print = m_process->fff_print();
const float depth = print->wipe_tower_data(extruders_count).depth;
float depth = print->wipe_tower_data(extruders_count).depth;
float brim_width = print->wipe_tower_data(extruders_count).brim_width;
#if ENABLE_OPENGL_ES #if ENABLE_OPENGL_ES
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview( int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(
x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower), x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower),
brim_width, &m_wipe_tower_mesh); bw, &m_wipe_tower_mesh);
#else #else
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview( int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(
x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower), x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower),
brim_width); bw);
#endif // ENABLE_OPENGL_ES #endif // ENABLE_OPENGL_ES
if (volume_idx_wipe_tower_old != -1) if (volume_idx_wipe_tower_old != -1)
map_glvolume_old_to_new[volume_idx_wipe_tower_old] = volume_idx_wipe_tower_new; map_glvolume_old_to_new[volume_idx_wipe_tower_old] = volume_idx_wipe_tower_new;