Like many new forums, the excitement and

Hey J, hey all,

you can define the machine’s behaviour at every tool change event (M6) in the General Configuration Tab of the Onefinity Controller -

G code insertion at Tool Change :

Insertions of sequences of ‘G’ and/or ‘M’ codes are possible at the beginning, at the end, and during tool changes. It is often helpful to add comments to the commands. Comments are enclosed in parentheses. Some commands cause program execution to pause and wait for the user to take action before resuming execution. When the characters ‘MSG,’ are entered at the beginning of the comment, the remainder of the comment is presented to the user in an “action dialog”. This helps instruct the user on what action to take before resuming execution.

The “tool-change” entry box contains commands that are run every time an M6 (tool change) command is encountered. By default, the “tool-change” entry box contains the following commands:

(Runs on M6, tool change)
M0 M6 (MSG, Change Tool)

These commands simply pause execution and prompt the user to change the tool.

The following example provides a set of commands that can be used to change the tool and then set the height of the z-axis after the tool change. This example assumes the use of a 0.75” (19.05mm) touch plate like the one shown here.

(Runs on M6, tool change)
M0 (MSG, Change tool and attach probe)
G38.2 Z-100
G92 Z19.05
G0 Z25
M0 (MSG, Remove probe)

M70 tells the controller to save its current state (e.g. feed rate, distance mode, and units) so it can be recovered after the sequence is completed.

G21 tells the controller to operate in Metric units.

G0 Z100 raises the tool to 100mm so the tool can be replaced.

M0 (MSG, Change tool and attach z-probe) - The comment starts with ‘MSG,’ so the text “Change tool and attach z-probe” is presented to the user in the action dialog.

F100 says that the feed rate will be 100 mm/minute. This feed rate should be slow to prevent jamming the bit into the surface of the probe. Ideally, the search will stop at the instant that the bit touches the probe.

G91 puts the machine in “incremental distance mode” so it will probe downward by 100mm or until the probe is found in the next command.

G38.2 Z-100 tells the machine to move towards the probe and stop when the probe surface is found. If the search reaches Z = -100 without finding the probe surface, the search will stop and the probing command fails.

G92 Z19.05 sets the z axis to 19.05mm, which is the height of the probe base being used in this example.

G0 Z25 tells the machine to move up to Z = 25 so the probe can easily be removed.

M0 (MSG, Remove probe) reminds the user to remove the probe and waits for the user to click “Continue” to resume execution of the GCode program.

M72 restores the original state (e.g. feed rate, distance mode, and units) that existed at the beginning of the tool change procedure.

– Source: Buildbotics Controller Manual (Note: Onefinity Controller is a fork of Controller.)



Unlike the touch plate shown above, the Onefinity (Triquetra) Touch Probe is 15.4 mm high instead, therefore you need to replace “Z19.05” by “Z15.4” in the example above.)



There exists a better, updated ‘tool-change’ routine (which by the way also honors tool number).

Razi Ullah’s ‘tool change’ script



This script is lacking a G91 (set incremental distance mode) before the G38.2 probing command. Better use my updated ‘tool-change’ routine (which by the way also honors tool number).

Tags: tool change, tool changer, tool changers, tool changing, G codes, M codes, gcode