FIFTY LINETurn G-code

Which CNC controls Turn G-code works with: 90% of controls and one exception

· ~9 min read

Turn G-code was built on LinuxCNC, but it writes plain G-code - the language most CNC lathe controls understand. By our estimate, the program can be used on roughly 90% of controls that work with ISO G-code. But not on all of them: there is a family of controls it is not suitable for, and it is better to know that before you buy. Here is why the code is portable, what you can set up for your control, and where the line is.

Contents

  1. Why Turn G-code output is portable
  2. What you can set up for your control
  3. Compatibility by control
  4. The exception: Fanuc System A, Haas, GSK, KND
  5. Which controls will not work
  6. How to find your control’s G-code system
  7. First run on a new control
  8. What has been tested in practice

Why Turn G-code output is portable

1. Only basic codes. We collected every code from the 12 real programs on the cycle pages. Here is the complete list:

Code What it does Where it appears
G0, G1 Rapid, feed move All cycles
G3 (with I/K) Arc Sphere, chamfer/radius
G32 or G33 Threading move synchronized with the spindle Threading, taper threading, spiral
G21 / G20 Millimeters / inches Start line
G18, G40, G80 XZ plane, cancel compensation and cycles Start line
G90, G94 Absolute coordinates, feed in mm/min Start line
G54-G59 Work coordinate system Program start
G97, S Constant RPM All cycles
M3, M5, M30 Spindle, program end All cycles

This is the core of ISO 6983 / RS-274 - the common language of nearly all controls.

2. No canned cycles. The program does not use G71, G72, G76, G92 or similar cycles. Cycles are exactly what differs between controls: G76 in LinuxCNC is one line with its own letters, on Fanuc it is two lines with different addresses. Turn G-code writes every pass as explicit G0/G1/G32/G33 moves, and those are the same everywhere.

3. Constant RPM. The program does not use G96 with an RPM limit, which every control sets differently (D in LinuxCNC, G50 S on Fanuc, LIMS on Siemens).

What you can set up for your control

Differences between controls are handled by switches in the program - set once, for all 12 cycles:

Control difference Turn G-code setting
X as diameter or radius G7/G8 button
Control does not know G7/G8 (Fanuc, Haas) “Output G7/G8” checkbox - off, G7 mode
Threading with G32 or G33 G32/G33 button
Thread pitch letter K, F or I Pitch letter choice
Coolant is not M8/M9 Coolant codes window - any M-codes you need
Control does not like comments “Comments in program” checkbox
Tool number, M30 at the end Output checkboxes
File extension (.ngc, .nc, .tap…) Extension field
Metric / inch mm / inch switch
Coordinate system G54-G59

Compatibility by control

Control How it works What to set
LinuxCNC Directly - it is the program’s native control Nothing
Tormach PathPilot (based on LinuxCNC) LinuxCNC syntax G7/G8 mode to match the machine
grblHAL in lathe mode Syntax close to LinuxCNC (G7/G8, G33) G7/G8 mode, threading G33 K
Fanuc System B / C G90 is absolute, G94 is mm/min, same as LinuxCNC G7, G7/G8 output off, threading G33 or G32 with letter F
Syntec, Siemens (ISO mode), Mitsubishi and other controls with a selectable code system Depends on the selected system: B/C works, A does not Same as Fanuc B/C
Fanuc System A, Haas, GSK, KND Not supported See below
Mazatrol, Heidenhain Klartext Their own conversational languages, not ISO Only in the control’s ISO/EIA mode, if it has one

The exception: Fanuc System A, Haas, GSK, KND

Fanuc controls have three “G-code systems” - A, B and C. Which one is active is set by a machine parameter during commissioning, not by the program. On lathes the most common one is System A. Haas and the Chinese GSK and KND follow it too.

In System A several basic codes mean something completely different:

Code In LinuxCNC and Fanuc B/C In Fanuc System A, Haas, GSK, KND
G90 Absolute coordinates OD turning cycle
G94 Feed in mm/min Facing cycle
G98 - Feed in mm/min
G99 - Feed in mm/rev
Absolute / incremental G90 / G91 Letters X, Z / U, W

The Turn G-code start line contains G90 and G94:

G21 G18 G90 G40 G80 G94

For System A these are not “absolute coordinates and feed per minute” but cycle codes. The main danger is the feed. System A lathe controls usually run in G99 - feed in mm per revolution, so the line

G1 Z-20 F100

written as “100 mm/min” is read as 100 mm per revolution. At 500 RPM that is 50,000 mm/min - the control clamps it to its maximum cutting feed, and the tool enters the metal at the machine’s full speed. A broken insert, a scrapped part, and a risk to the holder, the chuck jaws and the operator.

So Turn G-code is not supported on System A controls (Fanuc A, Haas, GSK, KND). These are the 10% that are not part of our 90%. If you are an experienced setter who understands the difference between the systems, you can edit the program by hand - replace G94 with G98 in the start line and remove G90 - but that edit is at your own risk and we do not guarantee it.

Which controls will not work

Not supported at all - controls using G-code system A:

  • Fanuc with System A enabled - the factory setting of most Fanuc lathe controls (0i-T, 0i-TD, 0i-TF, 18i-T, 21i-T series and others);
  • Haas - all lathes (ST, DS, TL series);
  • GSK - lathe controls (for example, the 980T series);
  • KND - lathe controls;
  • Syntec, Siemens in ISO mode, Mitsubishi and any other controls when G-code system A is selected on them.

Not suitable for other reasons:

  • Mazatrol (Mazak) and Heidenhain Klartext - their own conversational languages, not ISO G-code. Turn G-code only fits if the control has a separate ISO/EIA mode, and that mode is not system A.
  • Siemens SINUMERIK in native mode - metric is set with G71 instead of G21, and comments are written with “;”. You need the control’s ISO mode.
  • Classic grbl without a lathe mode - it does not know G7/G8 or the G33 synchronized move.

Threading and spirals will not work on a machine without a spindle encoder - on any control. The threading, taper threading and Archimedean spiral cycles use the G32/G33 threading move, which needs spindle position feedback. The other 9 cycles do not need an encoder.

How to find your control’s G-code system

  • Open the G-code list in your machine’s programming manual. If G90 is listed as an “outer diameter cutting cycle” and feed per minute is G98, it is System A.
  • If G90 is “absolute coordinates” and G94 is “feed per minute”, it is System B or C (or a control close to LinuxCNC).
  • On Fanuc the system is selected by a machine parameter; if in doubt, ask your setter or the machine supplier.
  • Haas, GSK, KND lathes work like System A by default.

First run on a new control

On any control other than LinuxCNC, run the first Turn G-code program carefully:

  1. Read the code: the start line, the thread pitch letter, the M-codes.
  2. Check it in the control’s graphics - the path should match the Turn G-code 2D simulator.
  3. “Cutting air” run: tool retracted, feed override at minimum, single block mode, hand on the emergency stop.
  4. First pass in metal at a reduced feed.

The user agreement requires the same: a “cutting air” run is mandatory before the first run of every program.

What has been tested in practice

To be honest about what this estimate is based on:

  • LinuxCNC - verified by cutting metal on the author’s machine (most cycles; each one’s status is on its page).
  • Other controls - compatibility by G-code syntax: the program only outputs codes these controls read the same way as LinuxCNC. If you have run Turn G-code on another control, tell us on the forum - we will add it to the table.

More on the codes in the G-code and M-code reference for lathes, on diameter and radius in G7 and G8, and on threading in Threading in LinuxCNC.

Download Turn G-code and try it on your control - 15 days free, no key needed.

← All articles