Hi,
I am wondering if it could be possible : today I am using PrusaSlicer ; but I think it is almost the same in all slicers : you define any custom gcode for end job, just like retracting filaments, etc.
I know Octoprint also supports that but it will not depend on any parameters set up during slicing ; I explain : PrusaSlicer comes with this end gcode sequence :
{if has_wipe_tower}
G1 E-15.0000 F3000
{else}
G1 X0 Y210 F7200
G1 E2 F5000
G1 E2 F5500
G1 E2 F6000
G1 E-15.0000 F5800
G1 E-20.0000 F5500
G1 E10.0000 F3000
G1 E-10.0000 F3100
G1 E10.0000 F3150
G1 E-10.0000 F3250
G1 E10.0000 F3300
{endif}
; Unload filament
M702 C
G4 ; wait
M104 S0 ; turn off temperature
M140 S0 ; turn off heatbed
M107 ; turn off fan
; Lift print head a bit
{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+30, max_print_height)}{endif} ; Move print head up
G1 X0 Y200 F3000 ; home X axis
M84 ; disable motors
Here the {if has_wipe_tower} is a gcode that will be substituted according to the parameters of the slicing job. It will end up with pure GCODE. (there will be no {if ...} in the final file.)
I am not sure it is possible to replicate this in Octoprint, as it depends on the printer and will be difficult to support everything.
But it would be interesting to setup a label in gcode that would indicate post print gcode that should be invoked if job is cancelled.
What do you think ?