Implemented extension of the G-code post-processor framework:

1) New environment variable SLIC3R_PP_HOST contains one of
   "File", "PrusaLink", "Repetier", "SL1Host", "OctoPrint", "FlashAir", "Duet", "AstroBox" ...
2) New environment variable SLIC3R_PP_OUTPUT_NAME contains the name
   of the G-code file including path (for SLIC3R_PP_HOST == "File")
   or a name of the file after upload to the host (PrusaLink, Octoprint ...)
3) The post-processing script may suggest a new output file name
   (likely based on SLIC3R_PP_OUTPUT_NAME) by saving it as a single line
   into a new "output name" temp file. The "output name" file name is
   created by suffixing the input G-code file name with ".output_name".

Please note that the G-code viewer visualizes G-code before post-processing.

Fixes Broken PostProcessing when script changes out-filename #6042
This commit is contained in:
Vojtech Bubnik 2021-08-10 15:21:53 +02:00
parent 9e32a00efc
commit cf32b56454
5 changed files with 207 additions and 83 deletions

View file

@ -216,9 +216,9 @@ private:
Print *m_fff_print = nullptr;
SLAPrint *m_sla_print = nullptr;
// Data structure, to which the G-code export writes its annotations.
GCodeProcessor::Result *m_gcode_result = nullptr;
GCodeProcessor::Result *m_gcode_result = nullptr;
// Callback function, used to write thumbnails into gcode.
ThumbnailsGeneratorCallback m_thumbnail_cb = nullptr;
ThumbnailsGeneratorCallback m_thumbnail_cb = nullptr;
SL1Archive m_sla_archive;
// Temporary G-code, there is one defined for the BackgroundSlicingProcess, differentiated from the other processes by a process ID.
std::string m_temp_output_path;
@ -262,6 +262,7 @@ private:
bool invalidate_all_steps();
// If the background processing stop was requested, throw CanceledException.
void throw_if_canceled() const { if (m_print->canceled()) throw CanceledException(); }
void finalize_gcode();
void prepare_upload();
// To be executed at the background thread.
ThumbnailsList render_thumbnails(const ThumbnailsParams &params);