diff options
author | Vojtech Bubnik <bubnikv@gmail.com> | 2021-12-20 10:30:54 +0300 |
---|---|---|
committer | Vojtech Bubnik <bubnikv@gmail.com> | 2021-12-20 10:30:54 +0300 |
commit | ef660873553c50a1c75feba617b16262d5e9edee (patch) | |
tree | f4126f2543d14c147056afb8d857113086c2c1ae /src | |
parent | 62d9f73d7846e8b9491444901baa0144b901ff0e (diff) |
Fixed crash when exporting G-code with no extrusions generated
for printable object.
Fixed by cancelling slicing process and emitting an exception
to show a notification.
Fixes carsh #7538
Diffstat (limited to 'src')
-rw-r--r-- | src/libslic3r/GCode.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index bd14e0a0b..def30bbde 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1212,6 +1212,9 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato if ((initial_extruder_id = tool_ordering.first_extruder()) != static_cast<unsigned int>(-1)) break; } + if (initial_extruder_id == static_cast<unsigned int>(-1)) + // No object to print was found, cancel the G-code export. + throw Slic3r::SlicingError(_(L("No extrusions were generated for objects."))); // We don't allow switching of extruders per layer by Model::custom_gcode_per_print_z in sequential mode. // Use the extruder IDs collected from Regions. this->set_extruders(print.extruders()); @@ -1220,6 +1223,9 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato // If the tool ordering has been pre-calculated by Print class for wipe tower already, reuse it. tool_ordering = print.tool_ordering(); tool_ordering.assign_custom_gcodes(print); + if (tool_ordering.all_extruders().empty()) + // No object to print was found, cancel the G-code export. + throw Slic3r::SlicingError(_(L("No extrusions were generated for objects."))); has_wipe_tower = print.has_wipe_tower() && tool_ordering.has_wipe_tower(); initial_extruder_id = (has_wipe_tower && ! print.config().single_extruder_multi_material_priming) ? // The priming towers will be skipped. |