mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-30 17:05:35 -05:00
Let Slice and Print retry after a post-processing script or plugin fails (#17095)
This commit is contained in:
1 parent
c77020e654
commit
1093ff0714
10 files changed
+243
-17
No files matched your search
@@ -83,15 +83,18 @@ bool SlicingProcessCompletedEvent::critical_error() const
|
||||
|
||||
bool SlicingProcessCompletedEvent::invalidate_plater() const
|
||||
{
|
||||
if (critical_error()) {
|
||||
try {
|
||||
this->rethrow_exception();
|
||||
} catch (const Slic3r::ExportError&) {
|
||||
// Exception thrown by copying file does not ivalidate plater
|
||||
return false;
|
||||
} catch (...) {}
|
||||
return error() && critical_error() && !export_failed();
|
||||
}
|
||||
|
||||
bool SlicingProcessCompletedEvent::export_failed() const
|
||||
{
|
||||
if (!error())
|
||||
return false;
|
||||
try {
|
||||
this->rethrow_exception();
|
||||
} catch (const Slic3r::ExportError&) {
|
||||
return true;
|
||||
}
|
||||
} catch (...) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -289,8 +292,15 @@ void BackgroundSlicingProcess::process_fff()
|
||||
// the preview re-reads its moves and line offsets from the edited file. The rest of m_gcode_result,
|
||||
// including nozzle_group_result (consumed by the H2C print-dispatch nozzle mapping), is kept.
|
||||
if (m_fff_print->is_BBL_printer()) {
|
||||
if (run_post_process_scripts(m_temp_output_path, false, "File", m_temp_output_path, m_fff_print->full_print_config()))
|
||||
m_fff_print->reload_gcode_moves(m_gcode_result);
|
||||
try {
|
||||
if (run_post_process_scripts(m_temp_output_path, false, "File", m_temp_output_path, m_fff_print->full_print_config()))
|
||||
m_fff_print->reload_gcode_moves(m_gcode_result);
|
||||
} catch (...) {
|
||||
// A failed script or plugin may have left the G-code half edited, so the next run exports
|
||||
// it again instead of reusing it.
|
||||
m_fff_print->invalidate_gcode_export_from_worker();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": export gcode finished");
|
||||
@@ -991,7 +1001,7 @@ void BackgroundSlicingProcess::prepare_upload()
|
||||
m_print->set_status(95, _utf8(L("Running post-processing scripts")));
|
||||
std::string error_message;
|
||||
if (copy_file(m_temp_output_path, source_path.string(), error_message) != SUCCESS)
|
||||
throw Slic3r::RuntimeError(_utf8(L("Copying of the temporary G-code to the output G-code failed.")));
|
||||
throw Slic3r::ExportError(_utf8(L("Copying of the temporary G-code to the output G-code failed.")));
|
||||
m_upload_job.upload_data.upload_path = m_fff_print->print_statistics().finalize_output_path(
|
||||
m_upload_job.upload_data.upload_path.string());
|
||||
// Orca: skip post-processing scripts for BBL printers as we have run them already in finalize_gcode()
|
||||
|
||||
Reference in new issue
Block a user