Hi,
quite commonly the first line of code at the top of a Gcode job will have a long string of codes, something like:
G15 G17 G40 G90 G94 G54 G49 G99 G64........to which you can append a G20 for inch unit Gcode or G21 fro mm unit
Gcode. You could just as easily code it on its own line right at the top of the file.
I'll leave you to work out what all and each of those codes are but they set the machine up, G17 for instance declares
the XY plane with Z vertical, ie a VMC. You could use G18 which declares XZ plane with Y as spindle axis, ie a horizontal
milling machine.
The codes are all 'modal', that is that once set they stay in force until they are changed or overwritten by a new code.
Thus when you have finished the metric Gcode job you need to switch it back to inch units with a G20, otherwise you will
get a surprise the next time you use the machine.
It is common for CAD/CAM programs to include a G20/G21 command at the beginning of the file so that the machine
correctly interprets the units that the CAD/CAM package used.
Try and find a copy of:
'CNC Programming Hanbook', any edition, by Peter Smid. Its considered the bible of CNC Gcode.
Craig