CNC Lathe CAM Simulator and G Code Generator (2-Axis FANUC Lathe)

6 September 2026

Mentor CNC Editör Ekibi

With this free CNC lathe CAM simulator and G code generator you can program a complete part on a 2-axis FANUC lathe from start to finish: pick the ISO material group, enter the bar diameter, length and jaw grip, describe the part features card by card (steps, tapers, chamfers, fillets, grooves, threads, holes, bores, parting) and tick a tool type and nose radius for every operation. The tool works out the operation sequence, computes nose radius compensation, selects speeds and feeds, writes FANUC 0i-T compatible CNC lathe G code with the G71, G70, G74, G75 and G76 canned cycles and a plain-English explanation on every line, and simulates material removal live in a 2D section view. The finished program can be copied or downloaded as a TXT file.

What does this CNC lathe simulator do?

The single-cycle simulators on this site — G71, G72, G74, G75 and G76 — each teach one cycle; this tool programs the whole part. In classic CNC turning programming courses the student memorises the code first and only later understands why the P–Q blocks carry those particular coordinates. Here the order is reversed: you describe the part, the tool does what a CAM system does behind the scenes and shows you the operation plan, the toolpath and the matching FANUC lathe G codes at the same time. Click a line in the code panel and the tool jumps to that point in the simulation; as the simulation runs, the active block is highlighted. Topics such as G96 constant surface speed versus G97 constant rpm, the G50 speed clamp, G71 Type I versus Type II, the G70 finishing cycle, G74 peck drilling, G75 grooving and parting, G76 multi-pass threading and imaginary tool nose direction are learned as motion rather than as text.

How to use it: six steps

  1. Material: Choose one of the ISO 513 main groups — P steel, M stainless steel, K cast iron, N aluminium and non-ferrous metals, S heat-resistant and titanium alloys, H hardened materials. A typical sub-material is selected automatically; change it if you like. Cutting speeds come from the same table as the CNC lathe speed and feed calculator.
  2. Stock and clamping: Enter the raw diameter, total bar length, facing stock and jaw grip length; choose a solid or pre-drilled bar. Z0 is always the machined front face and X is read as a diameter. The scaled section preview redraws on every change, and a length-to-diameter ratio above 4 triggers a vibration warning.
  3. Features: Add cards from the face toward the chuck: cylinder/step (with chamfer or fillet transitions), taper, R groove (spool), OD groove, external thread, parting; hole, bore, internal groove and internal thread. The tool validates the contour: no diameter may exceed the raw diameter, feature lengths may not exceed the machinable length, an internal thread needs the correct pre-bore, and a back cut switches the roughing to G71 Type II.
  4. Operations and tools: The operation plan is derived automatically (facing, centre drill, drilling, bore roughing/finishing, OD roughing/finishing, grooving, threading, parting). For each operation pick a tool from the schematic — CNMG 80° roughing, DNMG 55°, VNMG 35° finishing and neutral tools, RCMT round insert, grooving and parting blades, threading insert, boring bar, drill, centre drill — and tick the nose radius. The imaginary tip direction and the allowed back-cut angle come with the tool; if the profile has a slope the tool cannot reach, you get a warning.
  5. Solution board: vc, n, fn, ap, number of passes, G71 U/W allowances, G74 peck depth, G75 plunge step, G76 first-pass depth and pass count are computed automatically and can all be overwritten. Metal removal rate, cutting power, torque, estimated Ra and cutting time are shown for information. Leaving the Turning Handbook rules (feed limit per nose radius, ap ≥ 2/3·RE, half feed near the centre when parting) raises a warning.
  6. Code and simulation: The program is generated and the simulation plays. You get play, pause, stop, single block forward/back, a timeline slider and speed control. A rapid move (G00) through material raises a collision warning, and the deviation between the finished part and the nominal contour is reported. Copy the code or download it as TXT.

Supported turning operations and FANUC cycles

FeatureOperationGenerated codes
FaceFacing (by facing stock, one or more passes)G00, G01, G96
Cylinder, step, taper, chamfer, filletOD roughing and finishing; compensated P–Q contour blocksG71 Type I, G70, G01, G02/G03
R groove (spool) and back-cut profilesPocketed profile roughing (X and W0 in the first P block)G71 Type II, G70
OD and internal groovePlunging; Z side-stepping for grooves wider than the bladeG75 R / G75 X Z P Q F
External and internal threadMetric 60° multi-pass threading at constant rpmG97, G76 P Q R / G76 X Z P Q F
HoleCentre drilling and peck drillingG97, G01, G74 R / G74 Z Q F
BoreStepped bore roughing with a boring bar (negative U) and finishinginternal G71, G70
PartingCut-off; half feed near the centreG75 (two stages)

The program header always opens with a safe line: G21 G18 G40 G99, then the G50 S… speed clamp and G54; every operation has a T0101-style tool call, G96 S… M03 (G97 for drilling and threading) and a G00 approach to the safe point. Operations are separated by G28 U0 W0, and the program ends with M09 and M30. This template is for FANUC 0i-T / 0i-TF G code system A; for Mitsubishi, Siemens ShopTurn or Haas you will need to adapt the header lines and cycle syntax to your own control. For the cycle parameters see the G71 rough turning cycle, G75 grooving and cut-off cycle, G76 threading cycle and G74 peck drilling cycle guides.

Where do the speed and feed values come from?

The tool uses an average cutting speed (vc) for the selected ISO material group and multiplies it by a tool factor (finishing 1.15; grooving 0.8; threading 0.6). For roughing, the feed (fn) comes from the Handbook table for the chosen nose radius; for finishing it is derived from a target surface roughness (Ra 3.2 µm). These are not values computed for a specific insert, grade or coating — they are starting values. Spindle speed, metal removal rate and thread values follow the classic formulas:

QuantityFormulaUnit
Spindle speed nn = (1000 × vc) / (π × D)rpm
Speed at the smallest diameter (G96)n = min(1000 × vc / (π × Dmin), G50 S)rpm
Metal removal rate QQ = vc × ap × fncm³/min
Cutting power PcPc = (Q × kc) / 60 000kW
Cutting torque McMc = (Pc × 9550) / nNm
Estimated surface roughness RaRa ≈ fn² / (8 × RE)µm
Number of roughing passes(Dstock − Dmin − U) / (2 × ap)—
Thread height h (external / internal)h = 0.6134 × P  /  h = 0.5413 × Pmm
G76 first pass depth ΔdΔd = h / √Nmm

Why is nose radius compensation done without G41/G42?

When chamfers, tapers and radii are turned, the rounded cutting edge causes a deviation from the nominal dimension. Instead of leaving the correction to the control, this tool computes it on the CAM side: the nominal contour is offset by the finishing tool's nose radius and imaginary tip direction, corner intersections are found with the r × (1 − tan α/2) logic, and the compensated coordinates are written straight into the P–Q blocks. The table in step four lists nominal and program values with ΔX and ΔZ for every point; for a 2×45° chamfer on Ø30 with an R0.8 insert, for example, the program point becomes X25.063 Z−2.469. This is the most transparent route for a student learning the calculation by hand; if you use G41/G42 on the machine, see the tool nose radius compensation (G40, G41, G42) guide.

Who is it for? Vocational schools, colleges, universities and operators

The tool is designed for vocational high school machining and CNC operator classes, technical college and community college machining programmes, and university mechanical engineering manufacturing courses that need a hands-on way to teach CNC lathe programming. Before stepping up to the machine, students can try G71 cycle examples, a G76 threading program, grooving and drilling cycles on the same part and see how the code and cycle time change when the cutting speed or nose radius changes. It is also a practical refresher of the FANUC program structure for people preparing for CNC operator training or starting their first job on a lathe. It pairs well with CNC Lathe Training Lesson 6: Basic Programming and Lesson 7: Canned Cycles (G71, G70, G76).

Frequently asked questions

Can I send the generated code straight to my machine?

No, adapt it first. The code uses FANUC 0i-T G code system A syntax; tool numbers, offsets, the G50 speed clamp, the safe point and the chuck and tailstock situation must be set for your machine. The simulation runs on a 2D section and does not check collisions with the turret, holders or chuck jaws. Run a graphic check and a dry run on the machine for every program.

How does it choose between G71 Type I and Type II?

If the profile is monotonic in X (diameters only grow toward the chuck), Type I is used and only X is written in the first P block. For profiles with pockets — an R groove, a spool or a back cut — the tool switches to Type II, writes X… W0 in the first P block and recommends a 55° or 35° insert for roughing. According to the FANUC 0i manual, Type II allows at most 10 pockets and the profile must be monotonic in Z; the tool checks this in step three.

What happens if there is no runout groove at the thread end?

You get a warning and G76 finishes the thread with an r = 1.0P chamfer. If you want a groove, add an OD groove card at the thread end; the tool recognises it and clears the warning. Thread height, minor diameter and the number of passes are shown instantly on the feature card.

What do I need before a bore, internal groove or internal thread?

A hole card (or a pre-drilled bar). Bores are ordered from Z0 inward with decreasing diameters and machined with a boring bar as internal G71 + G70. For an internal thread the pre-bore is expected to equal the minor diameter (D − 2 × 0.5413 × P); if not, the tool tells you which diameter to enter. A wall thinner than 1.5 mm raises a warning.

How is it different from the milling simulator and the single-cycle simulators?

The CNC milling CAM simulator programs a single operation (face, pocket, slot, hole, thread, contour) on a 3-axis machining centre. This tool generates the whole part in one program on a 2-axis lathe, with roughing done only through canned cycles. The single-cycle simulators (G71, G72, G73, G74, G75, G76, G92, G94) are for learning each cycle's parameters in isolation; here the same cycles appear in the context of a part, together with the operation sequence and tool selection.

Note

The speed and feed values in this tool are averages per material group; they are not computed for a specific tool, insert or coating. Recalculate them from your own tool catalogue. Use the CNC lathe speed and feed calculator, the surface roughness and turning feed calculator, the chip control and hex calculator for turning and the taper and chamfer angle calculator. For tool and insert codes see the cutting tool glossary.

Disclaimer

Mentor CNC Lathe CAM is a simulator for educational purposes only. The generated NC program, operation plan, tool suggestions, nose radius compensation, cutting data, power/torque and time estimates are teaching starting values; their accuracy, suitability and safety for any particular machine, control, tool, workholding or workpiece are not guaranteed. Before the program is run on a real machine it must be reviewed by a qualified instructor or operator and a dry run must always be performed. Mentor CNC cannot be held liable for machine damage, tool breakage, loss of workpieces or injury arising from the use of this tool. See our disclaimer page for details.