#7388 - Fixed shell does not align in Z direction if raft enabled in gcode preview

This commit is contained in:
enricoturri1966 2021-12-01 09:16:53 +01:00
parent a89020abd7
commit fcc13d1665

View File

@ -2067,8 +2067,19 @@ void GCodeViewer::load_shells(const Print& print, bool initialized)
instance_ids[i] = i; 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); 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; ++object_id;
} }