Is there a way to run custom GCode at a layer or Z

What would be the easiest way to to tell Octoprint to run a custom GCode when the printer reaches a specific layer or Z height? I would like to do it in octoprint rather than the slicer. I searched but couldn't find any plugins that do this.

It looks like, although the name suggests it is just for colours, the 'Multi Colors' plugin would be able to run custom gcode at the layer, matched by a regex for the layer indicator.

I have no idea if it works.

Maybe you could consider an alternative approach? You can embed custom G-code at any layer using Cura (for example). This is a technique used to create temperature towers. The method I use puts a simply tag in the g- gode at layer change, then I run a python program over the G-code which counts the layers and inserts Snnn to change the nozzle temperature at specific points - so you could do it that way - to do it in Octoprint I think you’d need to find, or develop an entirely new plugin, or modify an Octoprint based slicer - otherwise you’d have to do it ‘on the fly’ and that’s tricky!!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.