diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 671fdbe6e..69e652d4f 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2067,8 +2067,19 @@ void GCodeViewer::load_shells(const Print& print, bool initialized) instance_ids[i] = i; } + size_t current_volumes_count = m_shells.volumes.volumes.size(); m_shells.volumes.load_object(model_obj, object_id, instance_ids, "object", initialized); + // adjust shells' z if raft is present + const SlicingParameters& slicing_parameters = obj->slicing_parameters(); + if (slicing_parameters.object_print_z_min != 0.0) { + const Vec3d z_offset = slicing_parameters.object_print_z_min * Vec3d::UnitZ(); + for (size_t i = current_volumes_count; i < m_shells.volumes.volumes.size(); ++i) { + GLVolume* v = m_shells.volumes.volumes[i]; + v->set_volume_offset(v->get_volume_offset() + z_offset); + } + } + ++object_id; }