Closed Szeker closed 4 years ago
It is klipper related, you could make some macro like in your config.g printer.cfg Start_gcode End_gcode Each one with the gcode commands, you want to run. Place their names in your prefered slicer. Search on klipper gcodes about macros. If you need an example, I can post.
On Mon, May 11, 2020, 8:54 PM Szeker notifications@github.com wrote:
Question: would it be possible to run a gcode script (defined in printer.cfg) before / after printing?
I prefer to keep things separated, therefore I like to have only object relevant g-code in the sliced gcode and machine dependent stuff stored in the printer.cfg file. Avoiding in-place scripts in the sliced gcode also helps to keep eg. backward compatibility with existing gcodes.
One could define how to start / finish a print in printer.cfg on a given machine - if a g-code script would be called by DWC2 before the print started / after the print finished (especially the latter).
Similar to pause/resume scripts.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Stephan3/dwc2-for-klipper/issues/76, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWT4RAXRAORRC24LY2RHULRRA3VVANCNFSM4M6DX72A .
@manu7irl Thanks! I know I can place macros into the gcode by the slicer and execute them with Klipper, but this means I have to manually edit existing gcodes if I want to re-print them. It's not a big deal of course, but I think it would be a more elegant and portable solution to have the option for script automation in DWC2 instead of the slicer/gcode itself.
Anyhow thanks for the comment!
To implement an "AFTER_PRINT_FINISHED" macro, is there any better way to detect finished printing, than to monitor a 'P' -> 'I' status transition of the printer status? (Similar to handle switching from pausing/processing to paused in line 1356?)
E.g.:
if self.last_state == 'P' and state == 'I': self.after_print_finished_macro()
In my oppinion humans can do that in nearly every slicer allready. -> close
Question: would it be possible to run a gcode script (defined in printer.cfg) before / after printing?
I prefer to keep things separated, therefore I like to have only object relevant g-code in the sliced gcode and machine dependent stuff stored in the printer.cfg file. Avoiding in-place scripts in the sliced gcode also helps to keep eg. backward compatibility with existing gcodes.
One could define how to start / finish a print in printer.cfg on a given machine - if a g-code script would be called by DWC2 before the print started / after the print finished (especially the latter).
Similar to pause/resume scripts.