Interpreted Macros (an experiment)

Klipper’s macro system uses a templating system. This means that a macro is rendered into standard G-code then executed statically. This means that state updates that occur in a macro are unavailable to the macro at runtime.

With DynamicMacros, you can split a macro into multiple parts to partially work around the basic limitations of this template-based system.

However, I was wondering if it would be possible to create an interpreted macro system (like Python) that would allow for executing G-code and reading printer state, but also allow more robust runtime logic.

The result is iMacros, which aims to combine Python’s robust logic with the relatively simple G-code macro syntax.

Any feedback/ideas where this could be useful would be appreciated!

1 Like