diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 9a21079118..a8d7dbdf25 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -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) { diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 407d57030d..e14b4e6004 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1119,6 +1119,8 @@ void GLCanvas3D::reset_volumes() ModelInstanceEPrintVolumeState GLCanvas3D::check_volumes_outside_state() const { + assert(m_initialized); + ModelInstanceEPrintVolumeState state; m_volumes.check_outside_state(m_bed.build_volume(), &state); return state; diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 9c5754a42d..bfb2537813 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -486,7 +486,7 @@ void MainFrame::update_layout() case ESettingsLayout::GCodeViewer: { m_main_sizer->Add(m_plater, 1, wxEXPAND); - m_plater->set_bed_shape({ { 0.0, 0.0 }, { 200.0, 0.0 }, { 200.0, 200.0 }, { 0.0, 200.0 } }, 0, {}, {}, true); + m_plater->set_bed_shape({ { 0.0, 0.0 }, { 200.0, 0.0 }, { 200.0, 200.0 }, { 0.0, 200.0 } }, 0.0, {}, {}, true); m_plater->get_collapse_toolbar().set_enabled(false); m_plater->collapse_sidebar(true); m_plater->Show(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 7e563eb953..b1d6076b72 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3867,18 +3867,20 @@ void Plater::priv::set_current_panel(wxPanel* panel) preview->get_canvas3d()->bind_event_handlers(); - // see: Plater::priv::object_list_changed() - // FIXME: it may be better to have a single function making this check and let it be called wherever needed - bool export_in_progress = this->background_process.is_export_scheduled(); - bool model_fits = view3D->get_canvas3d()->check_volumes_outside_state() != ModelInstancePVS_Partly_Outside; - if (!model.objects.empty() && !export_in_progress && model_fits) { + if (wxGetApp().is_editor()) { + // see: Plater::priv::object_list_changed() + // FIXME: it may be better to have a single function making this check and let it be called wherever needed + bool export_in_progress = this->background_process.is_export_scheduled(); + bool model_fits = view3D->get_canvas3d()->check_volumes_outside_state() != ModelInstancePVS_Partly_Outside; + if (!model.objects.empty() && !export_in_progress && model_fits) { #if ENABLE_SEAMS_USING_MODELS - preview->get_canvas3d()->init_gcode_viewer(); + preview->get_canvas3d()->init_gcode_viewer(); #endif // ENABLE_SEAMS_USING_MODELS - q->reslice(); + q->reslice(); + } + // keeps current gcode preview, if any + preview->reload_print(true); } - // keeps current gcode preview, if any - preview->reload_print(true); preview->set_as_dirty(); // reset cached size to force a resize on next call to render() to keep imgui in synch with canvas size