As always reference the LinuxCNC manuals and the LinuxCNC Wiki for more information.

NGCGUI Snippets

Tool Change

This conditional checks to see that the tool needed for this subroutine is not equal to the current tool. The variable #5400 contains the current tool. If the tool requested is not loaded then the tool change is performed.

o100 if [#<tool> NE #5400]
  T#<tool> M6 G43
o100 endif

Last Operation

This conditional checks to see if this is the last operation. If it is then move to the safe position.

o200 if [#<last_op> EQ 1]
  G53 G0 X0 Z0
o200 endif