Looking for a plugin injecting gcodes after

Hi,
I am looking for Octoprint (or Cura) plugin that would allow to repeatedly inject a set of GCodes into .gcode file. The same set of gcodes should be added every few layers and/or every few minutes and/or after extruding certain amount of filament. So far I was only able to find the plugins that do it on every layer change or at certain height, which is not what I need. If you know about an existing plugin that meets above requirements, please share its name or download link.
Thanks

You might be able to use some programming math logic in the on layer change gcode built into PrusaSlicer, but Cura has much more limited options to this regard. I've found that the find and replace plugin the best bet in that case but I've only used it for every layer change.

On the OctoPrint side you could probably get gcode macros and some crazy logic with writing files, etc. to do what your after. I know @CmdrCody has used this extensively in some of his stuff. It's detailed here.

Specifically the GCode Macros folder: OctoPrint-Parametric-Macros/GCode-Macros at main · CmdrCody51/OctoPrint-Parametric-Macros · GitHub

Ya, you can use my method to make a list of layers to do stuff. But time, I can't think of one. Maybe one of the filament trackers for filament triggering??? You aren't really detailed on what you want to do tho.... I have found that people may not look at things from enough angles to see solutions.

Sorry, I should have mentioned - I am printing with PETG and nevertheless I've tried tuning retraction and temperature settings, I am still getting several blobs on my every print. So, I thought periodically wiping the nozzle with brass brush mounted outside the print area should help.
Many thanks for quick responses.I will check all your suggestions.

ah yeah, the PETG booger scenario. I found that printing with larger layer heights helped with that drastically.

I usually print at 0.3mm, but still...:frowning_face:

Maybe the filament is too wet?
Also try a bit smaller extrusion multiplier.
And a bit lower extrusion temperature may help.

At .3 I assume you're using a larger nozzle diameter than .4, larger nozzles themselves will introduce more oozing. Your situation does remind me though of someone that has done this wiping every so often with the easy servo plugin.

I have 2 printers of my own design. Both have 0.4 mm nozzles with the original e3D hotends. The smaller printer runs on Marlin and has Himera hotend. The bigger is IDEX with two bowden e3D v6 hotends. I recently switched it to Klipper and yet need to try dual head printing. I cut off and use the heads of these wire brushes. I designed for them fixed mounts and made sure they are easy to replace (just have a hole from underneath to push the brush head up and out). Here is how brush is mounted in my smaller printer

I found maybe not the most elegant but working solution. In Cura am using Post Processing Filament Change plugin. It allows to enter comma-separated layer numbers where the code needs to be injected. I added every 5th layer all the way up-to the Zmax of my printer considering layer height 0.3mm.
image
Then in Klipper I created gcode_macro WIPE_NOZZLE that contains all the commands required to wipe the nozzle.
image
The only little inconvenience is - Cura plugin inserts M600 into the gcode before each appearance of WIPE_NOZZLE and I had to create another gcode_macro to discard it. I am not using M600 and if I need it in future, I will revisit this solution.

For the printers running firmware that does not support macros you can use Octoprint's Gcode Macros plugin, although filtering out M600 will not work because this plugin requires the strings that will be replaced to start from @ sign.

you might be able to use the find and replace plugin in cura to delete the M600 lines for you.

Would a text editor like BBEdit be your friend here… :thinking:

Has powerful find and replace functions and v simple…