CNC Machining Basics
BeginnerLesson 5 of 8 in Mechanical Workshop Technology Course
What you will learn
- Describe the parts and controls of CNC lathes, machining centers and routers, name their axes, and use machine zero and work zero to locate a part.
- Describe how a CNC machine runs a programName the main parts of a CNC machine, follow the chain from drawing to finished part, and use the operating modes and safety controls of the operator panel.
- Name the axes of lathes, mills and multi-axis machinesApply the right-hand rule and the standard axis conventions to identify X, Y, Z and the rotary axes A, B and C on lathes, machining centers and multi-axis machines.
- Use machine zero, reference points and work zeroDistinguish machine zero, the reference point and work zero, set a work offset, and choose a sensible work zero on mills and lathes.
- Describe how a CNC machine runs a program
- Write the positions a tool must reach as absolute or incremental coordinates and calculate the points of a contour from a workshop drawing.
- Switch between absolute and incremental coordinatesWrite the same path in absolute and in incremental coordinates, choose the right mode for a task and avoid the errors that come with switching modes.
- Work out contour points from a drawingChoose work zero to match the drawing, calculate missing coordinates of lines, chamfers, radii, tapers and hole patterns, and check the results.
- Switch between absolute and incremental coordinates
- Read ISO G-code programs block by block and write simple complete programs for a machining center and a lathe, including moves, spindle, tools, coolant and canned cycles.
- Read the structure of a G-code programRecognize programs, blocks and words, the meaning of the address letters, modal and non-modal codes and the usual layout of a program, and know how control dialects differ.
- Program straight-line and circular movesUse rapid moves, linear feed moves and clockwise and counterclockwise arcs in the right plane, with the arc center or radius, and set the feed in the right unit.
- Control spindle, tools and coolant with S, T and M wordsUse S, T and the common M codes, calculate spindle speed and feed rate from cutting data, and apply constant surface speed on a lathe with a speed limit.
- Write and read a simple milling programPlan, write and explain a complete milling program with a contour and drilled holes, using canned cycles and the right return levels.
- Write and read a simple turning programPlan, write and explain a complete turning program with facing, a chamfer and a diameter, and recognize roughing cycles and the special features of lathe programs.
- Read the structure of a G-code program
- Measure and enter tool length and geometry offsets, and program contours with cutter radius and tool nose radius compensation so the part comes out at size.
- Set and use tool length and tool geometry offsetsExplain why each tool needs its own offsets, activate length offsets on a mill and geometry offsets on a lathe, and keep geometry and wear values apart.
- Program with cutter radius and tool nose radius compensationUse G41, G42 and G40 to program the part contour directly, apply them correctly on approach and exit, and use nose radius compensation on the lathe.
- Set and use tool length and tool geometry offsets
- Follow the CAM workflow from model to machine-ready program, use conversational programming at the control, and plan nested panel machining.
- Follow the CAM workflow from model to machine programSet up stock, coordinate system and tools in CAM software, choose and adjust operations, and post-process and transfer the program to the machine.
- Program with conversational controls and plan nested partsProgram simple parts with a conversational (dialogue) control, choose between G-code, conversational programming and CAM, and plan nesting on a panel.
- Follow the CAM workflow from model to machine program
- Find errors by simulation, run the first part safely, respond to alarms, correct sizes with wear offsets and improve programs for cycle time, tool life and material use.
- Simulate a program and find programming errorsUse graphic simulation and a systematic read-through to find syntax, geometry and logic errors, and respond correctly to alarms on the machine.
- Run the first part safelyCheck the setup, prove out the program step by step with dry run, single block and overrides, and inspect the first part before production.
- Correct sizes with wear offsets and improve the programTurn measurements into the right wear offset corrections and improve a proven program for cycle time, tool life and material use.
- Simulate a program and find programming errors
CNC Machining study guide
1Read the machine and its zero points
A CNC machine turns program numbers into relative movement between a cutting tool and a part. The control, drives and feedback system carry out those movements, while the setup gives the numbers a physical location. Reading the panel, recognizing the axis directions and distinguishing machine zero from work zero let you connect a drawing point with the position you see inside the machine.
1.1 From a drawing to controlled motion
A CNC machine cuts with the same tools and cutting principles as a conventional machine. Computer numerical control (CNC) replaces handwheel movements with instructions for positions, feeds and machine functions.
What makes the axes move
The control reads the program. A drive supplies power to an axis servo motor, and a ball screw turns motor rotation into linear movement along guideways. An encoder or linear scale reports position. In a closed loop, the control compares the requested and measured positions and corrects the difference continuously. Repeatable motion depends on that feedback and the condition of the machine. Some small stepper-driven machines use an open loop, where a lost step is not detected by position feedback.
The spindle supplies the cutting rotation. A tool changer on a machining center, or a turret on a lathe, brings the selected tool into position. A vise, chuck, fixture or vacuum table holds the stock. Coolant equipment manages cutting fluid; guarding and interlocked doors separate people from moving parts and flying chips.
Match the machine to the work
| Machine | What rotates | Main cutting movements |
|---|---|---|
| CNC lathe or turning center | Workpiece | Tool moves in X and Z |
| Machining center | Cutting tool | Relative tool movement in X, Y and Z |
| Router or woodworking center | Cutting tool, usually at high speed | Routing and drilling in panels, wood, plastics or composites |
A turning center may also have driven tools and a position-controlled spindle. Lasers, plasma cutters and EDM machines share the use of numerical coordinates, although their material-removal processes differ.
Plan the whole job
Read the drawing, choose an operation order, select tools and decide how to hold the stock. Write the program by hand, at a conversational control or in CAM. Transfer it, clamp the work, and enter the tool and work offsets. Simulate and prove out the motion, cut the first part, inspect it and correct the setup before producing a batch.
A valid program can still make the wrong part. For example, the control can reach a coordinate perfectly while the work offset places that coordinate on the wrong side of the vise. Feedback checks position; it does not compare the finished shape with the drawing.
Read the panel by function
Edit changes program text; memory/auto runs a saved program. MDI runs a short typed instruction. Jog and the handwheel position an axis manually; reference return establishes its reference position. Single block pauses execution after each block until cycle start continues it.
Feed hold pauses axis feed but normally leaves the spindle rotating. Emergency stop stops hazardous motion and the spindle; recovery usually needs a reset. Reset ends execution. Feed, rapid and spindle overrides change their respective programmed rates, so reducing feed override does not necessarily reduce rapid travel.
At the machine, work under supervision, keep guards and interlocks in service and doors closed, and never reach in while motion is possible. Wear eye protection, secure hair and clothing, remove chuck keys and loose tools, and use a brush or hook for chips.
Key Takeaways
- CNC controls positions and machine functions; cutting data still matters.
- Position feedback lets a closed-loop axis correct its movement.
- The physical setup must agree with the program.
- Feed hold and emergency stop have different effects.
- Feed and rapid overrides control different movements.
1.2 Read linear and rotary axes
An axis name tells you the direction in which a programmed coordinate acts. Read that direction as tool motion relative to the part, even when a table actually moves.
Find Z, then X and Y
Z runs parallel to the main spindle. Positive Z increases separation between tool and work: upward on a vertical mill and away from the chuck on a lathe. On a horizontal machining center, Z is horizontal because the spindle is horizontal.
The axes form a right-handed coordinate system. Hold your right thumb, index finger and middle finger at right angles: thumb is +X, index finger +Y and middle finger +Z. Orient your hand to the machine's axes. The relationship between the three directions stays the same when you turn your hand.
On a typical vertical machining center viewed from the operator, +X points right, +Y toward the column and +Z up. X and Y follow the machine convention together with the right-hand rule; increasing tool-to-part distance alone does not define them.
Separate table movement from program movement
Suppose the spindle stays fixed horizontally while the table carries the part. A +X tool movement relative to the part requires the table to move left. Watching the table move right and calling that +X reverses the program's viewpoint. Use the axis display and the machine's marked directions when jogging.
With work zero at the front-left corner of a plate's top face, a point 30 mm right, 20 mm back and 5 mm below the top is X30.0 Y20.0 Z-5.0. Its negative Z locates it inside the material; positive Z values lie above that top face.
Read lathe X as diameter
Lathe Z follows the spindle centerline. +Z points away from the chuck toward the tailstock. X moves radially, and +X points away from the centerline. A front turret and a rear turret look different from the operator's position, so identify the centerline before assigning the direction.
In diameter programming, X30.0 puts the tool at a radius of 15 mm. If a cut reduces a diameter from 30 to 28 mm, the programmed X changes by 2 mm while the tool moves inward by 1 mm. This distinction also applies to incremental X moves and diameter-valued wear offsets.
Name rotations by their axes
| Rotary axis | Axis it rotates about |
|---|---|
| A | X |
| B | Y |
| C | Z |
Point your right thumb along the positive linear axis. Your curled fingers show the positive rotation about it. A rotary table turning about X is an A axis. A lathe spindle that can stop at a commanded angular position provides a C axis; C90.0 can orient a part for a cross hole with a driven tool.
A machine with X, Y, Z, B and C can tilt and rotate the part as well as move linearly. In indexed machining, a rotary axis first reaches a fixed angle and the cutting moves then take place at that orientation. Having five axes does not mean all five must move together during every cut.
Key Takeaways
- Read coordinates as tool movement relative to the part.
- Z is parallel to the main spindle; +Z increases separation.
- Lathe X normally specifies diameter, so radial motion is half the X change.
- A, B and C rotate about X, Y and Z.
1.3 Locate the part with work zero
A drawing locates features on a part. The machine needs to know where that part sits inside its travel. Zero points and offsets connect those two views.
Three points with different jobs
Machine zero (M) is the fixed origin chosen by the builder. The reference point (R) is a known position reached during homing. A machine with incremental encoders needs reference return after startup to establish its position; absolute encoders retain position through power-off.
Work zero (W) is the origin chosen for the part program. Use a drawing datum that can also be found accurately during setup: a squared corner, the center of a bore or a finished face. Machine zero stays fixed while work zero changes with the job.
The tool reference point is separate again. On a mill it is the spindle gauge line where the holder seats; on a lathe it is a reference point on the turret. Tool offsets account for the distance from that point to each cutting tip.
Store the connection
A work offset locates work zero in machine coordinates. Fanuc-style controls select registers with G54 through G59. Siemens provides settable zero offsets including G54 through G57; Heidenhain uses a preset table.
Suppose G54 contains machine X−412.350 and Y−203.120. The work point X30, Y20 corresponds to:
Calling G54 lets the program keep the drawing coordinates. Moving the vise later requires a new work-offset measurement, not a new coordinate for every feature. Two vises can use G54 and G55 with the same local toolpath.
Measure the datum
An edge finder locates an edge through contact. A 10 mm edge finder has a 5 mm radius, so its spindle center is 5 mm from the contacted edge. Apply that radius on the correct side. For a left edge with material extending in +X, the spindle center is 5 mm to the negative side at contact; the edge is 5 mm farther in +X.
A probe can locate edges automatically. Sweeping a bore with a dial indicator locates its center. Set Z from the top face using the shop's chosen tool-length method, so work and tool offsets do not count the same distance twice.
On a lathe, X0 is the centerline and Z0 is normally the finished front face. Face the stock, establish Z0, and use a measured test diameter to establish the tool's X geometry. Points along the shaft behind the front face then have negative Z coordinates.
Check the register and the position
Confirm that the program calls the register you measured. Data in G55 does not help a program calling G54. Also compare the physical datum with the programmed datum: a raw face and a finished face are different surfaces.
For a position check, first establish verified clearance with the correct tool-length compensation active. Move over the datum in XY while high, then lower under controlled movement to a checking height, such as 50 mm, and compare with a gauge. An unchecked direct move to X0 Y0 Z0 can send the tool into the stock or a clamp. Re-establish reference position during recovery when the control requires it.
Key Takeaways
- Machine zero belongs to the machine; work zero belongs to the job.
- A work offset locates the part datum in machine coordinates.
- An edge finder needs a radius correction.
- Work and tool offsets account for different distances.
- Check the selected register and datum surface.
- Verify XY above the part before lowering to a checking height.
2Calculate the tool positions
Every contour becomes a sequence of positions. You can describe each destination from work zero or describe the distance from the previous point; the geometry must stay the same in either form. Drawing datums, signed coordinates and a checked point table make those positions dependable. Chamfers, radii, bolt circles and lathe tapers add a few calculations before the movement blocks can be written.
2.1 Write destinations or distances
The same contour can be described by its destinations or by the distances between them. The control's coordinate mode decides which meaning it gives a number.
Absolute and incremental on a mill
| Mode | Code | Meaning of X70.0 |
|---|---|---|
| Absolute | G90 | Reach X70 measured from work zero |
| Incremental | G91 | Move 70 mm in +X from the present position |
Both modes are modal: the selection stays active until replaced. An omitted axis does not move in either mode. To calculate an increment, subtract the current coordinate from the target coordinate, separately for every axis:
Convert a closed path
Start at P1(10, 10). The next points are P2(70, 10), P3(70, 40), P4(40, 55), P5(10, 40), then P1 again.
| Move | Absolute destination | Increment from previous point |
|---|---|---|
| P1 to P2 | X70.0 Y10.0 | X60.0 Y0.0 |
| P2 to P3 | X70.0 Y40.0 | X0.0 Y30.0 |
| P3 to P4 | X40.0 Y55.0 | X-30.0 Y15.0 |
| P4 to P5 | X10.0 Y40.0 | X-30.0 Y-15.0 |
| P5 to P1 | X10.0 Y10.0 | X0.0 Y-30.0 |
The X increments total zero, and so do the Y increments. That confirms the path closes. It does not confirm that every intermediate corner is correct: two wrong moves can cancel. Check the point table as well as the sums.
Absolute coordinates are convenient for contours because each destination can be compared directly with the drawing. Incremental coordinates suit repeated spacing, such as holes at a 15 mm pitch. To recover absolute positions, add each increment to the previous position, keeping its sign.
Restore the intended mode
A mill can return Z to reference with G91 G28 Z0.0. The zero increment avoids an intermediate Z displacement before the reference return. G28 acts in its own block, but G91 remains active. Put G90 in the following block before using absolute work coordinates again.
If the tool is at X10 and an intended destination X70 is interpreted in G91, it reaches X80. An apparently reasonable coordinate can therefore be wrong because of an earlier mode, not because of its own number. A tool section should establish its required modes before movement.
Use the lathe's coordinate language
Fanuc-style lathe G-code system A uses X and Z for absolute positions and U and W for incremental distances. U is still a diameter change: X30 to X26 is U-4.0, with only 2 mm radial movement. A block may mix absolute and incremental addresses for different axes.
On that lathe code set, G90 calls a turning cycle; it does not select absolute coordinates. Siemens uses G90/G91 and permits an individual increment such as X=IC(5). Heidenhain marks increments with I, as in IX+5. Identify the control and code set before interpreting a coordinate-mode command.
Key Takeaways
- Absolute values locate destinations from work zero.
- Incremental values equal target minus current position.
- A closed incremental path has zero net movement on each axis.
- Restore G90 after incremental reference-return moves on a mill.
- Fanuc lathe system A uses U/W increments and a different meaning for G90.
2.2 Turn drawing dimensions into contour points
Before writing motion blocks, make a point table. Each straight line needs its end point; each arc also needs a direction and a center or radius. A clear table keeps geometry work separate from code entry.
Start from the drawing datum
Place work zero on the dimensioning datum, sketch the contour and number the points in travel order. Record X/Y for a mill or X/Z for a lathe. Read direct dimensions first, then calculate missing ones. Check each result against another dimension or geometric relationship.
Baseline dimensions already measure from one datum. Chain dimensions measure successive distances, so add them before entering absolute coordinates. Their tolerances also accumulate; do not treat each link as an independent coordinate from zero. Select a machining target within the drawing's tolerance, commonly its midpoint.
Chamfers and rounded corners
At the plate corner (80, 50), a 5 × 45° chamfer reaches the top edge at (75, 50) and the right edge at (80, 45). Those two points replace the sharp corner.
An R5 quarter-circle at the same corner has the same tangent points, but its center is (75, 45). Equal end points do not make the chamfer and radius interchangeable: one is a straight line and the other an arc. Check that both distances from the center to the tangent points equal 5 mm.
On a Ø30 shaft, a 1 × 45° front chamfer runs from X28.0 Z0.0 to X30.0 Z-1.0. Its radial change is 1 mm, so its diameter change is 2 mm. Using X29 at the face would make a different angle.
Calculate a bolt circle
For a circle centered at coordinates Xc, Yc, with radius r and angle measured counterclockwise from +X:
A 60 mm pitch circle has radius 30 mm. Four holes around (40, 25), beginning at 45°, use a horizontal and vertical displacement of 21.213 mm. The points are (61.213, 46.213), (18.787, 46.213), (18.787, 3.787) and (61.213, 3.787). The center is not an extra hole; it is the origin used in the calculation. A bolt-circle cycle can calculate these positions from the same inputs.
Calculate a lathe taper
The radial increase along a cone is its length times the tangent of its half-angle. Double that increase for diameter:
Starting at Ø30 and extending 20 mm toward the chuck with a 15° half-angle gives an end diameter of about 40.718 mm. The end point is X40.718 Z-20.0. Use the half-angle, not the 30° included angle, and retain the factor 2 for diameter.
Keep enough decimals for the control and drawing. Three decimal places in millimeters are common. Coarse rounding can move an arc end point off its circle and trigger an alarm. Negative signs also carry geometry: a point behind the lathe's front datum needs negative Z. CAD can supply coordinates directly, but the same datum, sign and circle checks still apply.
Key Takeaways
- Build and check a point table before entering code.
- Chamfers and radii can share end points but need different motion.
- Use the bolt-circle radius, not its diameter, in coordinate calculations.
- Lathe taper calculations use the half-angle and double radial change.
3Read and build milling and turning programs
A complete program controls more than the finished shape. It establishes units and modes, selects tools and offsets, starts cutting functions, approaches the stock and leaves it in a clear sequence. Reading blocks as a continuous set of active instructions helps you see why a later line behaves as it does. Milling and turning examples show how that sequence changes with the machine and its control dialect.
3.1 Read blocks, words and active modes
A G-code program is a sequence of blocks, usually displayed one per line. Each block contains words: an address letter followed by a value. In N40 G01 X30.0 Z-25.0 F0.15, each letter-and-number pair has a separate job.
Recognize the addresses
| Address | Job |
|---|---|
O, N | Program number and block number on Fanuc-style controls |
G | Motion or operating mode |
X Y Z, A B C | Linear positions and rotary positions |
I J K, R | Arc-center offsets; radius or cycle return level |
F, S, T, M | Feed, spindle setting, tool and machine function |
H, D | Tool-length and cutter-compensation register numbers |
P, Q | Cycle-specific values, such as dwell or peck depth |
A Fanuc screen may show an end-of-block character as a semicolon. Parentheses enclose comments, such as (D10 END MILL); Siemens uses a semicolon to begin a comment. The address's meaning comes from its surrounding command: R in an arc is not the same instruction as R in a drilling cycle.
Track what stays active
A modal selection remains in effect. After G01 X50.0 F200, a following Y30.0 is another straight feed move at 200 mm/min. Motion, plane, units, coordinate mode, work offset, compensation, feed and spindle settings have modal behavior.
A non-modal command acts in its own block. G04 dwell and G28 reference return are examples. A block containing one does not clear unrelated modes.
Only one code in a modal group should be selected in a block. G00 G01 gives conflicting motion instructions. G90 G54 G00 combines different groups: absolute coordinates, work offset 1 and rapid positioning.
Establish a readable program structure
The start identifies the program and sets known modes. A mill safety block can contain G21 G17 G40 G49 G80 G90 G94: millimeters, XY plane, cancelled radius and length compensation, cancelled cycle, absolute coordinates and feed per minute. Length compensation is then activated for the selected tool before approaching the part.
Each tool section changes the tool in a clear position, selects the work offset, starts the spindle, applies the correct tool data and coolant, cuts and retracts. The end turns off coolant and spindle and uses M30 to finish and return to the start.
Read units and dialect before numbers
Fanuc-style G21 selects millimeters; G20 selects inches. Feed units also depend on the feed mode: per minute or per revolution. Siemens G70/G71 change geometric units, while G700/G710 also change feed units.
Write decimal points in coordinate values. Some Fanuc input settings read X10 as 0.010 mm, while X10.0 means 10 mm. Zero values such as G40 or M30 are codes, not dimensions, and do not need decimal points.
ISO 6983-1 defines the word-address framework, but builders extend it. Siemens adds forms such as CYCLE81 and CR=; Heidenhain Klartext uses lines such as L X+50 Y+0 R0 FMAX. A familiar-looking word is interpreted through the actual machine's control manual and selected code set.
Key Takeaways
- A block contains words made of an address and value.
- Modal settings stay active until replaced.
- Use one command per modal group in a block.
- Set units and modes explicitly at a tool-section start.
- Write decimal points in dimension values.
- Control dialects can assign different meanings to the same code.
3.2 Choose safe positioning, lines and arcs
Motion commands describe both where the tool goes and how it gets there. A correct end point alone does not establish a safe path.
Position in clear space, then feed
G00 is rapid traverse for free-space positioning. Some controls move axes independently, producing a dog-leg path. Establish clearance before moving across the part: raise Z before lateral travel when leaving; approach in XY while high, then lower Z. Check the entire route against clamps and stock.
G01 coordinates the axes to make a straight line at feed F. A diagonal cut can change X, Y and Z together while remaining a straight movement. Supply F on the first feed move so the cutting rate is known.
Select the working plane
| Plane code | Plane | View used to judge arc direction |
|---|---|---|
G17 | XY | From +Z toward the plane |
G18 | ZX | From +Y toward the plane |
G19 | YZ | From +X toward the plane |
In that view, G02 is clockwise and G03 counterclockwise. Changing the plane changes which coordinates describe an arc; it is not just a display preference.
Calculate an arc center from its start
In the usual Fanuc center format, I, J and K are the signed distances from the arc start to its center, even when the end point uses absolute coordinates.
Start at (40, 0), end at (60, 20), and use center (40, 20). Both points are 20 mm from the center. From the start, the center is 0 mm in X and +20 mm in Y. The counterclockwise quarter-circle is:
G17 G03 X60.0 Y20.0 I0.0 J20.0 F300
The radius form is G03 X60.0 Y20.0 R20.0. Under the Fanuc convention, positive R chooses an arc of 180° or less; negative R chooses one over 180°. A full circle needs center format because coincident start and end points do not locate an R-format circle. From (60, 20), G02 I-20.0 J0.0 makes a full clockwise circle about (40, 20).
Reversing G03 to G02 with the same I/J center follows the long route around that circle. Reversing it in R format selects a different curved route between the end points. Trace the actual geometry when checking either form.
Read lathe arcs and feeds
For a lathe diagram with +Z right and +X up, a convex R2 front edge on a Ø30 shaft runs from X26.0 Z0.0 to X30.0 Z-2.0. Its counterclockwise block is G18 G03 X30.0 Z-2.0 R2.0. The radial change is 2 mm, although X changes by 4 mm.
On a mill, G94 F200 means 200 mm/min in metric mode. On a Fanuc system-A lathe, G99 F0.15 means 0.15 mm/rev; many other controls select that feed mode with G95. Reading an intended 150 mm/min as 150 mm/rev would command an extreme feed. Identify the feed mode before judging an F value.
Key Takeaways
- Use G00 for clear-space positioning and G01 for straight cutting feeds.
- Judge G02/G03 from the positive end of the axis normal to the plane.
- Fanuc I/J/K center values are measured from the arc start.
- Positive and negative R select short and long arcs in the Fanuc convention.
- Read F together with the active units and feed mode.
3.3 Set spindle, feed, tools and coolant
A cutting path needs the right tool and cutting conditions before it enters the stock. S, T and M words control those parts of the tool section.
Read machine functions
| Code | Function on common Fanuc-style machines |
|---|---|
M00, M01 | Program stop; optional stop when enabled |
M03, M04, M05 | Spindle clockwise, counterclockwise, stop |
M06 | Tool change on a machining center |
M08, M09 | Coolant on, off |
M02, M30 | Program end; end and return to start |
Clockwise is viewed from the spindle toward the workpiece. Standard right-hand drills and end mills use M03. A lathe tool mounted upside down may need the opposite spindle direction. Other machine functions, including many special M codes, come from the builder's instructions.
T1 M06 selects and loads mill tool 1. T alone may only preselect a magazine pocket. On a lathe, T0101 selects station 01 and offset 01. The tool number and the offset number perform different jobs, even when they match.
Calculate rpm and milling feed
With fixed-speed mode G97, S is spindle rpm. For cutting speed vc in m/min and tool or work diameter d in millimeters:
A Ø10 end mill at 120 m/min needs about 3 820 rpm. For milling, feed per tooth fz, tooth count z and rpm n give:
At 0.05 mm/tooth with 3 teeth and 3 820 rpm, feed is 573 mm/min. Practical rounded commands are S3800 and F570. For a drill, multiply feed per revolution by rpm to obtain feed per minute; a lathe can program the feed per revolution directly.
Limit constant surface speed
G96 makes S the surface cutting speed. As a lathe tool approaches the center, diameter decreases and rpm rises to maintain that speed. At G96 S200, Ø40 needs about 1 592 rpm and Ø10 about 6 366 rpm.
Set a safe speed ceiling first, for example G50 S3000 on the Fanuc lathe code set. The control then holds at the limit when the calculated rpm would exceed it. Select the limit for the machine, chuck and actual workholding. G97 returns to fixed rpm, useful for drilling on the centerline and threading.
Put the actions in order
Change the tool with enough clearance, call the work offset, position clear of the part and start the spindle. Apply the correct length offset on a mill, then approach with coolant enabled when required. Feed through the cut, retract, and turn off coolant and spindle before the next tool change.
A dwell holds position briefly, often to clean up a groove or counterbore. In the Fanuc convention used here, G04 P500 or G04 X0.5 gives 0.5 s. Dwell units are control-specific. An optional M01 only pauses when its panel switch is on, so enable it during a first-run inspection plan.
Key Takeaways
- Read S as rpm in G97 and cutting speed in G96.
- Set a spindle-speed ceiling before lathe constant surface speed.
- Milling feed equals feed per tooth times tooth count times rpm.
- T selects a tool; its related offset must also be correct.
3.4 Build a milling program with a contour and holes
Plan the setup before the blocks. An 80 × 50 mm plate sits in a vise with G54 at the front-left corner of its finished top. A Ø10 end mill cuts the outside 5 mm deep. A Ø6.8 drill then makes holes at (20, 25) and (60, 25) through the 12 mm thickness; parallels and clamps leave both hole paths clear.
Follow the tool center
With radius compensation off, the end mill center must stay 5 mm outside the finished edges. Its contour corners are (−5, −5), (−5, 55), (85, 55) and (85, −5). Start beside the stock so the plunge does not cut a full-width slot. Here Z25 clears the fixture and Z2 is the feed-start level.
%
O1001 (PLATE 80 X 50 - OUTSIDE PROFILE AND 2 HOLES)
N10 G21 G17 G40 G49 G80 G90 G94
N20 T1 M06 (D10 END MILL, 3 FLUTES)
N30 G54 G00 X-15.0 Y-5.0 S3800 M03
N40 G43 H01 Z25.0 M08
N50 Z2.0
N60 G01 Z-5.0 F200
N70 X-5.0 F570
N80 Y55.0
N90 X85.0
N100 Y-5.0
N110 X-5.0
N120 G00 Z25.0 M09
N130 M05
N140 G91 G28 Z0
N150 G90
N160 T2 M06 (D6.8 DRILL)
N170 G54 G00 X20.0 Y25.0 S1400 M03
N180 G43 H02 Z25.0 M08
N190 G99 G81 X20.0 Y25.0 Z-15.0 R2.0 F140
N200 G98 X60.0
N210 G80 M09
N220 M05
N230 G91 G28 Z0
N240 G90
N250 M30
%
Read each tool section
N10 establishes the mill's modes, including feed per minute. N20 loads the end mill. N30 positions beside the part and starts the spindle; N40 applies H01 and reaches clearance. N60 feeds to depth outside the stock. The next moves cut clockwise around the plate with the center 5 mm outside it. With M03 and a right-hand cutter, this is climb milling. Conventional milling can be chosen for conditions such as hard surface scale or drive play.
N120 retracts before reference return and the next tool change. G90 restores absolute mode after each G91 G28 return. The drill section selects H02, not H01.
Read the drilling cycle
G81 positions at a hole, rapids to R, feeds to Z and retracts. Here R2 is above the top and Z−15 gives space for the drill point beyond the 12 mm thickness. The cycle remains active, so N200 supplies only the next X position and a return-mode change. G80 cancels it before unrelated travel.
On this mill, G99 returns to R2 and G98 returns to the initial Z25. A move between holes can cross a clamp, so choose the return level for the obstacle, not just for speed. The final hole returns high before cancellation.
For deeper holes, G83 pecks with full returns to R to clear chips; G73 uses short chip-breaking retracts. G84 tapping synchronizes feed to pitch: an M8 × 1.25 tap at 400 rpm needs 500 mm/min. Siemens uses named cycles such as CYCLE81 and CYCLE83.
Deeper contours can repeat at several Z levels. A router follows the same setup logic, but uses cutting data for wood or board, often 18 000–24 000 rpm, vacuum workholding and a spoilboard. Its chosen top-face or table Z0 must agree with the programmed through-cut depth.
Key Takeaways
- Plan tools, datum, fixture clearance and depths before coding.
- Without radius compensation, program the cutter center outside the finished contour.
- Apply the correct H register for each tool.
- G81 remains active at subsequent hole positions until G80.
- On a mill, G98 returns high and G99 returns to R.
- Tapping feed must match pitch and rpm.
- Router Z0 and through-cut depth must agree with the panel setup.
3.5 Read facing, turning and a front chamfer
A turning program locates the profile with X diameters and Z distances from the finished front face. The working plane is G18. The example uses Fanuc lathe G-code system A, where G99 selects feed per revolution and T0101 calls station 1 with offset 1.
Plan the shaft end
Start with Ø32 bar. Face the front, then turn Ø30 for 25 mm with a 1 × 45° front chamfer. The tool has a 0.4 mm nose radius. Its geometry and nose orientation are set; the turret indexes at a verified clear position. G50 limits spindle speed before G96 starts constant surface speed.
%
O2001 (D30 SHAFT END FROM D32 BAR)
N10 G21 G18 G40 G99
N20 T0101
N30 G50 S3000
N40 G96 S200 M03
N50 G00 X34.0 Z2.0 M08
N55 G01 Z0.0 F0.12
N60 X-0.8
N70 G00 Z3.0
N80 X22.0
N85 G01 G42 X24.0 Z2.0 F0.15
N90 X30.0 Z-1.0
N100 Z-25.0
N110 X34.0
N115 G40 G01 X38.0
N120 G00 X100.0
N125 Z100.0 M09
N130 M05
N140 M30
%
Follow the facing tool
N55 feeds to the finished face outside the bar, then N60 feeds across it. X−0.8 is a diameter coordinate: the imaginary tip moves 0.4 mm beyond center, one nose radius, so the rounded cutting edge reaches the center. Returning only to X0 can leave a central pip with this tool geometry.
After facing, the tool backs away in Z before moving across the front. The chamfer's theoretical end points are X28 Z0 and X30 Z−1. N85 starts compensation in free space; N90 approaches along the extension of that same 45° line from X24 Z2. The tool is already following the chamfer direction when it enters the stock.
Account for the rounded nose
G42 puts the tool on the proper side for this outside profile toward the chuck, viewed with +X up and +Z right. The control uses the entered nose radius and tip orientation. N100 turns the cylinder, N110 cuts out along the shoulder, and N115 cancels compensation on a clear lead-out before rapid retraction.
Without nose compensation, faces and straight diameters can be correct while the chamfer retains extra material. The control positions an imaginary sharp tip; the insert's rounded edge contacts a sloping line elsewhere. Nose compensation corrects that contact geometry.
Recognize roughing and other lathe work
Reducing Ø32 to Ø30 removes 1 mm radially. Bigger allowances need several passes. G71 roughing reads a profile between nominated block numbers and repeats cuts while leaving finishing stock; G70 finishes that profile. Siemens offers CYCLE95 for related roughing work.
Grooving and parting feed mainly in X. Constant surface speed increases rpm as the tool moves inward, so the spindle limit remains essential. Keep unsupported stock short, check chuck and tailstock clearance, and choose support from the actual job's rigidity and workholding limits. Inspect the finished chamfer as well as the shaft diameter.
Key Takeaways
- Lathe X is diameter and Z0 is the finished front face.
- Set the speed ceiling before G96.
- Facing overtravel depends on nose geometry and diameter programming.
- A rounded insert needs nose compensation on chamfers, tapers and arcs.
- G71 roughs a defined profile; G70 finishes it.
- Tool changes and retractions need clearance from the chuck and supports.
4Set tool offsets and follow the contour
The control positions a machine reference point, but the part is cut by an edge some distance away. Measured tool offsets connect the reference point to the tip; radius compensation connects the programmed contour to the tool center or rounded nose. Following both relationships makes it possible to replace tools, program drawing dimensions directly and correct small size changes without rewriting the contour.
4.1 Connect tool measurements to the cutting tip
The program describes where a cutting tip belongs. The machine positions a spindle or turret reference point. Tool offsets connect those positions so a long tool and a short tool can follow the same programmed surface.
Measure a mill's tool length
Tool length is measured from the spindle gauge line to the cutting tip. A presetter measures the tool outside the machine. An in-machine setter measures contact with a known surface; a manual touch-off can establish the same relationship. Clean the contact surfaces first: a chip under the tip becomes a measurement error.
Store the value in the tool-length register. G43 H01 applies register 1; G49 cancels length compensation. Matching T1 with H01 is a useful shop convention, but the control follows the H number actually called. Loading T1 does not make a mistaken H02 correct.
Calculate the reference-point position
With gauge-line lengths, tool 1 is 112.450 mm long. G54 Z locates the part top at machine Z−430.200 for a zero-length reference. For a requested tool-tip height of Z25:
The gauge line is at −292.750 while the tip is 25 mm above the part. Adding the positive length moves the spindle upward enough to leave room for the tool below it.
Some shops touch every tool directly on the part and use a different distribution of values between H and G54 Z, often with G54 Z at zero. Follow one consistent measurement method. Mixing a gauge-line work offset with tool values measured for another method can count a distance twice or omit it entirely.
Set lathe geometry
A lathe tool has X and Z geometry values from the turret reference to its imaginary tip. Touch the faced front to establish Z. Turn a short test diameter, measure it and enter that measured diameter to establish X. A tool-setting arm can measure tools automatically. T0101 selects station 1 and its geometry/offset record 1.
The offset page also stores a lathe insert's nose radius and tip orientation. On a mill, the D register provides cutter compensation size. Confirm whether its setting expects a radius or a diameter before entering the tool size.
Keep geometry and wear separate
| Offset part | Purpose | When it changes |
|---|---|---|
| Geometry | Basic measured tool dimensions | Tool setup or replacement |
| Wear | Small production size correction | After measurement and diagnosis |
The control combines geometry and wear. When a new insert is fitted and measured, reset the old wear correction so it does not carry the previous insert's adjustment forward. Router tool sensors use the same basic length relationship, often measuring after a tool change.
After entering data, verify a known height with the correct compensation active and slow controlled movement. Missing length compensation or a wrong register can put a long tool far below its intended position.
Key Takeaways
- Tool offsets connect the machine reference point to each cutting tip.
- G43 applies the selected H length register on a mill.
- Geometry stores measured tool size; wear stores a small correction.
- Reset old wear when a replacement tool is measured.
- Confirm radius versus diameter settings for cutter offsets.
4.2 Follow the part contour with compensation
A rotating cutter has width, and a lathe insert has a rounded nose. Compensation lets the control account for that geometry while the program follows the drawing.
Choose the side along travel
With mill radius compensation off, programmed XY values describe the cutter center. With compensation on, they can describe the part contour. The D register tells the control how far to shift the center.
Look forward along the programmed direction: G41 places the cutter center to the left; G42 places it to the right. G40 cancels the shift. For a right-hand end mill with M03, keeping the cutter on the left of the contour gives climb milling. The right choice comes from travel direction, not from which side of the screen contains the part.
Build a clear entry and exit
Turn compensation on during a straight movement in the working plane before contact. Leave at least a tool radius of lead-in distance for the offset to build. Cancel it on a straight lead-out away from the surface.
For the 80 × 50 mm plate and a Ø10 tool, D01 stores radius 5.000 mm. With the tool already at X−15 Y−15, Z−5 in clear space beside the stock:
G01 G41 D01 X0.0 F570
Y50.0
X80.0
Y0.0
X-10.0
G40 G01 Y-15.0
G00 Z25.0
The first move supplies 15 mm of entry. The contour runs up the left edge, across the back, down the right and along the front. The control constructs the center path outside those drawing lines. The final movement exits clear of the part while cancelling compensation. Starting G41 on an arc, or switching it on while already cutting the finished edge, prevents a controlled entry.
Check that the tool fits
Compensation shifts a path; it cannot make a cutter reach an inside corner smaller than its radius. A slot narrower than the cutter also cannot be machined by offsetting its center. Use a cutter small enough for the smallest inside radius and plan a suitable finishing pass.
A radius-setting D register needs 5.000 for a Ø10 tool. Entering 10.000 doubles the intended shift. Choosing the wrong compensation side can move the tool into the part by a full cutter diameter relative to the intended center path.
Correct contact on a lathe insert
The imaginary tool tip is where tangents to the rounded nose in X and Z meet. The real edge never contacts the part at that imaginary point. Faces and cylinders still size correctly because their contact points share the imaginary tip's Z or X coordinate. Slopes and arcs need nose compensation.
With a 0.8 mm nose, the perpendicular gap from an uncompensated 45° chamfer line is approximately 0.33 mm; with a 0.4 mm nose it is about 0.17 mm.
For the usual +X-up, +Z-right lathe view, outside turning toward the chuck uses G42 and boring toward the chuck uses G41. Enter both the nose radius and the correct tip-orientation number; the control needs to know which way the insert faces.
Key Takeaways
- G41 means left and G42 right along the programmed travel.
- Compensated coordinates can follow the finished part contour.
- Activate and cancel compensation on clear straight lead moves.
- A cutter must physically fit the slot or inside radius.
- A rounded lathe nose needs compensation on sloping and curved profiles.
- Nose radius and tip orientation both affect lathe compensation.
5Create programs with CAM and control dialogs
Programs can be created from toolpaths calculated in CAM or from dimensions entered in a control dialog. Each route still needs a defined origin, real tool data and a planned operation order. A post-processor supplies the machine dialect, while nesting software also solves the layout and workholding problems of panel parts. The setup sheet and saved revision carry those choices to the operator.
5.1 Turn a CAM setup into machine code
Computer-aided manufacturing (CAM) calculates toolpaths from a model or drawing. It is useful when a part has many features, a complex contour or a 3D surface. The resulting path still depends on the setup information entered by the programmer.
Define the physical job
Import the geometry, commonly STEP for a model or DXF for a flat outline, and check its units and overall size. Define the stock and workholding, then set the coordinate system and origin. Choose actual tools and holders from the tool library.
The CAM origin must match the work zero used on the machine. If the program measures Z from the stock top while the setter measures it from the table, every depth is shifted by the stock thickness. A correct-looking toolpath does not repair that mismatch.
Tool-library diameter, length and holder shape must match the assembly loaded at the machine. A holder omitted from the model can pass through a clamp in simulation without showing the real collision.
Build operations in machining order
Milling operations include facing, outside contours, pockets, adaptive roughing, drilling and finishing. Turning operations include facing, roughing, finishing, grooving and parting. Roughing removes most of the allowance; stock to leave reserves material for a controlled finishing pass.
| Parameter | What it sets |
|---|---|
| Stepover | Sideways engagement between adjacent paths |
| Stepdown | Depth added at each cutting level |
| Clearance and retract heights | Space for moves above the job |
| Top and bottom heights | Start surface and final cutting depth |
| Lead-in, lead-out and entry | How the tool enters and leaves material |
Adaptive roughing controls engagement with a small stepover and often a larger stepdown. A ramp or helical entry suits pocketing when straight plunging would overload the tool or when the cutter cannot cut at its center.
Plan a pocket
A 40 × 30 mm pocket is 8 mm deep. With a Ø10 end mill and 2 mm stepdowns, roughing uses four levels: Z−2, −4, −6 and −8. Leave 0.2 mm on the walls and use helical entry. A full-depth finishing pass then removes that wall allowance. Stepdown controls the depth sequence; finishing allowance controls material left on the walls. They are different settings.
Translate and verify
Generate and simulate the paths. A post-processor converts the CAM system's internal path into the exact machine/control dialect, including cycles, tool-change sequence and program layout. A Fanuc mill post is not interchangeable with a Siemens lathe or a woodworking-center post.
Read the posted program's opening modes, tool calls, offsets and first approach. Simulate the resulting code where the verification system supports it. Repeated hand edits to every output indicate that the post needs correction.
Transfer the approved revision by USB, network or DNC, which can stream long programs. Supply a setup sheet naming stock, fixture, tools, offsets and origin. The operator needs those details to reproduce the CAM setup physically, not just a file containing the toolpath.
Key Takeaways
- CAM needs accurate stock, origin, tools, holders and fixtures.
- The CAM origin must match the machine work zero.
- Stepdown, stepover and finishing allowance control different parts of the cut.
- A post-processor generates the selected machine dialect.
- Simulation and a setup sheet connect the digital path with the physical job.
5.2 Use control dialogs and lay out panel parts
A simple part can often be programmed directly at the machine. A panel containing many parts is usually planned in nesting software. Both methods begin with drawing dimensions and produce movements that still need checking.
Build a part through a dialog
A conversational control asks for dimensions and shows graphics as the operator enters them. Siemens ShopMill and ShopTurn, Heidenhain Klartext and woodworking-center editors use this approach. A pocket cycle can ask for its center, length, width, corner radius, depth, infeed, allowance, tool and cutting data. The control calculates the detailed toolpath.
Manual G-code suits short programs and small edits. Conversational programming suits simple turned or prismatic parts at the control. CAM is efficient for many features, complex surfaces and nested panels. Whichever route creates the program, the operator must be able to read and check its result.
Recognize Klartext movements
TOOL CALL 1 Z S3800 calls a tool along Z at 3 800 rpm. L X-5 Y-5 R0 FMAX makes a rapid straight move without radius compensation. RL means compensation left, RR right and R0 none.
For a circle centered at (40, 20), first reach the start point (40, 0). Then CC X+40 Y+20 defines the center and C X+60 Y+20 DR+ makes a counterclockwise arc to (60, 20). Both ends are 20 mm from the center. A circle-center entry does not move an off-circle start point onto the circle.
Check a nesting layout
Nesting places flat parts on a sheet while allowing for edge trim, cutter gaps and workholding. For 600 × 400 mm rectangles on a 2 800 × 2 070 mm panel, a 10 mm trim on every edge leaves 2 780 × 2 050 mm. A 12 mm gap is needed between neighbors.
With 600 mm along the length, four columns need 2 436 mm and five rows need 2 048 mm, so 20 parts fit. Rotating every rectangle gives six columns by three rows, or 18 parts. Without trim and gaps, a rotated 7 × 3 grid would suggest 21, but the cutting layout cannot use that zero-gap arrangement.
The 20 parts occupy 4.8 m² of the original 5.796 m² panel, about 83% material yield. Dividing areas alone would suggest room for 24 whole parts; it ignores whether their shapes fit in the available length and width.
Hold and identify the cut parts
Vacuum tables or pods hold panels, with through cuts entering a sacrificial spoilboard. Cutting order matters because small released pieces can lose vacuum holding. Nesting software can plan the sequence and print labels so similar pieces stay identifiable. Use cutting data for the actual wood, board or composite and cutter; metal-cutting settings do not transfer directly.
Save a proven program with its revision, setup sheet and offset record. Archive earlier versions. A repeat order needs a traceable program and setup, especially when a dialog program or nesting file has been revised since the previous batch.
Key Takeaways
- Conversational controls calculate paths from entered dimensions.
- Manual code, conversational control and CAM suit different job sizes and shapes.
- Nesting needs a real layout with edge trim and cutter gaps.
- Cutting order must preserve workholding for small panel parts.
- Archive proven revisions together with setup information.
6Prove out and improve the job
A first part tests the whole job: code, tools, offsets, workholding and cutting conditions. Simulation helps locate mistakes before motion; controlled prove-out checks the real setup; inspection establishes whether the part meets its drawing. Measurements then guide small wear corrections or a search for another cause. A proven job can be improved for time, tool life and material yield, with each change checked again.
6.1 Find errors before they reach the part
Simulation displays the path and often the stock removed. It can distinguish rapid and feed travel, show the resulting shape, estimate time and detect collisions with modeled fixtures and holders. It checks the digital setup it has been given.
Sort errors by their effect
| Error type | Example | How it appears |
|---|---|---|
| Syntax | Unknown address or missing required value | Control rejects the program format |
| Geometry | Arc end point off its circle | Arc or compensation calculation alarms |
| Logic | Valid coordinate with the wrong sign | Machine can execute the wrong path |
A logic error can be fully legal code. The absence of an alarm says nothing about whether a hole is at the correct position. Compare the simulated path with the drawing and point table.
Trace an unsafe fragment
Consider:
N50 G00 Z-5.0
N60 X40.0 Y0
N70 G01 X10 Y0
N50 rapids to cutting depth before the lateral position has been established. N60 inherits G00 and travels sideways at that depth. N70 changes to feed but supplies no F, and X10 can be interpreted as 0.010 mm on some input settings.
With correct offsets active and the tool already at verified clearance, a corrected approach is:
G00 X40.0 Y0.0
Z2.0
G01 Z-5.0 F200
X10.0
The first move is lateral while high, the second reaches the feed-start height, and only the third enters the stock at a known feed. This sequence also requires the actual entry point and the cutter to suit the planned plunge.
Check the whole setup
Inspect each tool's lowest Z, travel near clamps, tool changes and compensation entries. Confirm the tool, holder, stock, fixtures and offsets in the simulation match the machine. A short modeled holder cannot reveal a collision made by a longer real holder.
Step through suspicious regions block by block. Track modal state: an XY line without G is still rapid after G00, and a coordinate after an uncorrected G91 remains incremental. After an edit, rerun the affected simulation and check the following moves as well as the edited block.
Read alarms before resetting
Record the alarm number, text and active block. Overtravel, format, servo, spindle, door, low-air and lubrication alarms point to different causes. Stop safely, identify the cause from the message and manual, correct it, then reset and home again if requested.
Mechanical or electrical faults go to maintenance. Keep guards and interlocks operating; removing an alarm by bypassing its protective input leaves the hazard in place. A program that ran before still needs review when stock, fixture, tool or offsets have changed.
Key Takeaways
- Syntax, geometry and logic errors need different checks.
- Valid code can still command a dangerous path.
- Simulation needs the real tools, holders, stock and fixture geometry.
- Trace inherited modes when a move looks wrong.
- Read and correct an alarm cause before resetting.
6.2 Prove out the setup and inspect the first part
A first run checks whether the physical setup and the program agree. Use a staged process so each approach can be assessed before it reaches the stock.
Start with the setup sheet
Match the program name and revision, stock size, clamping method, tool stations, offset numbers and work offset to the machine. Establish reference position as required. Check tool data and the work datum using a verified high position before moving over the part, then lower under controlled movement to a known checking height.
The tool-length offset must already be correct when comparing the displayed tool-tip height with a real gap. A work-offset check made with the wrong tool register tests the wrong relationship.
Distinguish three checks
| Function | What it does | What still needs checking |
|---|---|---|
| Air run | Moves through verified free space without cutting | Real cutting behavior and restored temporary shifts |
| Dry run | Changes commanded feed behavior | All positions and physical clearances |
| Machine lock | Prevents physical axis motion during program execution | Actual travel and clearances |
An air run may use a verified temporary raised Z work offset or a setup without stock. The whole path must clear clamps and machine structures. Restore and verify the production offset afterward. Dry run does not lift the tool; it can run feeds much faster, so do not use it to cut stock.
Watch the approach in single block
For the first cut, use single block, low rapid override and a reduced feed override suited to the cut. Keep feed hold ready. Before an approach, compare the displayed distance to go with the physical gap. If the screen expects 30 mm of travel but only 10 mm remains, stop before continuing and find the offset or position error.
Single block lets you inspect the next commanded movement; it does not make that movement safe. Feed hold normally leaves the spindle turning. Keep the working area protected during pauses and use the machine's safe access procedure before reaching in.
Enable optional stop if the program contains M01 between tools. These planned stops allow a feature to be checked before another operation hides it or removes its supporting material. After the job is proven, unnecessary optional stops can be disabled for production.
Release the batch from measurements
Carry out first-article inspection against the drawing. Measure all critical dimensions and the other dimensions where practical, record results and compare each with its tolerance. Appearance alone cannot establish a bore diameter or pocket depth. Correct and recheck before releasing a batch.
If execution must restart, use the approved restart procedure at a tool-section beginning that re-establishes modes, work and tool offsets, spindle and coolant. Starting at an arbitrary cutting block can omit the state needed to interpret it correctly. After recovery, check position and the next approach before resuming the cut.
Key Takeaways
- Check the setup sheet against the physical job.
- Dry run changes feeds; an air run requires actual clearance.
- Single block and low rapid override support controlled first approaches.
- Compare distance to go with the physical tool-to-part gap.
- Measure and record the first part before releasing production.
- Restart from a section that establishes all needed modes.
6.3 Use measurements to correct and improve a proven job
A dimension error becomes a useful correction only after its cause is known. Measure the feature, choose its target and decide whether the error belongs to tool wear, setup, workholding or another cause.
Aim inside the tolerance
For Ø30.00 with a tolerance of 0 to −0.04 mm, the permitted interval is 29.96–30.00 mm. Its midpoint target is 29.98 mm. Define deviation as measured size minus target size.
A measured diameter of 30.03 mm has a +0.05 mm deviation. On a lathe whose X wear table uses diameter values, reduce that tool's X wear by 0.05 mm. The edge moves inward radially by 0.025 mm and the next diameter decreases by 0.05 mm. Leave the measured geometry value unchanged.
Correct radius and length wear
For a compensated outside contour measuring 50.08 mm across instead of 50.00, the excess is 0.04 mm on each side. With a radius-valued D register, reduce D wear by 0.04 mm. The cutter center moves closer to both finished edges.
A 29.96 mm pocket that should be 30.00 mm needs 0.02 mm removed from each wall. Reduce D wear by 0.02 mm: the smaller effective cutter radius lets the real edge reach farther outward inside the pocket. The same sign can correct an outside feature that is too large and a pocket that is too small.
For a step measuring 4.90 mm deep with a 5.00 mm target, reduce H length wear by 0.10 mm under G43. This commands the spindle 0.10 mm lower, making the same tool cut deeper. Reinspect after each correction.
Diagnose the pattern first
A steady size drift can come from wear or temperature change. Identify which before adjusting. Random scatter suggests inconsistent seating, chips or loose clamping; a large sudden change suggests a broken insert, incorrect offset or setup error. Repeated wear adjustments cannot stabilize a loose workpiece.
Geometry is the basic tool measurement; wear is the small adjustment. After replacing and measuring a tool, clear its old wear correction so the new edge does not inherit the previous tool's history.
Improve time, tool life and material use
Cutting time is path length divided by feed. A 1 200 mm contour takes 2.0 min at 600 mm/min or 1.5 min at 800 mm/min, if the tool, workholding and part can support the higher feed. That 0.5 min saving concerns cutting time; tool changes, rapid travel and stops still contribute to the total cycle.
First look for unnecessary air cutting and repeated tool changes. Shorten safe approaches, group work by tool and use the tool maker's cutting data. Maintain chip evacuation and suitable coolant or dry-cutting practice; a feed too low can rub. Avoid heavy full-width entries and use climb milling where suitable.
Smaller sensible stock allowances, practical nesting and useful offcuts can reduce waste. After an improvement, simulate, prove out and save a new revision with the change noted. Compare its measured parts, tool behavior and cycle time before accepting it for the batch.
Key Takeaways
- Choose the tolerance midpoint and calculate measured size minus target.
- Use diameter-valued X wear corrections as diameter changes.
- Radius-valued D corrections act on each side of a feature.
- Negative H wear under G43 lowers the tool for a deeper cut.
- Identify wear, thermal drift, scatter or breakage before correcting.
- Verify improvements through simulation, prove-out and measurement.
CNC Machining examples
1Locate a plate on a CNC mill
13 steps
- 1IntroductionConnect the numbers to the part
A drawing gives a hole position, but the machine must connect that position to the clamped part. Follow three connections: the control moves an axis, the axis name gives its direction, and work zero gives its origin. You will trace a point above a plate and check why a correct-looking coordinate can still land in the wrong place.
- 2ExplanationFollow one position command
The control reads a target position and sends movement commands to a drive. The motor and ball screw move the axis, while an encoder or scale reports actual position.
A closed-loop control compares the report with the target and corrects the difference. This checks movement toward the commanded point; it does not decide whether that point matches the drawing.
- 3ConnectionChoose what rotates
On a lathe, the spindle turns the work while the tool moves mainly in X and Z. On a machining center, the spindle turns the tool and the relative path uses X, Y and Z.
A router also turns its cutter, often at high rpm over a vacuum-held panel. The coordinate ideas transfer across these machines, but workholding and cutting data must suit the job.
- 4ChallengeInterpret a pause
The operator presses feed hold during an approach. Is it safe to reach toward the cutter just because the axis has stopped? Explain the relevant panel behavior.
---reveal---
No. Feed hold normally pauses axis feed while the spindle keeps turning. Keep the working area guarded and follow the machine's safe access procedure. Emergency stop and feed hold have different effects; a pause is not permission to enter the working area.
- 5ExplanationKeep the tool viewpoint
Imagine that the part stays still and the tool moves over it. On a typical vertical mill, +X is right, +Y is toward the column and +Z is up.
If the real table moves left, the tool has moved right relative to the part: that is +X. Read coordinates from this relative viewpoint so table motion does not reverse your interpretation.
- 6ExampleLocate a point above the plate
Set work zero at the front-left corner of the top face. A tool-tip point 26 mm right, 18 mm back and 12 mm above the top is
X26.0 Y18.0 Z12.0. Each sign follows the axis direction from that corner. A cutting depth 4 mm below the same face would instead use Z−4; the XY location can stay unchanged. - 7Key InsightDouble a radial change for lathe X
On a diameter-programmed lathe, X describes the full diameter at the tip. Reducing X from 42 to 38 mm moves the edge inward by 2 mm, not 4 mm. Z remains an ordinary axial distance. Keep this difference in mind when translating a radial depth of cut into a coordinate or a diameter-valued wear correction.
- 8ChallengeName the indexed axis
A mill fixture turns about X to present a new face. After the rotary movement stops, the tool cuts with the linear axes. What is the rotary-axis name, and what kind of machining is this?
---reveal---
Rotation about X is the A axis. Reaching a fixed rotary angle before cutting is indexed machining. The additional axis changes the orientation of the setup; it does not require all axes to move together during the cut.
- 9ExplanationGive each zero point its own job
Machine zero is the builder's fixed coordinate origin. Homing reaches a known reference point so an incremental-encoder machine can establish its position.
Work zero is your chosen part datum. The work offset stores where that datum is in the machine. A tool offset separately locates the cutting tip relative to the spindle or turret reference.
- 10ExampleAdd the work coordinate to the datum
Suppose G54 X is −390.000 and G54 Y is −220.000. The point X26 Y18 is at machine X−364.000 and Y−202.000. Add each local coordinate to the stored datum location. The program can keep X26 Y18 if the fixture moves; measuring a new G54 then reconnects the same drawing point with the new physical location.
- 11TipCheck the height before crossing
Before checking a datum position, establish verified clearance with the correct tool length active. Move in XY while above the job, then lower under controlled movement to a known checking height and compare with a gauge.
Confirm the register name too: a measured G55 cannot locate the job for a program that calls G54.
- 12ChallengeSeparate a moved datum from a tool error
The same local hole program runs correctly in vise 1 using G54. Vise 2 has its own measured datum in G55, but the operator repeats the program with G54 still active. What needs changing?
---reveal---
Select the measured G55 datum for vise 2 and verify the next approach. The local hole coordinates still describe the part correctly. Editing tool lengths would not locate the second vise, and editing every hole coordinate would hide the missing datum selection.
- 13RecapRead the next position as a setup
For any commanded point, identify the machine and active modes, read the axes as tool motion relative to the part, and find the selected work datum. Tool data then locates the actual cutting tip. When the physical position disagrees with the program, trace those connections before changing individual drawing coordinates.
2Build and check a point table
11 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionKeep one shape through two coordinate modes
- 2ExplanationRead the active coordinate mode
- 3ExampleSubtract coordinates one axis at a time
- 4ExampleClose the path and check its sums
- 5ChallengeRecover after a reference return
- 6ExplanationCalculate from a chosen drawing datum
- 7ExampleLocate two tangencies and a center
- 8ExampleUse the taper half-angle
- 9ChallengeFind a hole from a circle
- 10ChallengeTranslate a lathe chamfer into an increment
- 11RecapCheck geometry and interpretation separately
3Read a job from safety block to program end
20 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionRead a tool section as a sequence
- 2ExplanationRead the address and value together
- 3ExampleEstablish the mill modes
- 4ChallengeFind the conflicting group
- 5ExplanationApproach with a clear route
- 6ExampleWork out a center-format quarter-circle
- 7ChallengeKeep the center tied to the start
- 8ExplanationStart the selected cutting tool
- 9ExampleCalculate speed, then feed
- 10ChallengePredict the lathe speed limit
- 11ExampleOffset the center around a plate
- 12ExampleSeparate the plunge from the contour
- 13ExplanationExpand one drilling-cycle block
- 14ChallengeReturn high before the obstacle
- 15ConnectionChange to the lathe conventions
- 16ExampleFace and locate the chamfer
- 17ExampleCarry compensation through the slope
- 18ChallengeCheck the depth of a roughing cut
- 19ChallengeRead the same code on two machines
- 20RecapTrace state through the next cut
4Use the right offset for the right distance
10 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionLocate the real edge
- 2ExplanationMeasure from the machine reference
- 3ExampleCalculate a gauge-line height
- 4ChallengeKeep a new insert from inheriting wear
- 5ExplanationLook along the contour
- 6ExampleEnter on a clear straight movement
- 7ChallengeCheck fit before changing the offset
- 8Key InsightSeparate the imaginary tip from contact
- 9ChallengeDiagnose two different size errors
- 10RecapKeep tool data organized by function
5Take a pocket and a panel from dimensions to code
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionChoose how to calculate the path
- 2ExplanationMake the digital setup match
- 3ExampleSeparate depth from wall allowance
- 4ChallengeFind the origin mismatch
- 5ExplanationTranslate for the real machine
- 6ConnectionUse the control dialog for a simple feature
- 7ExampleRemove the panel edge trim
- 8ExampleCount rows and columns with the gaps
- 9ChallengeCalculate yield from the original panel
- 10TipKeep small parts held and identified
- 11ChallengeSeparate a correct post from a correct setup
- 12RecapCarry the setup through every stage
6Find a fault and release a measured first part
14 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionCheck the whole job in stages
- 2ExplanationLook beyond a successful code read
- 3ExampleTrace the inherited rapid
- 4ChallengeRead a plausible but wrong hole
- 5ExplanationCheck the machine against the sheet
- 6Key InsightKeep air run and dry run distinct
- 7ExampleCompare travel with the real gap
- 8ChallengePlan the pause before production
- 9ExampleChoose the target before the correction
- 10ChallengeCorrect a pocket with radius wear
- 11ExplanationRead the measurement pattern
- 12ExampleCalculate the whole time change
- 13ChallengeChoose a correction from a fault pattern
- 14RecapRelease a proven revision
CNC Machining practice questions
Set 1: Machine movement and datum choices10 Practice Questions
Question 1 of 10
Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
Show answerHide answer
Question 7 of 10
G91 X24.0 Y-7.0, then G90 X9.0. What is its final XY position?Show answerHide answer
Question 8 of 10
Show answerHide answer
Question 9 of 10
Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Coordinate changes and circular paths10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
G01 X45.0 F260 is followed by Y18.0. How does the second block move?Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
X250?Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
G03 X38.0 Y26.0 I0.0 J16.0. An editor changes only G03 to G02. What path now results?Show answerHide answer
Save this lesson to see this answer.
Set 3: Milling cycles, tool data and compensation10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
T4 M06 request on a machining center?Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 4: Turning profiles and measured corrections10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
T0307 select?Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
G50 S2400 and G96 S180. What rpm does it command at Ø18, and near what diameter does the speed ceiling first become active?Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
G50 S1800, G96 S150 and G99 F0.20 to cut a 36 mm straight length at constant Ø20. Ignoring approach time, what are the actual rpm, axial feed and cutting time?Show answerHide answer
Save this lesson to see this answer.
Set 5: CAM setups, control dialogs and panel yield10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 6: Prove-out decisions and production diagnosis10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
G91 G28 Z0.0, then G00 X44.0 Y26.0, with no intervening mode change. What XY destination results, and what edit restores the intended absolute destination?Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
Absolute coordinates
Air run
Arc-center offset
B
Ball screw
Block
C
CAM
Canned cycle
Chain dimension
Circular interpolation
Clearance height
Closed loop
CNC
Constant surface speed
Control dialect
Conversational programming
Cutter radius compensation
Cutting speed
Cycle time
D
D register
Deviation
Diameter programming
Distance to go
DNC
Dry run
Dwell
E
Edge finder
F
Facing
Feed hold
Feed per revolution
Feed per tooth
Feed-start height
Finishing allowance
First-article inspection
G
Geometry error
Geometry offset
H
Half-angle
I
Imaginary tool tip
Increment
Incremental coordinates
Indexed machining
L
Lead-in
Lead-out
Linear axis
Linear interpolation
Logic error
M
Machine lock
Machine zero
Material yield
MDI
Modal command
N
Nesting
Non-modal command
O
Overtravel alarm
P
Parting off
Peck drilling
Pitch circle diameter
Point table
Position feedback
Post-processor
R
R level
Rapid traverse
Reference point
Right-handed coordinate system
Rotary axis
Roughing cycle
S
Safety block
Servo drive
Setup sheet
Simulation
Single block
Spindle gauge line
Spindle speed
Spoilboard
Stepdown
Stepover
Syntax error
T
Tangent point
Tapping
Tip orientation
Tolerance midpoint
Tool life
Tool nose radius compensation
Tool presetter
Tool-length offset
U
U/W addressing
W
Wear offset
Word
X37.0 gives an X coordinate, while F240 gives a feed interpreted through the active feed mode."Work offset
Work zero
Working plane
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.