As always reference the LinuxCNC manuals and the LinuxCNC Wiki for more information.

Linear Moves

A linear move is one that goes from the current position to the programmed position in a straight line. LinuxCNC has two basic linear moves G0 and G1. G0 is a rapid linear move that moves at the maximum speed of the machine. G1 is a feed linear move that moves at the speed set by the F word.

Sample Rapid Linear Move
G0 X1.200 Y-2.300 Z0.100
Sample Feed Linear Move
G1 X1.200 Y-2.300 Z0.100 F25
X0 Y4.3
Note
The following examples use absolute arc distance mode and absolute distance mode unless specificed.

Circular Feed Moves

A circular feed move uses G2 and G3. The direction is always as viewed from the positive end of the axis that is perpendicular to the active plane… whew that is a mouthful. For a typical mill type of device this means you look down from the top and G2 will go clockwise and G3 will go counter clockwise.

Center Format Arcs

Center format arcs are more accurate than radius format arcs and are the preferred format to use. Center format arcs start from the current position and need the end point and the offset from the current position to the center of the arc.

Programming an Arc

Programming an Arc for a Mill
  1. The active plane needs to be G17 the XY plane.

  2. The Current position is the start of the arc.

  3. The End Position is the end of the arc.

  4. The Offsets are I for X offset and J for Y offset.

The start point and end point are fairly easy to come up with, what trips most people up is the offsets. Starting with the X offset if the center of the circle is on the positive side of the start position then the I offset is a positive number. If the center of the circle is on the negative side of the start position then the I offset is a negative number.

The easiest way to calculate the arc is with a cad program like Qcad. Lets create a simple arc that has the following characteristics.

  • Start position is X0.4000 Y0.1000

  • End position is X0.4894 Y0.4789

  • Arc center is at X0.4000 Y0.3000

If you draw this out in Qcad you can see that the arc center is same as X start and 0.2000 in the Y direction from the start point. The following image shows the CAD drawing used in this example. The arc center is the red circle with the blue dot in it and the arc is the red dotted line. The red cross is the X0 and Y0 point.

images/arc01-dxf.png
Figure 1: Arc-01 Cad

First we have to move to the start position so if your following along with the Axis simulator in the MDI window issue the following G code:

G0 X0.4000 Y0.1000

Now lets work out the arc… the end postion is X0.4894 Y0.4789 so the first part if the G code is

G3 X0.4894 Y0.4789

The offset from the start position is the same as the X location so I0.0000 is the X offset. The center of the arc is 0.2000 from the start postion in the Y axis so the Y offset is J0.2000. Our completed code looks like this:

G3 X0.4894 Y0.4789 I0.0000 J0.2000 F25

Now you say what is the F doing in there, well this is a feed move and my assumption is no feed rate has been set so I explicitly set one. This made a CCW direction arc as shown in the following image.

images/arc03.png
CCW Arc Example
G0 X0.4000 Y0.1000 (we must move to the start point)
G2 X0.4894 Y0.4789 I0.0000 J0.2000 F25
Offset Direction Mill

The following chart shows the sign of the offset for an arc in the G17 (XY) plane. The view is as seen from the top of the mill looking down through the Z axis. The axis directions are the same way the tool will move when you press the plus and minus direction keys for that axis. Looking at the diagram the center mark is the start of the arc and the quadrant the center falls into shows the sign for the offsets.

images/arc-offsets-mill.png