Using expressions in formats

Expressions are surrounded by square brackets [ ]. They are evaluated prior to being output.

This example multiplies the current X coordinate by five:

[<X-COORD>*5]

This example offsets a rapid move by (5,5):

N<SEQ>G00 X[<X-COORD>+5] Y[<Y-COORD>+5] Z<Z-COORD>

More examples of expressions

[# Set x = 3, y = 5, z = 0.0001]
X[<X-COORD>=3]Y[<Y-COORD>=5]Z[<Z-COORD>=0.0001]<EOB>

[# Calc (x + 3)*2]
[(<X-COORD>+3)*2]<EOB>

[# Calc sqrt(pow(x, 2) + pow(y, 2))]
[sqrt(pow(<X-COORD>,2)+pow(<Y-COORD>,2))]<EOB>

[# Calc atan2d(y, x)]
[atan2d(<Y-COORD>,<X-COORD>)]<EOB>

[# Is z = 0 within +-0.001? If so, print “Yes”]
<IF>[apxeq(<Z-COORD>,0,0.001)]<THEN>
  Yes<EOB>
<ENDIF>

[# Print special characters]
<91><93><EOB>

[# Format x using tool's format]
[<TOOL>:<X-COORD>]<EOB>

[# Format -x as LTDUP|2.2|2]
[LTDUP|2.2|2:-<X-COORD>]<EOB>

[# Set x = 1 without printing anything]
[:<X-COORD>=1]<EOB>

[# Is x != 0 and y != 0?]
<IF>[and(not(apxeq(<X-COORD>,0)),
  not(apxeq(<Y-COORD>,0)))]<THEN>
  Yes<EOB>
<ENDIF>

[# Set variable a = x]
[a=<X-COORD>]<EOB>

[# Calc a + 5]
[a+5]<EOB>