GCode Macros
Variable Substitutions and Expressions in GCode Macros
current set of variable substitutions
All Modes "pre" and "post" (header/footer)
    {top} = offset in mm of bed top Y axis
    {left} = offset in mm of bed left X axis
    {right} = offset in mm of bed right X axis
    {bottom} = offset in mm of bed bottom Y axis
All Modes "post" (footer)
    {time} = job run time (printing/milling) in seconds (fractional)
    {print-time} = alias for {time} ... deprecated after 2.8
    {print_time} = alias for {time} ... 2.9 and beyond
3D printing / FDM
"pre", "post", and other macros
    {temp} = hot end temperature
    {bed_temp} = bed temperature
    {fan_speed} = active cooling fan speed (usually 0-255)
    {material} = length in mm of material (filament) used
    {layers} = total # of layers
    {layer} = current layer number
    {height} = current layer height in mm
    {range(from,to)} = evaluated using {layer} and {layers}
    {z_max} = max build height in mm
    {z} = current z position
    {e} = amount of filament extruded
Anything inside {} will be evaluated using full expressions including use of Javascript's internal classes and methods. Example: {Math.min(layer/layers, 0.5) + 1}
    {tool} = CAM tool #
    {tool_name} = CAM tool name
    {time} = dwell time in seconds
    {time_ms} = dwell time in milliseconds
    {time_sec} = dwell time in seconds
    {speed} = spindle speed
    {spindle}, {rpm} = spindle speed (v2.7+)
simple algebraic expressions supported in the form
    {token+n} {token-n}
Last modified 3mo ago
Copy link