diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 37e527d649..53790e076b 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -23,6 +23,7 @@ #include "libslic3r/Format/SL1.hpp" #include "libslic3r/Thread.hpp" #include "libslic3r/libslic3r.h" +#include "libslic3r/BuildVolume.hpp" #include #include @@ -144,7 +145,21 @@ std::string BackgroundSlicingProcess::output_filepath_for_project(const boost::f void BackgroundSlicingProcess::process_fff() { assert(m_print == m_fff_print); - m_print->process(); + + // Checks that the print does not exceed the max print height + const BuildVolume& build_volume = GUI::wxGetApp().mainframe->m_plater->build_volume(); + auto objects = m_fff_print->objects(); + for (auto obj : objects) { + std::vector layer_height_profile; + PrintObject::update_layer_height_profile(*obj->model_object(), obj->slicing_parameters(), layer_height_profile); + auto layers = generate_object_layers(obj->slicing_parameters(), layer_height_profile); + if (!layers.empty() && layers.back() > build_volume.max_print_height()) { + throw Slic3r::SlicingError("The print is taller than the maximum allowed height. You might want to reduce the size of your model" + " or change current print settings and retry."); + } + } + + m_print->process(); wxCommandEvent evt(m_event_slicing_completed_id); // Post the Slicing Finished message for the G-code viewer to update. // Passing the timestamp