Machining cycle
Sphere turning on a CNC lathe
Spherical and concave profiles, including grooved pulley profiles
A clickable cycle form: tap any field to see what it does.


Cycle form: external sphere shown — sphere diameter and its position on the workpiece, live 2D toolpath simulator on the right.
The sphere cycle calculates the tool path along an arc of the given radius, supporting both convex and concave profiles.
Who needs this cycle
Needed for parts with a spherical or concave working surface — for example, grooved pulleys or spherical tips.
Key form parameters
- •Sphere radius
- •Workpiece diameter
- •Convex/concave profile
- •Feed rate
- •Spindle speed
G-code example
Real output of the Sphere cycle: a Ø15 mm blank becomes a Ø10 mm ball on a Ø8 mm shank with a flat Ø6 mm front face; the ball centre is at Z−5. Roughing at 0.5 mm per side, 0.2 mm allowance, plunge feed 40 mm/min, turning 80 mm/min, along the sphere 60 mm/min, 300 rpm. The code lines were not edited by hand.
Radius mode G8: X is half the diameter. The Ø10 ball is radius 5, the Ø8 shank is X4, the Ø6 front face is X3, the Ø15 blank is X7.5.
Roughing passes first remove material as cylinders, going around the ball zone: a short section in front of the sphere and the shank behind it. Then one arc pass with allowance and a finishing arc pass to exact size.
sphere.ngc · 153 lines — Show the full program
%
(Turn G-code)
(External sphere / oval)
(Sphere-L sets the profile length in Z independently of Ø.)
(Stock Ø: 15.0000)
(Sphere Ø: 10.0000)
(Sphere-L: 10.0000)
(Roughing length L: 30.0000)
(Cut Z set: 20.0000)
(Profile cut Z: 10.0000)
(Cut X front stub: 3.0000)
(Shank X rear stub: 4.0000)
(Sphere F: 60.0000)
(Allowance: 0.2000)
(Depth per pass: 0.5000)
(Allowance profile end X4.0000 Z-8.5496)
(Finish profile end X4.0000 Z-8.0000)
G21 G18 G90 G8 G40 G80 G94
G54
G97 S300 M3
G0 Z3.0000
G0 X16.0000
(Roughing pass 1 of 15)
(Roughing X7.0000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
G0 X16.0000
G0 Z0.0000
G1 X7.0000 F40.0000
G1 Z-30.0000 F80.0000
G0 X16.0000
(Roughing pass 2 of 15)
(Roughing X6.5000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
G0 X16.0000
G0 Z0.0000
G1 X6.5000 F40.0000
G1 Z-30.0000 F80.0000
G0 X16.0000
(Roughing pass 3 of 15)
(Roughing X6.0000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
G0 X16.0000
G0 Z0.0000
G1 X6.0000 F40.0000
G1 Z-30.0000 F80.0000
G0 X16.0000
(Roughing pass 4 of 15)
(Roughing X5.5000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
G0 X16.0000
G0 Z0.0000
G1 X5.5000 F40.0000
G1 Z-30.0000 F80.0000
G0 X16.0000
(Roughing pass 5 of 15)
(Roughing X5.0000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
G0 X16.0000
G0 Z0.0000
G1 X5.0000 F40.0000
G1 Z-3.0000 F80.0000
G0 X16.0000
(Shank X: shank pass X5.0000 from Z-7.0000 to Z-30.0000)
G0 Z-7.0000
G1 X5.0000 F40.0000
G1 Z-30.0000 F80.0000
G0 X16.0000
(Roughing pass 6 of 15)
(Roughing X4.5000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
G0 X16.0000
G0 Z0.0000
G1 X4.5000 F40.0000
G1 Z-2.0760 F80.0000
G0 X16.0000
(Shank X: shank pass X4.5000 from Z-7.9240 to Z-30.0000)
G0 Z-7.9240
G1 X4.5000 F40.0000
G1 Z-30.0000 F80.0000
G0 X16.0000
(Roughing pass 7 of 15)
(Roughing X4.0000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
G0 X16.0000
G0 Z0.0000
G1 X4.0000 F40.0000
G1 Z-1.4504 F80.0000
G0 X16.0000
(Shank X: shank pass X4.0000 from Z-8.5496 to Z-30.0000)
G0 Z-8.5496
G1 X4.0000 F40.0000
G1 Z-30.0000 F80.0000
G0 X16.0000
(Roughing pass 8 of 15)
(Roughing X3.5000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
G0 X16.0000
G0 Z0.0000
G1 X3.5000 F40.0000
G1 Z-0.9813 F80.0000
G0 X16.0000
(Roughing pass 9 of 15)
(Roughing X3.0000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
G0 X16.0000
G0 Z0.0000
G1 X3.0000 F40.0000
G1 Z-0.6182 F80.0000
G0 X16.0000
(Roughing pass 10 of 15)
(Roughing X2.5000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
(Roughing pass 11 of 15)
(Roughing X2.0000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
(Roughing pass 12 of 15)
(Roughing X1.5000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
(Roughing pass 13 of 15)
(Roughing X1.0000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
(Roughing pass 14 of 15)
(Roughing X0.5000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
(Roughing pass 15 of 15)
(Roughing X0.2000: L=30.0000, CutZ=10.0000, Sphere-L=10.0000, CutX=3.0000, Shank X=4.0000)
(Profile pass with allowance)
(G3 sphere: offset 0.2000; R5.2000)
G0 X16.0000
G0 Z-0.6182
G1 X3.0000 F40.0000
G3 X4.0000 Z-8.5496 I-2.8000 K-4.3818 F60.0000
G0 X16.0000
(Finishing spindle speed)
S300
(Finish pass 1 of 1)
(G3 sphere: offset 0.0000; R5.0000)
G0 X16.0000
G0 Z-1.0000
G1 X3.0000 F40.0000
G3 X4.0000 Z-8.0000 I-3.0000 K-4.0000 F60.0000
G0 X16.0000
G0 X16.0000
G0 Z3.0000
M5
M30
%Line-by-line breakdown
G21 G18 G90 G8 G40 G80 G94- Start: millimetres, XZ plane, absolute coordinates, radius mode for X (G8), cancel compensation and canned cycles, feed in mm/min.
G0 Z0.0000 / G1 X7.0000 F40.0000 / G1 Z-30.0000 F80.0000- The first roughing passes (X7.0, X6.5, X6.0, X5.5) are plain cylinders over the full 30 mm: the Ø10 ball is still entirely inside these diameters.
G1 X5.0000 … G1 Z-3.0000 / G0 Z-7.0000 … G1 Z-30.0000- From the X5.0 pass on, the tool goes around the ball: it turns in front of it to Z−3, skips the sphere zone and continues the shank from Z−7 to Z−30. The skipped zone then gets wider: Z−2.076…−7.924 for X4.5 and Z−1.450…−8.550 for X4.0.
(Roughing pass 10 of 15) … (Roughing pass 15 of 15)- Passes 10–15 are output as comments only, with no motion: they are below X3 — the radius of the Ø6 front face — so there is nothing to cut.
G0 Z-0.6182 / G1 X3.0000 / G3 X4.0000 Z-8.5496 I-2.8000 K-4.3818 F60.0000- Profile pass with a 0.2 mm allowance: a G3 arc of radius 5.2 from the front face (X3) to the shank (X4). I and K are the offset of the arc centre from the start point, which puts the centre at X0.2, Z−5.
G0 Z-1.0000 / G1 X3.0000 / G3 X4.0000 Z-8.0000 I-3.0000 K-4.0000 F60.0000- Finishing pass: the same arc with radius 5, centre at X0, Z−5 (3 − 3 = 0, −1 − 4 = −5). The Ø10 ball comes out to exact size — from the Ø6 face at Z−1 to the Ø8 shank at Z−8.
M5 / M30- Spindle stop and program end.
Comments in this program were translated from Russian; the G-code itself is unchanged.
What the codes in this program mean (G0, G1, G3, G8, M3, M5) — G- and M-code reference for lathes.
Frequently asked questions
Does the cycle only support convex profiles?
No, the cycle supports both convex and concave profiles — for example, for spherical tips or grooved pulleys.
How is the sphere shape set?
Through the sphere radius and the workpiece diameter — the cycle builds the tool's arc path from these parameters.
What parts is this cycle for?
Parts with a spherical or concave working surface — spherical tips, grooved pulleys, and similar shapes.
Can I preview the toolpath before generating the G-code?
Yes, the cycle form shows a live 2D toolpath simulator for the arc path.
