- Fixed crash when starting GCodeViewer

This commit is contained in:
enricoturri1966 2021-11-22 10:57:38 +01:00
parent 1b7975639e
commit a4baecb340
4 changed files with 21 additions and 13 deletions
src/slic3r/GUI

View file

@ -252,12 +252,16 @@ void Bed3D::render_internal(GLCanvas3D& canvas, bool bottom, float scale_factor,
BoundingBoxf3 Bed3D::calc_extended_bounding_box() const
{
BoundingBoxf3 out { m_build_volume.bounding_volume() };
const Vec3d size = out.size();
// ensures that the bounding box is set as defined or the following calls to merge() will not work as intented
if (size.x() > 0.0 && size.y() > 0.0 && !out.defined)
out.defined = true;
// Reset the build volume Z, we don't want to zoom to the top of the build volume if it is empty.
out.min.z() = 0;
out.max.z() = 0;
out.min.z() = 0.0;
out.max.z() = 0.0;
// extend to contain axes
out.merge(m_axes.get_origin() + m_axes.get_total_length() * Vec3d::Ones());
out.merge(out.min + Vec3d(-Axes::DefaultTipRadius, -Axes::DefaultTipRadius, out.max(2)));
out.merge(out.min + Vec3d(-Axes::DefaultTipRadius, -Axes::DefaultTipRadius, out.max.z()));
// extend to contain model, if any
BoundingBoxf3 model_bb = m_model.get_bounding_box();
if (model_bb.defined) {