Lathe G-codes
The FluidBoard brings your lathe up to the level of industrial controllers. Threading, constant surface speed, feed per revolution, and diameter programming — all built in. These are the features that separate a real CNC lathe from a stepper-driven spindle with some G-code support.
All threading and synchronization features require a spindle encoder.
Threading
Single-pass threading (G33)
Cuts one synchronized threading pass. The axis moves in rigid lockstep with the spindle — if the spindle speeds up, the axis speeds up with it.
G33 Z-30 K1.5 ; Cut to Z-30 with 1.5mm pitch
K = thread pitch in mm per revolution
- Motion is rigidly synchronized to the spindle encoder
- Feed override is disabled during the cut
- The controller waits for the spindle index pulse before starting, so every pass begins at the same angle
Multi-pass threading cycle (G76)
An automated cycle that handles depth progression, compound infeed, and spring passes — the same workflow used on industrial lathes.
G76 P1.5 Z-30 J0.3 K0.92 Q29.5 H2 R1
| Parameter |
Meaning |
| P |
Thread pitch (mm/rev) |
| Z |
Thread end position |
| J |
First cut depth |
| K |
Full thread depth |
| I |
Taper amount (0 for straight threads) |
| Q |
Compound infeed angle (29.5° for metric) |
| H |
Number of spring passes at final depth |
| R |
Degression: 1 = constant chip area, 2+ = constant depth |
Each pass automatically: rapids to the next depth, cuts synchronized to Z end, retracts, and returns. The cycle repeats until full depth, then runs spring passes for a clean finish.
Constant surface speed (G96 / G97)
When turning a face or taper, the cutting diameter changes — and with it the surface speed at the tool tip. G96 keeps the surface speed constant by automatically adjusting RPM as you cut toward or away from center.
G96 S150 ; 150 m/min surface speed
G50 S3000 ; Cap RPM at 3000 (safety limit near center)
G1 X0 F0.1 ; Face cut — RPM increases as X approaches center
G97 ; Back to constant RPM mode
Consistent surface speed means consistent chip load, better surface finish, and longer tool life. Every real lathe controller has this.
Configuration
Add this to your machine YAML:
css_axis: X # Which axis is the cutting radius (X for lathes)
Feed per revolution (G95)
In standard mode (G94), feed rate is in mm/min. In G95 mode, feed rate is in mm per spindle revolution. The chip load stays constant regardless of RPM — which is how machinists actually think about lathe cutting.
G95 ; Feed per revolution mode
G1 Z-50 F0.15 ; 0.15 mm per revolution
G94 ; Back to feed per minute
Feed override is still available in G95 mode.
Diameter mode (G7 / G8)
On most lathe controllers, X values represent diameter, not radius. G7 enables this convention:
G7 ; Diameter mode — X20 means 20mm diameter (10mm radius)
G8 ; Radius mode — X20 means 20mm radius (default)
This means standard lathe G-code and post-processors work without modification.
Quick reference
| G-code |
What it does |
| G33 |
Single-pass synchronized threading |
| G76 |
Multi-pass threading canned cycle |
| G96 |
Constant surface speed (S in m/min) |
| G97 |
Constant RPM mode (default) |
| G50 S# |
Max RPM limit for CSS |
| G95 |
Feed per revolution |
| G94 |
Feed per minute (default) |
| G7 |
Diameter programming mode |
| G8 |
Radius programming mode (default) |
Next steps
Set up your tool table to manage multiple tools, or learn about cutter radius compensation to program part geometry directly.