diff --git a/src/libseqarrange/include/libseqarrange/seq_interface.hpp b/src/libseqarrange/include/libseqarrange/seq_interface.hpp index c9ed679a28..3e269bcc96 100644 --- a/src/libseqarrange/include/libseqarrange/seq_interface.hpp +++ b/src/libseqarrange/include/libseqarrange/seq_interface.hpp @@ -27,6 +27,8 @@ using namespace Slic3r; namespace Sequential { + class ObjectTooLargeException : public std::runtime_error { public: explicit ObjectTooLargeException(const std::string& msg) : std::runtime_error(msg) {}}; + class InternalErrorException : public std::runtime_error { public: explicit InternalErrorException(const std::string& msg) : std::runtime_error(msg) {} }; diff --git a/src/libseqarrange/src/seq_preprocess.cpp b/src/libseqarrange/src/seq_preprocess.cpp index df76ca69fc..59ccbfbef2 100644 --- a/src/libseqarrange/src/seq_preprocess.cpp +++ b/src/libseqarrange/src/seq_preprocess.cpp @@ -721,7 +721,7 @@ void prepare_ExtruderPolygons(const SolverConfiguration &solver printf("Object too large to fit onto plate.\n"); } #endif - throw std::runtime_error("OBJECT TOO LARGE"); + throw ObjectTooLargeException("OBJECT TOO LARGE"); } if (printer_geometry.convex_heights.find(height) != printer_geometry.convex_heights.end()) @@ -742,7 +742,7 @@ void prepare_ExtruderPolygons(const SolverConfiguration &solver } else { - throw std::runtime_error("MISMATCH BETWEEN OBJECT AND PRINTER SLICE HEIGHTS."); + throw InternalErrorException("MISMATCH BETWEEN OBJECT AND PRINTER SLICE HEIGHTS."); } } } diff --git a/src/slic3r/GUI/Jobs/SeqArrangeJob.cpp b/src/slic3r/GUI/Jobs/SeqArrangeJob.cpp index fb64c55130..a9d15f0b5d 100644 --- a/src/slic3r/GUI/Jobs/SeqArrangeJob.cpp +++ b/src/slic3r/GUI/Jobs/SeqArrangeJob.cpp @@ -8,7 +8,7 @@ #include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/Plater.hpp" #include "slic3r/GUI/MsgDialog.hpp" - +#include "slic3r/GUI/format.hpp" @@ -49,8 +49,19 @@ void SeqArrangeJob::finalize(bool canceled, std::exception_ptr& eptr) try { std::rethrow_exception(eptr); } catch (const ExceptionCannotApplySeqArrange&) { - ErrorDialog dlg(wxGetApp().plater(), _L("The result of the single-bed arrange would scatter instances of a single object between several beds, " - "possibly affecting order of printing of the non-selected beds. Consider using global arrange across all beds."), false); + ErrorDialog dlg(wxGetApp().plater(), _L("The result of the single-bed arrange would scatter " + "instances of a single object between several beds, possibly affecting order of printing " + "of the non-selected beds. Consider using global arrange across all beds."), false); + dlg.ShowModal(); + error = true; + eptr = nullptr; // The exception is handled. + } catch (const Sequential::ObjectTooLargeException&) { + ErrorDialog dlg(wxGetApp().plater(), _L("One of the objects is too large to fit the bed."), false); + dlg.ShowModal(); + error = true; + eptr = nullptr; // The exception is handled. + } catch (const Sequential::InternalErrorException& ex) { + ErrorDialog dlg(wxGetApp().plater(), GUI::format_wxstr(_L("Internal error: %1%"), ex.what()), false); dlg.ShowModal(); error = true; eptr = nullptr; // The exception is handled.