CNC Programming

CNC arc programming with G02, G03, R, and IJK

What CNC arc programming means in practice

CNC arc programming uses circular interpolation commands to move a cutting tool along an arc, radius, circle, or helix instead of approximating the shape with many short straight-line moves. In common G-code, the main commands are G02 for clockwise circular motion and G03 for counterclockwise circular motion. The programmer normally defines the arc with an end point plus either an R radius or I, J, and K center offsets.

The important part is not just knowing the codes. A valid arc also depends on the selected plane, the current start point, the controller’s IJK convention, and the limitations of radius-format arcs. Public controller documentation from Haas Automation, LinuxCNC, and Beckhoff describes the same basic concept, but with control-specific details. Production code should always be checked against the manual for the target machine.

arc dear triomphe, paris, blue sky, paris, paris, paris, paris, paris

This guide focuses on the shop-floor interpretation of arc moves: how to read them, when to use R or IJK, why full circles usually need center offsets, and what to check before running an unfamiliar program. For related programming fundamentals, see the CNC Programming section on MechMeld.

How G02 and G03 define circular motion

An arc block does not create a curve in isolation. It creates a curve from the machine’s current position to a programmed end point in the currently selected plane. That previous position is the start point of the arc. If the start point is wrong, the arc will also be wrong, even when the G02 or G03 line appears correct.

In the XY plane, selected with G17 on many milling controls, G02 is a clockwise move and G03 is a counterclockwise move when viewed from the positive Z direction. The same clockwise and counterclockwise concept applies in other planes, but the viewing direction and active axes depend on the control’s plane convention. Arc direction should therefore be interpreted together with G17, G18, or G19.

A basic arc block usually contains four kinds of information:

  • Motion command: G02 or G03.
  • End point: typically X and Y in the XY plane, or the corresponding axes in another plane.
  • Arc definition: either an R value or center offsets using I, J, and sometimes K.
  • Feed rate: commonly an F word, unless a valid feed rate is already active and allowed by the control.

The arc is a geometric instruction, not only a syntax pattern. The controller must be able to solve a valid circle from the current start point, the end point, and the radius or center data. If those values do not describe the same arc within the control’s tolerance, the result may be an alarm or an unexpected toolpath.

Arc planes and address words

Plane selection is one of the most common reasons arc code is misread. On a vertical machining center, many simple profiles are programmed in G17, the XY plane. Lathe work and some multi-axis operations may use different planes. Some controls retain the last selected plane modally, so a safe program usually states the intended plane near the beginning of the operation instead of assuming it.

Plane command Typical interpolation plane End point axes Center offset addresses Common use
G17 XY X, Y I, J Mill profiles, pockets, bolt circles, 2D contours
G18 XZ X, Z I, K Turning profiles, vertical arcs in XZ
G19 YZ Y, Z J, K Side-face work, special milling setups

The table reflects common ISO-style usage, but controller variations matter. Beckhoff documentation, for example, describes relative and absolute center-point modes for IJK under different modal settings. Many mill controls treat IJK as incremental offsets from the arc start point, but not every control or postprocessor setting is identical. The safe approach is to confirm whether IJK values are incremental center offsets, absolute center coordinates, or controlled by a parameter or modal command.

Using R values versus IJK center offsets

Many programmers learn radius-format arcs first because the code is compact. Instead of calculating the center point, the programmer gives the arc end point and the radius. For a simple corner radius, this can be quick to write and easy to review.

G90 G17 G21
G00 X0 Y0
G01 Z-2.0 F150
G02 X20.0 Y20.0 R20.0 F300

In this example, the tool starts at X0 Y0 and makes a clockwise arc to X20.0 Y20.0 with a 20 mm radius in the XY plane. The line is short, but it depends on the control choosing the correct arc from the start point, end point, radius, and direction.

Center-format arcs use IJK to define the center of the circle. On controls where IJK is incremental, I is the X distance from the start point to the center, J is the Y distance, and K is the Z distance when that axis belongs to the selected plane.

G90 G17 G21
G00 X0 Y0
G01 Z-2.0 F150
G02 X20.0 Y20.0 I20.0 J0.0 F300

Here, the center is 20 mm in X and 0 mm in Y from the start point, so the center is at X20.0 Y0.0 in the current coordinate system. This describes the same basic geometry more explicitly than an R value. Haas documentation presents IJK center definition as the preferred method for defining the center of an arc or circle, while LinuxCNC documentation states that center-format arcs are more accurate than radius-format arcs. The geometric reason is straightforward: the controller is given the center directly instead of solving it from a radius that may have two possible arc paths.

That does not make radius-format programming wrong. For ordinary fillets and simple arcs under 180 degrees, R format is widely used. The caution is that the same start point, end point, and radius can describe different possible arcs, and controller rules decide which one is used. LinuxCNC documentation notes a common convention in which a positive R indicates an arc under 180 degrees and a negative R indicates an arc over 180 degrees. Because not all controls handle every detail the same way, this convention should be verified before negative-radius arcs are used in production code.

Full circles, helical arcs, and controller limits

A full circle is a special case because the start point and end point are the same. With only an R value, the controller does not have enough unique information to determine a complete 360-degree path on many common controls. Controller documentation from Haas and Beckhoff describes full-circle programming through center-point data rather than radius-only arc format.

G90 G17 G21
G00 X40.0 Y20.0
G01 Z-2.0 F150
G02 I-20.0 J0.0 F300

In this example, the tool begins at X40.0 Y20.0. The center is 20 mm to the left of the start point, so the circle center is X20.0 Y20.0. With no separate end point, the center offset tells the control to make a complete circle on controls that support this syntax. Some controllers require a different full-circle format, so this type of block should be confirmed in the machine manual or proven in simulation before cutting material.

Helical interpolation combines circular movement in one plane with linear movement along the axis perpendicular to that plane. In the XY plane, a helical move adds Z movement while the cutter follows the arc. This is often used for thread milling, bore interpolation, ramping into a pocket, or producing smooth circular entry moves. See also: CNC Machining.

G90 G17 G21
G00 X0 Y0 Z2.0
G01 Z0 F100
G03 X10.0 Y-10.0 I10.0 J0.0 Z-2.0 F200

This block describes a counterclockwise arc in the XY plane while Z moves downward 2 mm. Whether a control permits this exact format, how it calculates feedrate along the helical path, and whether multiple-turn helixes need an additional word such as a turn count are controller-specific questions. For critical operations such as thread milling, the postprocessor and control manual should be treated as the authority.

Why small arc errors create large machining problems

Arc alarms can be difficult to diagnose because the visible difference in the code may be very small. A few decimals of rounding can make the radius from the start point to the center slightly different from the radius from the end point to the center. If the mismatch exceeds the control’s tolerance, the machine may stop with an arc-radius or invalid IJK alarm.

This is why arc precision matters in CAM posts. If a CAD/CAM system outputs coordinates to too few decimal places, the start, end, and center values may no longer define one clean circle. A programmer may see this after changing units, editing a posted file manually, or moving code between controls with different precision expectations. Increasing output precision in the postprocessor can solve some of these issues, but it should be done in a controlled way and tested.

Radius-format arcs have another limitation. LinuxCNC documentation warns that radius-format arcs near full circles or near semicircles can magnify small endpoint changes into much larger center-location changes. In practical terms, an R value may be acceptable for a short corner radius but less attractive for geometry where the center location must be controlled tightly. IJK center format usually gives the programmer and reviewer more information to verify.

A practical verification checklist before running arc code

Before running unfamiliar CNC arc programming, especially code edited by hand, use a short geometry-based checklist. It reduces guesswork and catches common mistakes that a syntax-only review can miss.

  • Confirm the start point. The arc begins wherever the previous block left the tool, not where the arc line appears to begin in isolation.
  • Confirm the active plane. Make sure G17, G18, or G19 matches the intended axes of the arc.
  • Check absolute versus incremental assumptions. G90 and G91 affect endpoint programming on many controls, while IJK center behavior may follow separate control rules.
  • For IJK arcs, calculate the center. From the start point, add the IJK offsets and verify that the start radius and end radius match.
  • For R arcs, decide whether the arc is under or over 180 degrees. If the arc is large, verify the control’s positive and negative R rules.
  • Avoid radius-only full circles unless the control explicitly supports them. Center-format programming is usually the safer route for 360-degree circles.
  • Review cutter compensation separately. Many controls require cutter compensation to be turned on or off with a lead-in or lead-out move, not in the middle of an arc block.
  • Simulate and dry run. Backplotting, single-block execution, distance-to-go displays, and running above the part are still valuable safeguards.

This checklist is especially useful when troubleshooting alarms. A message that appears to blame G02, G03, or IJK may actually come from the previous move, a modal plane left active from an earlier operation, or a postprocessor setting that does not match the machine.

How arc programming fits into modern CAM workflows

Many shops no longer handwrite every arc. CAM software often posts arcs automatically where the geometry supports them, and it may linearize complex surfaces into many short line segments where arcs are not appropriate. That does not make arc knowledge obsolete. It makes it more important for programmers who review posted code, troubleshoot alarms, tune postprocessors, or edit simple features at the control.

Good arc output can reduce program length and make simple circular geometry easier to inspect. At the same time, excessive arc fitting can cause problems if the postprocessor converts shapes into arcs that the control interprets differently. This can happen when code moves between machines, when a shop changes from one controller family to another, or when routers, mills, and lathes use different arc settings.

A practical shop standard should define which controls use incremental IJK, which controls allow negative R, how many decimal places the post should output, whether full circles should be split, and how helical moves should be posted. Those rules belong in the postprocessor and setup documentation, not only in the memory of one programmer.

Frequently asked questions

What is the difference between G02 and G03?

G02 commands a clockwise circular interpolation move, and G03 commands a counterclockwise circular interpolation move in the selected plane. The direction must be judged from the correct viewing direction for that plane, so the active G17, G18, or G19 command matters.

Should I use R or IJK for CNC arc programming?

Use R when the arc is simple, easy to verify, and clearly within the control’s radius-format rules. Use IJK when the center location matters, when programming full circles, when the arc is close to 180 degrees or 360 degrees, or when the shop standard prefers center-format arcs for reliability.

Can a full circle be programmed with R?

On many common controls, a full circle should not be programmed with only an R value because the start and end point are the same and the radius alone does not uniquely define the path. Center-format programming with IJK is the more typical method, but the exact syntax must be checked for the target control.

Why does my arc cut in the wrong direction?

The most likely causes are a wrong G02 or G03 direction, an unexpected active plane, an incorrect start point, reversed IJK signs, or a radius sign convention that does not match the intended arc. Review the previous block and modal settings before editing only the arc line.

Why does a CAM-posted arc alarm even though the drawing is correct?

The drawing can be correct while the posted numbers are not precise enough for the control. Rounding, unit conversion, postprocessor arc settings, or different IJK conventions can make the controller see an invalid circle. Backplot the code, compare start and end radii from the calculated center, and adjust the postprocessor if the issue repeats.