Custom Control Editor and math



I try to create an "gcode" script:

Based on this example:

i create my own code but it doesnt work:

{% set move = parameters.test %}

G0 Z{{ move }} F500
G0 Z-{{ move - 0.5 }} F100

other try but same result...

{% set move = parameters.test %}
{% set move2 = parameters.test - 0.5 %}
G0 Z{{ move }} F500
G0 Z-{{ move2 }} F100

Any hints how a can subtract an fixed value (or in best case a second var)?



Look carefully at the use of single French braces around something and double French braces. There is some subtlety going on.

It's likely that anything surrounded by double French braces (a "mustache") is direct macro substitution happening. On the other hand, anything inside single French braces is likely direct Python code.

Go back to foosel's example and review. Anytime that math is happening, it's taking place inside the single type of braces.

Try this without the negative sign in that G0 command to rule out a situation where you could end up with G0 Z--1.2 or similar