Scripting Variables

See scripting and scripting variables for more information. Also, see The RepRap Wiki for more information about GCode commands.

Some of these examples include spaces or tabs in front of lines of GCode. The Pathio team has not tested whether all firmwares for all printers will correctly handle lines of GCode that start with a whitespace character. If you have problems, try removing those tabs and spaces from the scripts.

Pause for filament change

This example would be put in your layer change script. It’ll activate at a particular layer height, and tell your printer to pause.

{% if state/next_Z == 10.0 % }  (1)
    M600                        (2)
    M109 S{{ nozzle_temp_0 }}   (3)
    G28 X Y                     (4)
{% endif %}                     (5)
1 When the next layer will be 10.0mm
2 Pause and wait for filament change
3 Double-check you’re at temperature
4 Home X and Y to avoid layer shifts
5 Keep printing normally

Advanced Tool Change Script

This examples would go in your tool change script. It lets you specify special actions when switching to and from each toolhead on your printer. This was drafted for use on the E3D ToolChanger, and was originally meant to combat a bug in Pathio where retraction and unretraction values weren’t stored per toolhead.

{% if state/active_toolhead == 0 %}     (1)
    {% if state/next_toolhead == 1 %}   (2)
        G1 E-3                          (3)
    {% endif %}
    {% if state/next_toolhead == 2 %}   (4)
        G1 E-3
    {% endif %}
    {% if state/next_toolhead == 3 %}
        G1 E-3
    {% endif %}
{% endif %}

{% if state/active_toolhead == 1 %}     (5)
...
{% endif %}
1 Check which toolhead you’re switching from.
2 Check which toolhead you’re switching to.
3 Do something when switching from toolhead 0 → 1. In this case, we’re doing some extra retraction.
4 Now, specify what happens if we’re switching from toolhead 0 → 2…​
5 Now, specify what happens if we’re switching from toolhead 1 → another toolhead.

Set Tool Idle Temperature

This example would be put in your layer change script. It allows sets the newly-inactive tool to hold an idle temperature.

M104 S{{idleNozzleTemperature}}  (1)
T{{state/next_toolhead}}         (2)
M109 S{{state/next_nozzle_temp}} (3)
1 Set the currently active nozzle to it’s standby temperature.
2 Switch to the newly-activated toolhead.
3 Bring the newly-activated toolhead up to printing temperature (it should have been set to its lower idle temperature).