From dbc9bf5be799a7d81757588eabbe4ac3557b449c Mon Sep 17 00:00:00 2001 From: Enrico Turri <enricoturri@seznam.cz> Date: Mon, 19 Nov 2018 13:04:19 +0100 Subject: [PATCH] Lift-up of SLA volumes only when at least one volume is generated --- src/slic3r/GUI/GLCanvas3D.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 8e0065a3a..da1c9fca5 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3901,16 +3901,24 @@ void GLCanvas3D::reload_scene(bool force) m_volumes.volumes[it->volume_idx]->composite_id = GLVolume::CompositeID(object_idx, -1, instance_idx); } } + + // stores the current volumes count + size_t volumes_count = m_volumes.volumes.size(); + for (size_t istep = 0; istep < sla_steps.size(); ++istep) if (!instances[istep].empty()) m_volumes.load_object_auxiliary(print_object, object_idx, instances[istep], sla_steps[istep], state.step[istep].timestamp, m_use_VBOs && m_initialized); - // Shift-up all volumes of the object so that it has the right elevation with respect to the print bed - Vec3d shift_z(0.0, 0.0, print_object->get_elevation()); - for (GLVolume* volume : m_volumes.volumes) + if (volumes_count != m_volumes.volumes.size()) { - if (volume->object_idx() == object_idx) - volume->set_instance_offset(volume->get_instance_offset() + shift_z); + // If any volume has been added + // Shift-up all volumes of the object so that it has the right elevation with respect to the print bed + Vec3d shift_z(0.0, 0.0, print_object->get_elevation()); + for (GLVolume* volume : m_volumes.volumes) + { + if (volume->object_idx() == object_idx) + volume->set_instance_offset(volume->get_instance_offset() + shift_z); + } } } }