← Back to CNC Programming

Worked Project: Stepped Shaft

A Ø40×100 mm bar stock, faced to establish Z0, then rough-turned and finish-turned to a two-step profile (Ø30 and Ø36). This project covers facing, setup, Haas single-line G71 roughing, and G70 finishing.

Level: KScope: Haas lathe examples; metric diameter programmingPrerequisite: Turning Roughing and Finishing Cycles
After this lesson, you can:

Concept

We machine the front end of a Ø40×100 bar. The finished part has two diameters: Ø30 from Z0 to Z−20, and Ø36 from Z−20 to Z−40. We do not part off or turn the back — this setup completes only the front contour.

Concept
ItemClassroom model
Raw stockØ40 × 100 mm; axial range Z−99 to +1
Finished datumFinal face at Z0 (1 mm stock to remove from original face at +1)
Chuck jaw frontZ−55; gripping from Z−99 to Z−55 (44 mm grip length)
Original projection56 mm from jaw front to stock end; 55 mm after facing
Front sectionØ30, Z0 to Z−20
Rear sectionØ36, Z−20 to Z−40
Retained zoneZ−40 to Z−55 (15 mm gap, not machined)
TolerancesØ30/Ø36 ±0.05; shoulder position ±0.10

Tool: T0101, a right-hand turning/facing tool with 0.4 mm nose radius. X is programmed in diameter. The virtual tool tip defines the geometry offset; the actual r0.4 nose leaves a small radius at the shoulder root — this is allowed and is not a sharp internal corner.

Why It Matters

The facing operation is not optional: it establishes the axial datum (Z0). If you skip facing and set Z0 on the rough stock face at +1, every axial dimension is off by 1 mm. The 44 mm grip length and 55 mm projection are classroom geometry assumptions — real gripping force, jaw envelope, and toolholder clearance must be verified on the actual machine.

Diagram accompanying the adjacent worked example. Read the accompanying explanation for assumptions and values.Diagram accompanying the adjacent worked example Setup geometry (px=440+4Z, radial 2px/mm) CHUCK (grip Z-99 to Z-55) Ø40 stock Ø36 Ø30 Z0 (face) orig Z+1 Z-55 jaw Z-40 Z-20
Why It Matters — read the adjacent example for the stated conditions.

How It Works

Two Facing Cuts

We take two 0.5 mm facing passes to remove the 1 mm stock from the original face at Z+1 down to Z0:

  1. Approach at X42 Z2 (outside the stock).
  2. Feed to Z0.5, then face from X42 to X−0.5 (0.5 mm cut).
  3. Retract +Z to 2, then return X42 (do not radial-retract in the cut).
  4. Feed to Z0, face from X42 to X−0.5 (remaining 0.5 mm).
  5. Retract +Z to 2, return X42, ready for roughing.

At S1000 and F0.10 mm/rev, ideal feed = 100 mm/min. Each facing pass traverses X42.5 radially (21.25 mm actual radius), taking about 12.75 seconds of ideal cutting time — not including acceleration, approach, or center-cutting effects.

Haas Single-Line G71 Roughing

We use the Haas single-line format:

G71 P10 Q20 D1.0 U0.4 W0.1 F0.20

The P-Q contour defines the finished shape (Type I, no grooves):

N10 G00 X30.
G01 Z0. F0.10
Z-20.
X36.
Z-40.
N20 X42.

G70 Finishing

After G71, the same T0101 runs G70 at S1200 to cut the finished profile at F0.10. Rough diameter after G71: Ø30.4 and Ø36.4 (U0.4 diameter allowance). Final: Ø30 and Ø36.

Diagram accompanying the adjacent worked example. Read the accompanying explanation for assumptions and values.Diagram accompanying the adjacent worked example Nose Radius at Shoulder (r0.4, local enlargement: 20px = 0.4mm) tangent tangent r0.4 virtual tip
G70 Finishing — read the adjacent example for the stated conditions.

Clearance and Retraction

After machining, retract in two axes: first to X100 (clear of OD), then to Z100 (away from chuck). These X100/Z100 numbers are classroom safe positions for this model — verify on your machine. The toolholder's rearward Z envelope is 8 mm, so at Z−40 the tool body reaches Z−48, leaving 7 mm to the jaw front at Z−55.

Diagram accompanying the adjacent worked example. Read the accompanying explanation for assumptions and values.Diagram accompanying the adjacent worked example G71 Type I Roughing (X-Z schematic, r=X/2) Z r Stock r=20 (Ø40) r15 (Ø30) r18 (Ø36) Z0 Z-20 Z-40 Selected cutting segments (not full G71 simulation) W0.1 = 0.1mm axial finish stock
Clearance and Retraction — read the adjacent example for the stated conditions.

Setup Procedure Summary

  1. Mount raw Ø40 bar in 3-jaw chuck, project 56 mm from jaw face.
  2. Install T0101 right-hand turning tool in turret station 1.
  3. Set G54: X offset at bar center (touch off OD and set diameter), Z offset by touching the original rough face and entering Z+1 (the facing program then cuts 1 mm to reach Z0).
  4. Set T0101 geometry offsets: X and Z geometry for the virtual tool tip, plus nose radius 0.4 and tip direction number (for this right-hand OD tool, direction 3). Wear offsets are adjusted during inspection.
  5. Test air cut at rapid override 25% before full run.
  6. Face, then run G71 roughing, inspect diameters, then G70 finishing.

Example: Complete Program

O0027 (STEPPED SHAFT PROJECT)
G21 G18 G97 G99
T0101 (RIGHT-HAND TURNING/FACING TOOL, R0.4)
G54 S1000 M03

(FACING PASS 1 - REMOVE 0.5mm)
G00 X42. Z2.
G01 Z0.5 F0.10
G01 X-0.5
G00 Z2.
G00 X42.

(FACING PASS 2 - REMOVE REMAINING 0.5mm TO Z0)
G01 Z0 F0.10
G01 X-0.5
G00 Z2.
G00 X42.

(ROUGHING CYCLE)
G71 P10 Q20 D1.0 U0.4 W0.1 F0.20
N10 G00 X30.
G01 Z0. F0.10
Z-20.
X36.
Z-40.
N20 X42.

(FINISHING CYCLE)
S1200 M03
G70 P10 Q20

(RETRACT)
G00 X100.
G00 Z100.
M05
M30

Why a Stepped Shaft Teaches the Whole Machine

This single part touches almost every turning concept: diameter programming (X is the finished diameter, twice the radius), G18 XZ plane, G97 constant-RPM roughing, G71 stock removal, G70 finish pass, nose radius compensation, and two-axis retract in the correct order. The two diameters create a 90° shoulder that exposes the most common beginner error: cutting the shoulder with a tool whose nose radius leaves a blend or an undercut. The r0.4 insert does not produce a sharp corner; it leaves a 0.4 mm radius at the shoulder root, which the drawing must either specify or permit as a default break.

The facing step deserves extra attention. Many beginners treat facing as a quick cleanup pass, but it is the operation that establishes Z0. If the tool touches the rough stock face at Z+1 and the program assumes Z0 at that face, every axial dimension — the position of the shoulder, the length of the Ø30 section, the total length — is off by 1 mm. Facing to Z0 and then touching off at that fresh face is the engineering habit that prevents a whole class of axial errors.

After G71 finishes, the part is not yet done: there is 0.4 mm of diameter stock (U0.4) and 0.1 mm of axial stock (W0.1) left on the profile. G70 at S1200 removes that stock in one clean pass. Running G70 at the roughing speed would tool-wear the finish pass; running G71 at the finish speed would chatter. Speed is chosen per operation, not per machine.

On the first part, measure the Ø30 and Ø36 diameters with a micrometer, then measure the shoulder position with a height gauge or a DTI on a surface plate. If the diameters are uniformly small by 0.05 mm, enter +0.05 in the X wear field (per your control's sign convention); if the shoulder is off in Z, adjust Z wear. Do not change G54 to correct a diameter size — G54 shifts the whole part, while a diameter error is a tool-wear or deflection issue.

Tooling for This Project

T0101 is a right-hand external turning/facing tool with a 0.4 mm nose radius, as introduced at the top of this page. The insert grade and holder are classroom assumptions for mild-steel (1018/A36) bar; real insert selection must follow the tooling catalog for your material and machine. X is programmed in diameter, so the finished front section is X30 and the rear section is X36. The raw stock is Ø40, gripped at Z−99 to Z−55, projecting to Z−40.

Facing uses the same tool: approach X42 Z2, feed to Z0.5, face from X42 to X−0.5, retract Z2, return X42, then repeat at Z0. The two 0.5 mm facing passes establish Z0 at the faced face. S1000 and F0.10 mm/rev are starting values; adjust to the insert manufacturer's chart.

Roughing with G71 uses U0.4 as the diameter finish allowance (not the depth per pass; the depth is set by the G71 depth parameter D on Haas lathes) and W0.1 axial finish allowance. The contour N10–N20 describes the finished path X30 Z−20, X36 Z−40. G70 then runs the same contour at finish feed.

First-Part Inspection Checklist

After the program finishes, leave the part in the chuck and measure: (1) Ø30 at mid-length of the front section (away from the shoulder root, where the r0.4 nose fillet distorts the reading); (2) Ø36 at mid-length of the rear section; (3) shoulder position Z−20 from the faced face; (4) projection from Z−55 to Z−40.

If a diameter is 0.05 mm too small, the tool cut too deep. Correct it in the X wear offset (sign per your control's convention) and rerun G70; do not change G54, which shifts the whole part. If the diameter is too large, diagnose the cause first — tool deflection, built-up edge, or a worn insert — before adding a wear correction. If the shoulder Z position is off, adjust the Z wear offset, not G54 Z.

Do not promise that rerunning G70 will recover material that has already been cut past the target. Once a diameter is undersized, the part is scrap; the wear correction applies to the next part, not to undo this one. The first part is a learning part — use it to verify the offsets, then run the second part for production.

Why a Complete Project Teaches More Than Isolated Codes

A single G71 example shows one code. A complete project shows how drawing, datum, tooling, offsets, program, and inspection fit together. Once you have run a real program from drawing to inspected part, the abstract G-codes become physical. The project on this page uses the Ø40 raw bar, r0.4 insert, and X30/X36 contour described in the figures and code above — do not confuse it with other example diameters used elsewhere on this site.

Why a Lathe Uses Diameter Programming

On a lathe, X is programmed as the full diameter of the turned surface, not the radius. This matches how we measure turned parts: a micrometer reads 30.0, not 15.0, for a Ø30 shaft. It also means a 0.1 mm diameter cut removes 0.05 mm of radial stock — the infeed the cross-slide actually moves. In diameter mode, X15 means a 15 mm diameter target, i.e. radius 7.5 mm from center; X0 is the axis. Relative to a Ø30 target, programming X15 leaves the tool 7.5 mm too close to center on the radius (15 mm too small in diameter) and cuts the shaft undersize. Always confirm the lathe is in diameter programming, not radius.

Measuring the First Turn

After the first rough-OD pass to Ø36.4 and the finish pass to Ø30.0 (Z0 to Z-20), stop the spindle, let it coast, and measure both diameters with a micrometer. The Ø30.0 section should read on the drawing tolerance; the Ø36.0 section (Z-20 to Z-40) should read about 0.4 mm oversize on the rough pass. If the Ø30.0 reads 29.8 instead of 30.0, you have cut 0.2 mm too deep — that is a wear-offset correction, not a program edit. Touch the part off, enter the correction in the wear offset, and run the next piece. Do not edit the X30.0 in the program; that moves the drawing dimension.

Axial position is checked against Z0 (the face). If the shoulder at Z-20 is actually at Z-19.8, the Z wear offset is off by 0.2 mm. On a lathe, diameter and length corrections live in two different offsets; do not mix them up. After correcting, run one more piece and re-measure both diameters and the shoulder before letting the machine run a batch.

Measuring After Roughing vs After Finishing

After G71, the planned rough diameter on the Ø30 step is Ø30.4 (U0.4 in diameter, i.e. 0.2 mm on the radius). If you measure Ø30.2 instead, that means 0.2 mm less in diameter than the rough plan — but 0.2 mm of material still remains to the Ø30 finish target. That does not mean the finish wear offset is wrong. Before touching any offset, check: (1) U and W in the G71 block, (2) that you measured on the same cylinder the cycle will finish, (3) tool deflection and overhang, (4) that the micrometer is zeroed. Only after G70 finishes and the part still reads off the finish size do you correlate the error with the offset convention and adjust wear. Rough-side stock variation is not by itself a finish-compensation amount.

Rough-side measurement diagnostic
ReadingDiameter error vs planAction
Ø30.4 (planned)0Check remaining geometry and setup before the planned finish pass.
Ø30.2 (this case)−0.2 mm diaVerify U, measurement position, deflection; do not trim finish offset yet.
Ø30.0 after G700 vs finish targetThis diameter meets its nominal target; inspect the other drawing requirements separately.
Ø30.1 after G70+0.1 mm diaAfter verifying the cause and sign convention, correct the next part or prepare a separately verified rework sequence; do not restart in the middle of a cycle.

For the finish reading Ø30.10, a correction of −0.10 in a diameter-based X wear field would reduce the diameter by 0.10 only if positive wear moves the cutting edge outward in the verified setup. A radius-based field would instead require −0.05 under that same sign convention. Check the control convention and the measured error before entering either value. A rework pass on the existing part requires sufficient material, preserved location, a complete restart state and verified access; a wear calculation is not authorization to resume at an arbitrary block.

Common Mistakes

Practice

1. After G71 with U0.4, what are the rough diameters?

Show answer

Ø30.4 and Ø36.4. U0.4 is diameter allowance, so each rough diameter is 0.4 mm over finished.

2. You measure Ø30.03 and Ø36.07. Are both acceptable at ±0.05?

Show answer

Ø30.03 is within 30.00±0.05 (29.95–30.05) — OK. Ø36.07 is above 36.05 — out of tolerance by 0.02 mm.

3. If the toolholder rearward envelope is 8 mm behind the tip, and the jaw front is at Z−55, what is the minimum gap when machining to Z−40?

Show answer

Tool body reaches Z = −40 − 8 = −48. Gap to jaw at Z−55 is 7 mm. This is a geometric model; verify the actual toolholder envelope on the machine.

Sources