Ability to re-scan and intercept g-code before sending it to printer


#1

Hi,

I would like to know if there is a way to intercept the sending of g-code to the printer (after clicking Print), retrieving the active g-code command/s and run either bash commands from there? (without using any events, raw g-code interaction if possible).

Here's my sample thoughts on implementation of the modified g-code:

G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mod
P01 ;code intercept (will not send to printer) run blink-gpio.py
....
....
S05 ;code intercept (will not send to printer) run sudo shutdown-pi.sh

Please note that those g-codes in example (P01, S05) will be added by a plug-in/s or other 3rd party tool/s.

Thanks


#2

Hello @1Paolo!

You may have a look on the Enclosure Plugin.


#3

And the plugin documentation, specifically these hooks. Also this plugin.


#4

Hi, @Ewald_Ikemann, @foosel,

Thank you very much for your response.

@foosel, the GCODE System Commands plugin is exactly what I want to implement in my project. I'll try to find time to enhance this based on my requirements; but for now, I'm gonna use this as is.

Again, thanks a lot :smiley: