CNC Programming, Setup and Operation
CNC questions test whether you can read and edit a program, set offsets correctly, and recover from a fault without crashing. Expect G-code interpretation, work and tool offsets, cutter compensation, canned cycles, and safe proving procedures.
Structure of a program
Programs are modal: G90/G91 (absolute/incremental), G20/G21 (inch/metric), and G94/G95 (feed per minute/per revolution) stay active until changed. G00 is rapid, G01 linear feed, G02/G03 circular interpolation. G54–G59 select work offsets; G43 applies tool length compensation with an H number; G41/G42 apply cutter radius compensation left or right with a D number. Cancel with G40 and G49 before the end of the program.
Lathe specifics
G96 selects constant surface speed, where RPM = (3.82 × CSS) ÷ diameter, and G50 caps maximum RPM so a facing cut toward centre does not overspeed the chuck. G84 taps; G76 threads.
Setting and proving
Set work offsets by touching the part or using a probe, then verify with a dry run, single block, distance-to-go display, and graphics. Confirm the tool length offset sign and the first Z approach on every new setup. Restarting mid-program requires re-establishing modal states, offsets, and cutter compensation - the machine does not remember what you did before power-down.
Worked example
A program contains G96 S180 M03 and G50 S2000. Facing a Ø100 mm bar, RPM = (3.82 × 180) ÷ 3.937 = 175 rpm. As the tool reaches Ø25 mm, the calculated RPM is 699, still below the 2000 cap; the cap only takes control near Ø17 mm. Reasoning: CSS holds cutting speed constant by raising RPM as diameter falls, and the G50 limit protects the chuck and workholding.
Cutter compensation
Lead in with a linear move at least the tool radius long, perpendicular or tangent to the contour. Apply comp with G41 on the first move into the part and cancel with G40 on a move away. Never change comp during an arc.
Traps
Forgetting G40 before returning to a safe position; using absolute coordinates when the program is modal G91; entering a tool length offset with the wrong sign; dry running with feed override high; and assuming a graphic simulation proves the offsets are correct.