GCODE Operations

Math Operators: + - * / ** () < > %
Calculating different values eg. G1 Z{[[LayerThickness]]-[[ZLiftDistance]]*[[LayerNumber]]}
Math Functions
Return largest value eg. G1 Z{3.2*max([[LayerNumber]],[[TotalNumberOfLayers]]-[[LayerNumber]])}
Conditionals: () < >
Add conditionals to your math logic eg. G1 Z{([[LayerNumber]]<30)*1+0.5} if current layer is less than 30 lift 1.5mm if not lift 0.5mm
Base 16 Binary
To send binary codes to drivers / controllers you can use base 16 format eg. \x00\x00\xff

Supported Math Operators

=
assignment
+
addition
-
subtraction
/
division
*
multiply
**
power
%
remainder
&
bitwise and
|
bitwise or
^
bitwise xor
<<
bitwise left shift
>
bitwise right shift
~
bitwise not
==
equal
!=
not equal
>
greater than
>=
greater than or equal
<
less than
<=
less than or equal

Supported Math Functions

abs
Returns the absolute value of a given number
acos
Returns the arccosine of a given number, in radians
sin
Returns the sine of a given number
cos
Returns the cosine of a given number
tan
Returns the tangent of a given number
asin
Returns the arcsine of a given number
atan
Returns the arctangent of a given number
ceil
Function returns the smallest integer greater than or equal to a given number
floor
Returns the largest integer less than or equal to a given number
log
Returns the natural logarithm of a given number
max
Returns the larger of the two given numbers
min
Returns the smaller of the two given numbers
sqrt
Returns the square root of a given number
rand
Returns a random float between 0.0 and 1.0
fact
Returns the factorial of a given number