I converted my Scantek 2000 CNC lathe to work via Parallel port control (for Mach3/LinuxCNC software control) and have been learning how to hand write gcode (because the Linux compatible CAM lathe software options are not terribly good).

Unfortunately, the LinuxCNC software doesn’t support many of the automated cycles (G71 I’m looking at you!) for lathe turning (yet!), so I had to write up a gcode file with many manual G1 passes to cut down the cone shape you see here.

Instead of hand coding the whole thing, I wrote a small python script that automated the gcode generation, which takes 0.2 mm passes off the stock, stopping 0.5mm shorter each time from 10mm down to 5mm radius. But I did the first few by hand….

Here is a video of the process in action:

And below is the full gcode file for those who care….

(Lathe Demo)

(Stock dia 20mm, radius 10mm)

(z-zero is 12mm from jaw face minimum)

```
```N100 (Sequence Number)

G18 (X and Z for lathe plane)

M3 S2500 (Start Spindle at 2500 RPM)

G8 (Radius mode)

G0 X10. Z1. (Start position, 10mm out from center, 1mm from face.)

(M1 Optional Stop)

G1 Z-12. F200.

G0 X10.1

G0 X10.1 Z1.

G0 X9.75 Z1.

G1 Z-11.5

G0 X10.1

G0 X10.1 Z1

G0 X9.5 Z1.

G1 Z-11.0

G0 X10.1

G0 X10.1 Z1

G0 X9.25 Z1.

G1 Z-10.5

G0 X10.1

G0 X10.1 Z1

G0 X9.0 Z1.

G1 Z-10.0

G0 X10.1

G0 X10.1 Z1

G0 X8.75 Z1.

G1 Z-9.5

G0 X10.1

G0 X10.1 Z1

G0 X8.5 Z1.

G1 Z-9.0

G0 X10.1

G0 X10.1 Z1

G0 X8.25 Z1.

G1 Z-8.5

G0 X10.1

G0 X10.1 Z1

G0 X8.0 Z1.

G1 Z-8.0

G0 X10.1

G0 X10.1 Z1

G0 X7.75 Z1.

G1 Z-7.5

G0 X10.1

G0 X10.1 Z1

G0 X7.5 Z1.

G1 Z-7.0

G0 X10.1

G0 X10.1 Z1

G0 X7.25 Z1.

G1 Z-6.5

G0 X10.1

G0 X10.1 Z1

G0 X7.0 Z1.

G1 Z-6.0

G0 X10.1

G0 X10.1 Z1

G0 X6.75 Z1.

G1 Z-5.5

G0 X10.1

G0 X10.1 Z1

G0 X6.5 Z1.

G1 Z-5.0

G0 X10.1

G0 X10.1 Z1

G0 X6.25 Z1.

G1 Z-4.5

G0 X10.1

G0 X10.1 Z1

G0 X6.0 Z1.

G1 Z-4.0

G0 X10.1

G0 X10.1 Z1

G0 X5.75 Z1.

G1 Z-3.5

G0 X10.1

G0 X10.1 Z1

G0 X5.5 Z1.

G1 Z-3.0

G0 X10.1

G0 X10.1 Z1

G0 X5.25 Z1.

G1 Z-2.5

G0 X10.1

G0 X10.1 Z1

(Final Exit)

G0 X10.1 Z20

`M5 (Stop Spindle)`

M30