0% found this document useful (0 votes)
7 views33 pages

Comprehensive Guide to G Codes

The document provides a comprehensive guide on G codes used in CNC programming, detailing various commands for movement, tool compensation, and cycles. It includes a quick reference table, explanations of specific G codes like G0 for fast movement, G1 for linear movement, and G2/G3 for arc movements, along with conventions for programming. Additionally, it outlines the structure and usage of G codes, emphasizing the importance of parameters and optional values in CNC operations.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views33 pages

Comprehensive Guide to G Codes

The document provides a comprehensive guide on G codes used in CNC programming, detailing various commands for movement, tool compensation, and cycles. It includes a quick reference table, explanations of specific G codes like G0 for fast movement, G1 for linear movement, and G2/G3 for arc movements, along with conventions for programming. Additionally, it outlines the structure and usage of G codes, emphasizing the importance of parameters and optional values in CNC operations.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

G Codes

Index
Conventions
2. Quick Reference Table of G Code
3. G0 Fast Movement
3.1. Fast speed rate
4. Move Linear G1
5. G2, G3 Arc Move
5.1. Center format arches
5.2. Examples of center format
5.3. Radius Format Arches
6. G4 Dwell
Cubic spline G5
8. G5.1 Quadratic Spline
9. G5.2 G5.3 NURBS Block
10. Diameter Mode of the G7 Lathe
11. G8 Lathe Radius Mode
12. G10 L1 tool set
13. G10 L2 Set Coordinate System
14. G10 L10 tool set
15. G10 L11 toolkit
16. G10 L20 Define coordinate system
17. G17 - G19.1 Select Plan
18. G20, G21 Units
19. G28, G28.1 Go / Set Predefined Position
20. G30, G30.1 Go / Set Predefined Position
21. Synchronized Movement of Gear G33
22. G33.1 Rigid Screwing
Direct Probe G38.n
24. Compensation G40 deactivated
25. G41, G42 Tool compensation
26. G41.1, G42.1 Dynamic Tool Compensation
27. Tool Length Offset G43
28. G43.1: Tool Length Compensation Dynamic Displacement
29. G43.2: Apply additional length offset of the tool
30. G49: Cancel Tool Length Compensation
G53 Move in machine coordinates
32. G54-G59.3 Select coordinate system
33. G61, G61.1 Exact path mode
34. Mixture of paths G64
35. G73 drilling cycle with chip breaking
36. G76 Threading Cycle
37. Canned Cycles
37.1. Common words
37.2. Sticky words
37.3. Repeat the Cycle
38. Gather the way
37.5. Fixed cycle errors
37.6. Preliminary and intermediate movement
37.7. Why use a fixed cycle?
38. G80 Cancel the Canned Cycle
39. Drilling Cycle G81
40. G82 Drilling Cycle, Dwell
41. G83 Peck Drilling Cycle
42. G84 Right-hand tapping cycle
43. G85 Boring Cycle, Feed Out
44. G86 boring cycle, spindle stop, rapid movement
45. Rear mandrel cycle G87
46. Mandrel cycle G88, spindle stop, manual exit
47. G89 boring cycle, Dwell, Feed Out
48. Distance Mode G90, G91
49. Arc Distance Mode G90.1, G91.1
50. Displacement of the coordinate system G92
51. G92.1, G92.2 Redefine deviations G92
52. G92.3 Restore deviations G92
53. G93, G94, G95: Feed rate mode
54. G96, G97 Spindle Control Mode
55. G98, G99 Fixed cycle return level
1. Conventions
Conventions used in this section
In our G code prototypes, the hyphen (-) represents a real value and (<>) indicates an optional item.
It is written in a prototype, it will often be referred to as the number L, and so on, for any
another letter.
In our G-code prototypes, the word 'axes' represents any axis, as defined in its configuration.
An optional value will be written like this <L->.
A real value can be:
An explicit number, 4
An expression[2 + 2]
A parameter value, # 88
A value of the unary function, acos [0]

In most cases, if the words are provided (any or all of XYZABCUVW), they specify a
destination point.
The axis numbers are in the currently active coordinate system, unless explicitly described.
as if in the absolute coordinate system.
Where the axis words are optional, any omitted axis will retain its original value.
All items in the G code prototypes that are not explicitly described as optional are mandatory.
The following letter values are often given as explicit numbers. Unless otherwise indicated, the
explicit numbers can be real values. For example, G10 L2 could also be written as G [2 * 5] L [1 + 1]. If the
the value of parameter 100 was 2, G10 L # 100 would also mean the same.
It is written in a prototype, it will often be referred to as the number L, and so on, for any
another letter.

2. Quick Reference Table for G Code


Code Description
G0 Coordinated movement at a fast rate

G1 Coordinated movement in the feed rate

G2 G3 Coordinated helical movement at the feed rate

G4 To inhabit

G5 Cubic Spline

G5.1 Quadratic B-Spline

G5.2 NURBS, add control point

G7 Diameter Mode (lathe)

G8 Radius Mode (lathe)

G10 L1 Define tool table entry

G10 L10 Tool set, calculated, workpiece

G10 L11 Define table of tools, calculated, fixing

G10 L2 Configuration of the coordinate system origin

G10 L20 Calculated source coordinate system configuration

G17 - G19.1 Aircraft selection

G20 G21 Define units of measure

G28 - G28.1 Go to the preset position


Code Description
G30 - G30.1 Go to the predefined position

G33 Synchronized Movement of the Time Zone

G33.1 Rigid Tapping

G38.2 - G38.5 Survey

G40 Cancel cutter compensation

G41 G42 Cutter Compensation

G41.1 G42.1 Dynamic Cutter Compensation

G43 Use the tool length offset from


from the tools table

G43.1 Dynamic tool length displacement

G43.2 Apply additional length offset


tool

G49 Cancel the tool length offset

G53 Move in the machine coordinates

G54-G59.3 Select the coordinate system (1 - 9)

G61 G61.1 Path control mode

G64 Trajectory control mode with optional tolerance

G73 Drilling cycle with chip breaking

G76 Multi-pass Threading Cycle (Lathe)

G80 Cancel movement modes

G81 Drilling Cycle

G82 Drilling Cycle with Dwell

G83 Peck Drilling Cycle

G85 Flat cycle, without interruption, feeding

G86 Flat cycle, Stop, Rapid Out

G89 Boring Cycle, To inhabit, To feed

G90 G91 Distance Mode

G90.1 G91.1 Arc Distance Mode

G92 Displacement of the coordinate system

G92.1 G92.2 Cancel G92 compensations

G92.3 Restore the G92 offsets

G93 G94 G95 Feeding Methods

G96 Time Zone Control Mode

G98 G99 Closed Cycle Z Collection Method

3. G0 Fast Movement

Axes G0
For rapid movements, program the G0 axes, where all axis words are optional. OG0 is optional if the
current movement mode for G0. This will produce coordinated movement to the destination point at maximum rate.
fast (or slower). G0 is typically used as a positioning movement.

3.1. Rapid speed rate


The MAX_VELOCITY setting in the [TRAJ] section of the ini file defines the maximum rapid feed rate.
maximum rapid advance can be greater than the MAX_VELOCITY setting of each axis during a movement
coordinated. The maximum rapid movement rate may be slower than the MAX_VELOCITY setting in the section
if a MAX_VELOCITY axis or trajectory constraints limit it.

Example G0

G90 (set to absolute distance mode)


G0 X1 Y-2.3 (Rapid linear move from the current position to X1 Y-2.3)
M2 (final program)

See the sections G90eM2for more information.

If the cutter compensation is active, the movement will be different from above; see the Section ofCompensationdo
Cutter.
If G53 is programmed on the same line, the movement will also be different; see Section G53 for more.
information.
The path of a rapid movement G0 can be rounded during direction changes and depends on the settings.
oftrajectory controland of the maximum acceleration of the axes.
It is a mistake if:

A letter from the axis is of no real value.

An axis letter is used and is not configured.

4. Move Linear G1

Axes G1

For linear motion (straight line) in theadvance ratescheduled (for cutting or not), programG1 'axes', where
All words of the axis are optional. OG1 is optional if the current movement mode is G1. This will produce
coordinated movement to the destination point at the current feed rate (or slower).

Example G1

G90 (define absolute distance mode)


G1 X1.2 Y-3 F10 (linear movement at a feed rate of 10 from the current position to X1.2 Y-3)
Z-2.3 (linear movement at the same feed rate from the current position to Z-2.3)
Z1 F25 (linear movement at a feed rate of 25 from the current position to Z1)
M2 (final program)

See the sections G90&F& M2for more information.

If the cutter compensation is active, the movement will be different from the above; see Section ofCompensationdo
Cutter.
If G53 is programmed on the same line, the movement will also be different; see Section G53 for more.
information.
It's a mistake if:

No feeding fee has been set.


A letter from the axis is of no real value.

An axis letter is used and is not configured.

5. G2, G3 Arc Move

Displacements of axes G2 or G3 (central format)


G2 or G3 R- axes (radius format)
Compensations G2 or G3 | R- <P-> (whole circles)
A circular or helical arc is specified using G2 (clockwise arc) or G3 (counterclockwise arc)
nafeeding ratecurrent. The direction (CW, CCW) is viewed from the positive end of the axis on which it occurs
circular motion.
The axis of the circle or helix must be parallel to the X, Y, or Z axis of the machine's coordinate system. The axis (or,
similarly, the plane perpendicular to the axis) is selected with G17 (Z axis, XY plane), G18 (Y axis, XZ plane) or
G19(X-axis, YZ plane). The planes 17.1, 18.1, and 19.1 are not currently supported. If the arc is circular, it stays in a
plane parallel to the selected plane.
To program a helix, include the word of the axis perpendicular to the plane of the arc: for example, if in the G17 plane,
Include a Z axis. This will cause the Z axis to move to the programmed value during the XY circular motion.
To program an arc that makes more than one complete turn, use the word specifying the number of turns.
completes more the scheduled arc. The word P must be an integer. If P is not specified, the behavior is
as if it had been given: that is, only a complete or partial turn would result. For example, if an arc of 180
degrees for programmed with a P2, the resulting movement will be 1 and 1/2 rotations. For each increment P above 1,
an extra full circle is added to the scheduled arc. Multi-turn helical arcs are supported and provide
useful movement for milling holes or threads.
If a line of code makes an arc and includes rotational axis movement, the rotating axes spin at a constant rate.
so that the rotational movement starts and ends when the XYZ movement begins and ends. Lines of this type
are almost never scheduled.
If the cutter compensation is active, the movement will be different from the above; see the Section ofCompensationdo
Cutter.
The center of the arc is absolute or relative, as defined by G90.1 or G91.1, respectively.
Two formats are allowed to specify an arc: Center Format and Radius Format.
It is a mistake if:

No feeding fee has been set.


The word P is not an integer.

5.1. Center format arches


Central format arches are more accurate than radius format arches and are the preferred format for use.
The endpoint of the arc, along with the shift to the center of the arc from the current location, is used.
to program arcs that are smaller than a complete circle. It is okay if the endpoint of the arc is the same as
the current location.

The displacement to the center of the arc from the current location and, optionally, the number of turns are used.
to program complete circles.
When programming arcs, an error due to rounding may result from using a precision of less than 4 decimal places.
decimals (0.0000) for inches and less than 3 decimal places (0.000) for millimeters.

Incremental Arc Distance Mode


Shifts of the arc center are a relative distance from the initial location of the arc. Arc Distance Mode
Incremental is the standard.

One or more words from the axis and one or more displacements must be programmed for an arc less than 360.
degrees.
No axis word and one or more offsets must be programmed for full circles. The word Foot
standardized as 1 and is optional.
For more information on 'Incremental Arc Distance Mode, refer to section G91.1.

Absolute Arc Distance Mode


Shifts of the arc center are the absolute distance from the current position 0 of the axis.
One or more words of the axis and both displacements must be programmed for arcs less than 360 degrees.
No word of the axis and both displacements must be programmed for complete circles. The word Foot
standardized as 1 and is optional.
For more information about the Absolute Arc Distance mode, see section G90.1.

XY Plan (G17)

G2 or G3 <X- Y- Z- I- J- P->

Z-helix
Displacement I-X
J- displacement of Y
P - number of shifts

Plan XZ (G18)

G2 or G3 <X- Z- Y- I- K- P->

Y-helix
DisplacementI-X
Displacement K- Z
P - number of turns

Plane YZ (G19)

G2 or G3 <Y- Z- X- J- K- P->

X-helix
J - displacement of Y
Displacement K-Z
P- number of shifts

It is an error if:

No feeding fee is defined with the wordF.


No displacement is scheduled.
When the arc is projected onto the selected plane, the distance from the current point to the center differs from the distance from the point.
final at the center in more than (0.05 in./5 mm) OR ((.0005 in./in.) .005 mm) AND .1% of the radius).

Deciphering the error message Oraio at the end of the arch differs from the radius to start:
start - the current position

center - the central position calculated using the words i, j, or k


end- the scheduled period
r1 - radius from the initial position to the center
r2 - radius from the final position to the center

5.2. Examples of center format


Calculating arcs by hand can be difficult sometimes. One option is to draw the arc with a CAD program to obtain the
coordinates and compensations. Keep in mind the tolerance mentioned above, you may need to change the precision of
your CAD program to achieve the desired results. Another option is to calculate the coordinates and compensate using
formulas. As you can see in the following figures, a triangle can be formed from the current position of the position
end and center of the arc.
In the following figure, you can see that the initial position is X0 Y0, the final position is X1 Y1. The center position of the arc is at
X1 Y0. This gives us a displacement from the initial position of 1 on the X axis and 0 on the Y axis. In this case, only one
displacement I is necessary.

Example line G2

G0X0Y0
G2X1Y1I1F10(arc clockwise in the XY plane)
Figure 1. Example G2

In the next example, we see the difference between the displacements for Y, whether we are making a G2 or G3 movement.
For G2 movement, the initial position is X0 Y0, for G3 movement, it is X0 Y1. The center of the arc is at X1 Y0.5 for
both movements. G2 moves the J offset is 0.5 and G3 moves the J offset is -0.5.

Example line G2-G3

G0X0Y0
G2X0Y1I1J0,5F25(arc in the clockwise direction in the XY plane)
G3X0Y0I1J-0,5F25 (arc in the counterclockwise direction in the XY plane)

Figure 2. Example G2-G3

In the next example, we show how the arc can make a helix on the Z axis by adding the letter Z.

Example of helix G2

G0X0Y0Z0
G17 G2 X10 Y16 I3 J4 Z-1 (helical arch with added Z)
In the next example, we show how to do more than one shift using the word P.

Example of word P

G0 X0 Y0 Z0
G2 X0 Y1 Z-1 I1 J0.5 P2 F25

In the center format, the radius of the arc is not specified, but it can be easily found as the distance from the
center of the circle to the current point or the endpoint of the arc.

5.3. Arc Formats of the Radius

Axes G2 or G3 R- <P->

R - radius of the current position

It is not a good practice to program arcs in the shape of a radius that are almost full circles or almost semicircles.
because a small change in the location of the endpoint will produce a much greater change in the location of the
center of the circle (and therefore halfway of the arc). The magnification effect is large enough for the error of
Rounding in a number can produce cuts outside of tolerance. For example, a displacement of 1% of
The endpoint of a 180-degree arc produced a displacement of 7% from the 90-degree point along the arc. Circles
Almost full ones are even worse. Other sizes of arcs (in the small range of 165 degrees or 195 to 345 degrees) are OK.
In the arc format, the coordinates of the endpoint of the arc in the selected plane are specified along with the radius of the
Arc. Program axes G2 R-(or use G3 instead of G2). R is the radius. The axis words are all optional, except
pelo fato de que pelo menos uma das duas palavras para os eixos no plano selecionado deve ser usada. O número R é o
A positive radius indicates that the arc rotates less than 180 degrees, while a negative radius indicates a rotation of more than
180 degrees. If the arc is helical, the value of the endpoint of the arc on the coordinate axis parallel to the axis of the helix is also
specified.
It is a mistake if:

Both words of the axis for the axes of the selected plane are omitted.
the endpoint of the arc is the same as the current point.

Example line G2

G17 G2 X10 Y15 R20 Z5(radius format with arc)

The example above creates a circular or helical arc in the clockwise direction (viewed from the positive Z axis) whose axis is parallel to the
Z axis, ending where X = 10, Y = 15 and Z = 5, with a radius of 20 If the initial value of Z is 5, this is an arc of a
circle parallel to the XY plane; otherwise, it is a helical arc.

6. G4 Dwell

G4 P

P- seconds to stay (floating point)

The number P is the time in seconds that all axes will remain stationary. The number P is a decimal number.
floating so that fractions of a second can be used. G4 does not affect the time zone, the coolant, and any I/O.

Example of line G4

G4 P0.5 (wait 0.5 seconds before continuing)

It is a mistake if:

The number P is negative or unspecified.

Cubic spline G5
G5 X- Y- <I- J-> P- Q-

I- X incremental displacement from the starting point to the first control point
J- The incremental displacement from the starting point to the first control point
P- X incremental displacement of the endpoint to the second control point
Incremental displacement Q- Y from the endpoint to the second control point

G5 creates a cubic B-spline in the XY plane using only the X and Y axes. P and Q must be specified for each command.
G5.
For the first G5 command in a series of G5 commands, I and J must be specified. For the commands
subsequent of G5, both I and J must be specified or neither of them. If I and J are not specified, the
the initial direction of this cube will automatically correspond to the final direction of the previous cube (as if I and J were the
negation of P and Q predecessors.
For example, to program a curved shape of N:

G5 Example of initial cubic spline

G90 G17
G0 X0 Y0
G5 I0 J3 P0 Q-3 X1 Y1

A second curvilinear N that smoothly connects to this one can now be made without specifying I and J:

G5 Subsequent cubic spline sample

G5 P0 Q-3 X2 Y2

It is a mistake if:

P and Q are not specified


Only one of I or J is specified
I or J are not specified in the first of a series of G5 commands.
A different axis than X or Y is specified
The active plan is not the G17.

8. G5.1 Quadratic Spline

G5.1 X- Y- I- J-

I- The incremental displacement from the initial point to the control point
J- The incremental displacement from the starting point to the control point

G5.1 creates a quadratic B-spline in the XY plane using only the X and Y axes. Not specifying I or J provides the offset.
zero for the unspecified axis, therefore one or both must be provided.
For example, to program a parabola, through the origin, from X-2 Y4 to X2 Y4:

G5.1 Sample of quadratic spline

G90 G17
G0 X-2 Y4
G5.1 X2 I2 J-8

It is a mistake if:

both deviations I and J are not specified or are zero


A different axis from X or Y is specified
The active plan is not the G17.

9. G5.2 G5.3 NURBS Block


G5.2 <P-> <X- Y-> <L->
X- Y- <P->
...
G5.3

Notice: G5.2, G5.3 is experimental and has not been fully tested.
G5.2 is to open the data block defining a NURBS and G5.3 to close the data block. In the lines between these
Two codes, the control points of the curve are defined with their related weights (P) and with the parameter (L) that
determine the order of the curve.

The current coordinate, before the first G5.2 command, is always taken as the first NURBS control point.
To set the weight for this first control point, first program G5.2 P- without giving any X Y.
The standard weight, if P is not specified, is 1. The standard order, if L is not specified, is 3.

G5.2 Example

G0X0Y0(fast movement)
F10(adjusted feed rate)
G5.2P1L3
X0Y1P1
X2Y2P1
X2Y0P1
X0Y0P2
G 5.3
The fast movements show the same path without the NURBS block.
G0X0Y1
X2Y2
X2Y0
X0Y0
M2

Example of NURBS output

More information about NURBS can be found here:


[Link]

10. Modo de Diâmetro do Torno G7

G7

G7 program to enter diameter mode for the X axis on a lathe. When in diameter mode, the X axis
move it around will be 1/2 the distance to the center of the lathe. For example, X1 would move the cutter to 0.500" from
center of the lathe, thus giving a part of 1" in diameter.
11. Radius Mode of the G8 Lathe

G8

Program G8 to enter radius mode for the X axis on a lathe. When in radius mode, the X axis moves in
A turn will be the distance from the center. Thus, a cut at X1 would result in a piece with a diameter of 2 inches. G8 is the standard.
in the energization.

12. G10 L1 tool set

G10 L1 P-axes <R- I- J- Q->

P- tool number
R - tool radius
I- frontal angle (around)
J- return angle (turn)
Q- orientation (around)

G10 L1 define the tool table for the tool number P with the values of the words.
A valid G10 L1 rewrites and reloads the tool table.

Example line G10 L1

G10 L1 P1 Z1.5 (set tool 1 Z offset from machine origin to 1.5)


G10 L1 P2 R0.015 Q3 (example tool adjustment lathe 2 radius to 0.015 and orientation to 3)

It is a mistake if:

The cutter compensation is activated.


The number P is not specified
The number P is not a valid tool number in the tool table.
The number P is 0

For more information about the orientation of the end mill used by the wordQ, see the Orientation diagram.
lathe tool.

13. G10 L2 Set Coordinate System

G10 L2 P- <axes R->

P- coordinate system (0-9)


R- rotation about the Z axis

G10 L2 compensates the origin of the axes in the specified coordinate system for the axis word value.
Displacement is from the origin of the machine established during the return. The value of the displacement will replace any
Current deviations in effect for the specified coordinate system. Unused axis words will not be
altered.
Program P0 to P9 to specify which coordinate system should be changed.

Table 1. Coordinate System

Value P System of Code G


coordinates
0 Active n/D

1 1 G54
Value P System of Code G
coordinates
2 2 G55

3 3 G56

4 4 G57

5 5 G58

6 6 G59

7 7 G59.1

8 8 G59.2

9 9 G59.3

Optionally, program R to indicate the rotation of the XY axis around the Z axis. The direction of rotation is CCW viewed from
positive end of the Z axis.
All the words on the axis are optional.
Being in incremental distance mode (G91) has no effect on G10 L2.
Important Concepts:
G10 L2 Pn does not change from the current coordinate system to that specified by P, you have to use G54-59.3 to
select a coordinate system.
When a rotation is, in fact, in jogging, an axis will only move that axis in a positive or negative direction and
not along the rotated axis.
If a work offset G92 was in effect before G10 L2, it will remain in effect afterward.
The coordinate system whose origin is defined by a command G10 can be active or inactive at the moment.
in which the G10 is executed. If it is currently active, the new coordinates take effect immediately.
It is a mistake if:

The number P is not evaluated as an integer in the range of 0 to 9.


An axis is programmed that is not defined in the configuration.

Example line G10 L2

G10L2P1X3,5Y17,2

In the example above, the origin of the first coordinate system (the one selected by G54) is defined as X =
3.5 and Y = 17.2. Since only X and Y are specified, the origin point is moved only in X and Y; the others
coordinates are not altered.

Example line G10 L2

G10L2P1X0Y0Z0clear offsets for axes X, Y, and Z in the coordinate system 1

The example above defines the XYZ coordinates of coordinate system 1 for the origin of the machine.
The coordinate system is described in the sectionCoordinate system.

14. G10 L10 tool set

G10 L10 P-axes <R- I- J- Q->

P- tool number
R- tool radius
I - frontal angle (around)
J- return angle (turn)
Q - orientation (around)
G10 L10 alters the tool table entry for tool P so that, if the tool offset is
reloaded, with the machine in its current position and with the current compensations G5x and G92 active, the coordinates
Current values for the specified axes will become the provided values. The axes that are not specified in the command
G10 L10 will not be altered. This can be useful with a probe move, as described in section G38.

G10 L10 Example

T1 M6 G43 (tool loading 1 and tool length offsets)


G10 L10 P1 Z1.5 (set the current position for Z to be 1.5)
G43 (reload tool length offsets from the modified tool table)
M2 (final program)

Consult the sectionsT& M6eG43/G43.1 for more information.

It is a mistake if:

The cutter compensation is enabled


The number P is not specified
The number P is not a valid tool number in the tool table.
The number P is 0

15. G10 L11 tool set

G10 L11 P-axes <R- I- J- Q->

P- tool number
R- tool radius
I- frontal angle (around)
J - return angle (turn)
Q- orientation (around)

G10 L11 is like G10 L10, except that instead of setting the input according to the current deviations, it is set according to
so that the current coordinates become the determined value if the new tool offset is reloaded
And the machine should be placed in the G59.3 coordinate system without any active G92 offset.
This allows the user to set the G59.3 coordinate system according to a fixed point on the machine and, in
Next, use this accessory to measure tools without considering other active compensations at the moment.
It is a mistake if:

The cutter compensation is enabled.


O número P não é especificado
The number P is not a valid tool number in the tools table.
The number P is 0

16. G10 L20 Define coordinate system

G10 L20 P-axes

P- coordinate system (0-9)

G10 L20 is similar to G10 L2, except that instead of setting the offset/input to the determined value, it is
defined as a calculated value that makes the current coordinates become the determined value.

Example line G10 L20

G10 L20 P1 X1.5 (set the current location of the X axis in the coordinates system from 1 to 1.5)

It is a mistake if:

The number P is not evaluated as an integer in the range of 0 to 9.


An axis is programmed that is not defined in the configuration.
17. G17 - G19.1 Select Plan
These codes define the current plan as follows:
G17- XY (standard)
G18- ZX
G19- YZ
G17.1- UV
G18.1- WU
G19.1- VW

The UV, WU, and VW plans do not support arcs.


It is a good idea to include a plan selection in the preamble of each G-code file.
The effects of having a selected plan are discussed in Section G2 G3 Arcse Section G81 G89

18. G20, G21 Units


G20 - to use inches for units of length.
G21 - to use millimeters for length units.

It is a good idea to include units in the preamble of each G-code file.

19. G28, G28.1 Go / Set Predefined Position

Notice Use G28 only when your machine is in a repeatable position and the G28 position
desired to have been stored with G28.1.

The G28 uses the stored values in theparameters5161-5169 as the endpoint XYZABCUVW to where to move. The
parameter values are absolute coordinates of the machine in native machine units, as per
specified in the ini file. All axes defined in the ini file will be moved when a G28 is issued. If
no position is stored with G28.1, all axes will go to theoriginfrommachine.
G28 - makes a rapid move from the current position to the absolute position of the values in parameters 5161-5166.
Axis G28 - makes a rapid move to the position specified by the axes, including any deviations, and
then it will make a quick movement to the absolute position of the values in parameters 5161-5166 for all
the specified axes. Any unspecified axis will not move.
G28.1 - stores the current absolute position in parameters 5161-5166.

Example line G28

G28 Z2.5 (rapid to Z2.5 and then to the specified Z location in # 5163)

It is a mistake if:

The cutter compensation is activated.

20. G30, G30.1 Go / Set Predefined Position

Notice Use G30 only when your machine is in a repeatable position and the G30 position
desired to have been stored with G30.1.

G30 works the same way as G28, but uses the stored values in theparameters5181-5189 as the final point
XYZABCUVW where to go. The values of the parameters are absolute coordinates of the machine in units of
native machine, as specified in the ini file. All axes defined in the ini file will be moved when
a G30 is issued. If no position is stored with G30.1, all axes will go to theoriginfrommachine.

Note The G30 parameters will be used to move the tool when an M6 is programmed if
TOOL_CHANGE_AT_G30 = 1 estiver na seção [EMCIO] do arquivo ini.
G30 - makes a rapid move from the current position to the absolute position of the values in parameters 5181-5189.
Axes G30 - makes a quick move to the position specified by the axes, including any deviations, and in
Next, it will make a quick movement to the absolute position of the values in parameters 5181-5189 for all the
specified axis. Any unspecified axis will not move.
G30.1 stores the current absolute position in parameters 5181-5186.

Example line G30

G30 Z2.5 (rapid to Z2.5 and then to the specified Z location in # 5i83)

It is a mistake if:

The cutter compensation is enabled.

21. Synchronized Movement of the G33 Axis

G33 X- Y- Z- K-

K-distance per revolution

For synchronized movement by spindle in one direction, code G33 X- Y- Z- K-, where K provides the distance moved in
XYZ for each spindle rotation. For example, starting at Z = 0, G33 Z-1 K.0625 produces a movement of 1
inch in Z along 16 rotations of the spindle. This command can be part of a program to produce a
16 TPI threading. Another example in metric, G33 Z-15 K1.5 produces a movement of 15mm while the screw
turn 10 times on a 1.5mm wire.
The synchronized movement of the axis awaits the index of the gear and the gear on the speed pins, so that several
passes align. G33 moves to the end at the scheduled end point. G33 can be used to cut lines.
conical or fuses.
Todas as palavras do eixo são opcionais, exceto que pelo menos uma deve ser usada.

Note K follows the activation line described by X-Y-Z- K is not parallel to the Z axis if the endpoints
X or Y are used, for example, when cutting tapered threads.

Technical information
At the beginning of each G33 passage, LinuxCNC uses the spindle speed and the machine's acceleration limits to
calculate how long it will take Z to accelerate after the index pulse and determine how many degrees the fuse will rotate during
this time. Then, he adds this angle to the index position and calculates the Z position using the angle of the fuse
corrected. This means that Z will reach the correct position as soon as it finishes accelerating to the appropriate speed, and
you can immediately start cutting a good wire.

HAL Connections
The pins [Link]-at-speed and [Link]-Z for the spindle must be connected in your HAL file.
before the G33 works. Refer to the Integrators Manual for more information on synchronized movement
of the fuse.

Example G33

G90 (absolute distance mode)


G0 X1 Z0.1 (fast to position)
S100 M3 (starting from the fuse)
G33 Z-2 K0.125 (move the Z axis to -2 at a rate of 0.125 per revolution)
G0 X1.25 (rapid movement tool away from work)
Z0.1 (rapid movement to start the Z position)
M2 (final program)

See sections G90 & G0eM2for more information.

It is a mistake if:

All the words from the axis are omitted.


The spindle is not spinning when this command is executed
The requested linear movement exceeds the machine's speed limits due to the spindle speed.
22. G33.1 Rigid Tapering

G33.1 X- Y- Z- K-

K-distance per revolution

Notice For Z, just touching the preposition at location XY before calling G33.1 and using only one.
word Z in G33.1. If the specified coordinates are not the current coordinates when calling
G33.1 for touching, the movement will not be along the Z axis, but it will be a coordinated movement,
synchronized by timezone, from the current location to the specified location and vice versa.

For rigid threading (synchronized rotation of the screw with return), code G33.1 X- Y- Z- K- where K indicates the
distance moved for each rotation of the spindle.
A rigid beat movement consists of the following sequence:
A change from the current coordinate to the specified coordinate, synchronized with the time zone in the relationship.
specified and from the current coordinate with a time zone index pulse.
2. Upon reaching the endpoint, a command to reverse the rotation (for example, from clockwise to counterclockwise).
3. Continue the synchronized movement beyond the specified final coordinate until the spindle stops and reverses.
4. Continued the synchronized movement back to the original coordinate.
5. Upon reaching the original coordinate, a command to reverse the spindle a second time (for example, from
counterclockwise to clockwise.
6. Continue the synchronized movement beyond the original coordinate until the fuse stops and reverses.
7. A non-synchronized movement returns to the original coordinate.

The synchronized movements of the axis await the spindle index, therefore, several passes align. G33.1 ends.
at the original coordinate.
All the words on the axis are optional, except that at least one must be used.

G33.1 Example

G90(adjustment of absolute mode)


G0 X1.000 Y1.000 Z0.100(quick change to the starting position)
S100 M3(spindle rotation, 100 RPM)
G33.1Z-0.750K0.05(rigid thread 20 thread TPI 0.750 depth)
M2(final program)

See sections G90 & G0eM2for more information.

It is a mistake if:

All words on the axis are omitted.


The spindle is not spinning when this command is executed.
The requested linear motion exceeds the speed limits of the machine due to the speed of the spindle.

Direct Probe G38.n

G38.n axes

G38.2 - probing in the direction of the workpiece, stopped on contact, signal error in case of failure
G38.3 - probe in the direction of the workpiece, stopped on contact
G38.4 - probe away from the workpiece, stop loss of contact, signal error if there is a failure
G38.5 - probe away from the workpiece, stop on loss of contact

Important You will not be able to use a probe movement until your machine has been set up.
to provide a probe input signal. The input signal from the sensor must be
connected to entry approval movement in a .hal file. The G38.n uses
[Link]-input to determine when the probe made (or lost) contact.
TRUE for closed probe contact (in contact), FALSE for probe contact
aberto.

Program axes G38. n to perform a direct probe operation. The axis words are optional, except that
at least one of them must be used. The words on the axis together define the destination point to which the apalpador goes
will move from the current location. If the probe does not trigger before the destination is reached, G38.2 and G38.4
they will signal an error.

The tool in the fuse should be a probe or contact a probe switch.


In response to this command, the machine moves the controlled point (which should be at the center of the tip sphere of
test) in a straight line in thefeed ratecurrentindirection to the programmed point. In time advance mode
in reverse, the feed rate is such that the entire movement from the current point to the programmed point would take the time
specified. The movement stops (within the machine's acceleration limits) when the programmed point is reached
or when the requested change in the probe's input occurs, whichever comes first.
After the successful test, parameters #5061 to #5069 will be set for the coordinates X, Y, Z, A, B, C, U, V and
At the location of the controlled point at the moment the probe changed state (in the coordinate system of
current work). After the unsuccessful test, they are set to the coordinates of the scheduled point. The parameter
5070 is defined as 1 if the probe is successful and 0 if the probe fails. If the probing operation failed, G38.2 and
G38.4 will signal an error by posting a message on the screen if the selected GUI supports this. And stopping the
execution of the program.
A comment from the form (PROBEOPEN [Link]) will open the [Link] and store the
coordinate of nine numbers consisting of XYZABCUVW from each successful direct test. The file must be
closed with(PROBECLOSE). For more information, please refer to the section oncomments.
An example file [Link]é is included (in the examples directory) to demonstrate the use of the
movements of the probe to record in a file the coordinates of a part. The program [Link] can
to be used with ongcguicom minimal changes.
It is a mistake if:

the current point is the same as the scheduled point.


no word of the axis is used
the cutter compensation is activated
the feeding rate is zero
the probe is already in the destination state

24. Compensation G40 disabled


G40 disables the cutter compensation. If the tool compensation is in the next movement,
it must be a linear movement and greater than the diameter of the tool. There is no problem in deactivating the
compensation when it is already turned off.

Example G40

the current location is X1 after completing the compensated movement of the cutter
G40 (disable compensation)
G0 X1.6 (linear movement greater than the current diameter of the milling cutter)
M2 (final program)

See the sections G0eM2for more information.


It is a mistake if:

An arc motion G2 / G3 is programmed after a G40.


The linear motion after turning off the compensation is smaller than the diameter of the tool.

25. G41, G42 Cutter Compensation

G41 <D-> (to the left of the programmed path)


G42 <D-> (to the right of the programmed path)

D- tool number

The word D is optional; if there is no word D, the radius of the currently loaded tool will be used (if none
tool is loaded and no word D is given, a radius of 0 will be used.
If provided, the letter D is the tool number to be used. Normally, this would be the tool number in
fuse (in which case the word D is redundant and does not need to be provided), but it can be any number of tools.
valid.

Note G41 / G42 D0 is a little special. Its behavior is different in exchanger machines.
random tools and in non-random tool change machines (see section
Change of tools G41 / G42 ).D0
In non-random tool change machines,
apply the TLO of the tool currently in the fuse, or a TLO of 0 if no tool is available
no spindle. In random tool change machines, G41 / G42 D0 apply the TLO of
tool T0 defined in the tool table file (or causes an error if T0 is not)
defined in the tool table.

To start tool compensation to the left of the part profile, use G41. G41 starts the compensation of the
tool to the left of the programmed line, as viewed from the positive end of the axis perpendicular to the plane.
To start the cutter compensation to the right of the workpiece profile, use G42. G42 initiates the tool compensation to
right of the programmed line, as seen from the positive end of the axis perpendicular to the plane.
The moving lead must be at least as long as the tool's radius. The moving lead can be a
quick movement.
The cutter compensation can be executed if the XY plane or the XZ plane is active.
User commands M100-M199 are allowed when Cutter Compensation is activated.
The behavior of the machining center when the cutter compensation is activated is described in the Section of
CompensationdoCutteralong with code examples.
It is a mistake if:

The number D is not a valid tool number or 0.


The YZ plan is active.
The cutter's compensation is commanded to turn on when it is already activated.

26. G41.1, G42.1 Dynamic Tool Compensation

G41.1 D- <L-> (to the left of the programmed path)


G42.1 D- <L-> (to the right of the programmed path)

D- diameter of the end mill

The orientation of the tool (consult thetool orientation of the lathe)

G41.1 and G42.1 work the same way as G41 and G42 with the additional scope of being able to program the diameter of
tool. The word L is standardized as 0 if not specified.
It is a mistake if:

The YZ plan is active.


The number L is not in the range from 0 to 9, inclusive.
The number L is used when the XZ plane is not active.
The cutter's compensation is commanded to turn on when it is already activated.

27. Tool Length Offset G43

G43 <H->

H- tool number (optional)

G43 activates tool length compensation. G43 alters subsequent movements by compensating for the
coordinates of the axis by the length of the displacement. G43 does not cause any movement. Next time that a
The compensated axis is moved, the endpoint of this axis is the compensated location.

G43 is a word H uses the currently loaded tool from the last Tn M6.
G43 Hnusa or the offset for tool number.
Note G43 H0 is a little special. Its behavior is different in exchange machines
random tools and non-random tool exchange machines (see section
Tool changers G43 H0 ). In non-random tool change machines, apply
the tool's TLO currently in the time zone, or a TLO of 0, if no tool is in
fuse. In random tool changing machines, G43 H0 apply the TLO of tool T0
defined in the tools table file (or causes an error if T0 is not defined in
tool table.

G43 H - Example of Line

G43 H1 (define the tool offsets using the values from tool 1 in the tool table)

It is a mistake if:

the number H is not an integer or


the number H is negative or
the number H is not a valid tool number (although note that 0 is a valid tool number in
non-random tool exchange machines, means 'the tool currently on the spindle')

28. G43.1: Dynamic Tool Length Offset

Axles G43.1

G43.1 axes - change the subsequent movements by substituting the axis current deviation(s). G43.1 no
causes no movement. The next time a compensated axis is moved, the endpoint of that axis is the location
balanced.

G43.1 Example

G90 (define absolute mode)


T1 M6 G43 (tool load 1 and tool length offsets, Z is at machine 0 and the DRO shows Z1.500
G43.1 Z0.250 (current tool offset of 0.250, DRO now shows Z1.250)
M2 (final program)

See the sections G90&T& M6for more information.

It is a mistake if:

movement is commanded on the same line as G43.1

Note G43.1 does not save in the tool table.

29. G43.2: Apply additional tool length offset

G43.2 H-

H- tool number

G43.2 applies an additional simultaneous tool offset.

G43.2 Example

G90 (define absolute mode)


T1 M6 (loading tool 1)
G43 (or G43 H1 - replace all tool offsets with the offset of T1)
G43.2 H10 (also adds the tool offset of T10)
M2 (final program)

You can add an arbitrary number of offsets by calling G43.2 multiple times. There are no internal assumptions about which
numbers are geometry compensations and what are wear deviations, or that you should have only one of each.
Like the other commands of G43, G43.2 does not cause any movement. Next time a compensated axis is
moved, the endpoint of this axis is the compensated location.
It is a mistake if:

Not specified, or
the supplied tool number does not exist in the tool table

Note G43.2 does not save in the tool table.

30. G49: Cancel Tool Length Compensation


G49 - cancels the tool length offset

There is no problem in programming using the same offset already in use. There is also no problem in programming using
no tool length offset is being used at the moment.

G53 Move in machine coordinates

Axes G53

To move in thecoordinate systemfrommachineProgram G53 on the same line as a linear movement.


G53 is not modal and must be programmed on each line. G0 or G1 do not need to be programmed on the same line if one
is active at the moment.
For example, G53 G0 X0 Y0 Z0 will move the axes to the home position even if the coordinate system
Currently selected has ongoing compensations.

Example G53

G53 G0 X0 Y0 Z0 (rapid linear movement to the machine origin)


G53 X2 (rapid linear movement to absolute coordinate X2)

See section G0 for more information.


It is a mistake if:

G53 is used without G0 or G1 active.


The G53 is used while the cutter compensation is activated.

32. G54-G59.3 Select coordinate system


G54 - select coordinate system 1
G55 - select coordinate system 2
G56 - select the coordinate system 3
G57 - select coordinate system 4
G58 - select coordinate system 5
G59 - select coordinate system 6
G59.1 - select the coordinate system 7
G59.2 - select the coordinate system 8
G59.3 - select coordinate system 9

The coordinate systems store the values of the axes and the XY rotation angle around the Z axis in
parameters shown in the table below.

Table 2. Coordinate System Parameters

Select CS X Y Z UMA B C you V W R


G54 1 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230
Select CS X Y Z UMA B C you V W R
G55 2 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250

G56 3 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270

G57 4 ["5281","5282","5283","5284","5285","5286","5287","5288","5289","5290"]

G58 5 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310

G59 6 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330

G59.1 7 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350

G59.2 8 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370

G59.3 9 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390

It is a mistake if:

the selection of a coordinate system is used while the cutter compensation is activated.

See the Section of theCoordinate Systemfor an overview of coordinate systems.

33. G61, G61.1 Exact path mode


G61 - Exact path mode, movement exactly as programmed. Movements will slow down or stop.
as necessary to reach all scheduled points. If two sequential movements are
exactly collinear movements will not stop.
G61.1 - Exact stop mode, the movement will be interrupted at the end of each programmed segment.

34. Mixture of paths G64

G64 <P- <Q - >>

P - tolerance of movement mixing


Q- naive cam tolerance
G64 - best possible speed.
G64 P- <Q-> mixture with tolerance.
G64 - P means to maintain the best possible speed, regardless of how far you are from the point.
programmed.
G64 P-Q-- is a way to adjust your system for a better balance between speed and precision.
tolerance P means that the actual path will not be more than P away from the scheduled endpoint.
speed will be reduced, if necessary, to maintain the path. Furthermore, when you activate G64 P-Q, it turns on
the naive camera detector; when there is a series of linear XYZ feed movements at the same rate
advances that are less than Q - far from being collinear, they are collapsed into a single linear movement.
G2 / G3 moves in the G17 (XY) plane when the maximum deviation of an arc from a straight line is less than the tolerance.
The arc is divided into two lines (from the beginning of the arc to the midpoint and from the midpoint to the end). These lines
are then subjected to the naive came algorithm for lines. Thus, the cases of line-arc, arc-arc, and arc-line,
As well as line by line, they benefit from the naive came detector. This improves contour performance.
simplifying the way. It's fine to program for the mode that is already active. Also see Section Control.
from Trajectory for more information about these modes. If Q is not specified, it will have the same
previous behavior and will use the value of P-.

G64 P - example of line

G64 P0.015 (the path of the set follows within 0.015 of the current path)

It is a good idea to include a path control specification in the preamble of each G-code file.

35. G73 drilling cycle with chip breaking


G73 X- Y- Z- R- Q- <L->

R- retrace the position along the Z-axis.


Q - delta increment along the Z axis.
L- repeat

The G73 cycle is for drilling or milling with chip breaking. This cycle receives a number Q that represents a
increment delta along the Z axis.
Preliminary motion.
If the current Z position is below the R position, the Z axis will make a rapid movement to the R position.
Move to the XY coordinates
Move the Z axis only in theadvance ratecurrentfordown by delta or to position Z, whichever is less
profound.
Quick a little.
4. Repeat steps 2 and 3 until position Z is reached in step 2.
5. The Z axis makes a quick movement to position R.

It's a mistake if:

the number Q is negative or zero.


the number R is not specified

36. Threading cycle G76

G76 P- Z- I- J- R- K- Q- H- E- L-

Figure 3. Threading G76

Drive Line - A line through the initial position X parallel to Z.


P-- Passo from Tuscany distance per revolution.
Z-- The final position of the topics. At the end of the cycle, the tool will be in this Z position.

Note When the Turning Diameter Mode I Jmeasurements


G7 is in effect, the values for , and are K of
diameter. When the G8 Lathe Radius Mode I isJ inKeffect, the values for, and are measurements of
ray.

I-- The displacement of the drive screw. Negative values of linkage connections
external and positive values of internal linkages. Generally, the material has been converted for this
size before the cycle G76.
A positive value specifying initial cutting depth. The first threading cut will be
beyond the position of the thread.
A positive value specifying the total depth of the line. The final cut of the thread will be beyond the position.
dopicodarosca.

Optional settings
R-- Depth aggressiveness. R1.0 selects constant depth in successive passes.
screwing.R2.0 selects the constant area. Values between 1.0 and 2.0 select the decreasing depth,
but increase the area. Values above 2.0 select a decreasing area. Please note that values of
Unnecessarily high regressivity will cause a large number of passages to be used.
(degression = a stepwise descent or stages)
The angle of the composite slide is the angle (in degrees) that describes to what extent successive passes must
to be displaced along the transmission line. This is used to make one side of the tool remove
more material than the other. A positive value causes the tool's leading edge to be cut with
greater intensity. Typical values are 29, 29.5 or 30.
H-- The number of spring passes. The spring passes are additional passes with total depth of
ring. If no additional pass is desired, scheduleH0.
E-- Specifies the distance along the transmission line used for the cone. The angle of the cone will be such that
that the last pass narrows at the top of the line over the specified distance with E. 'E0.2' will give a
conicity for the first / last 0.2 units of length along the line. For a program of
conicity of 45 degrees is the same as K
L-- Specify which ends of the segment obtain the cone. ProgramL0 for no taper (the standard), L1
for entry conicity, L2 for exit conicity or L3 for entry and exit funneling.
input tuners will pause in the transmission line to synchronize with the indexing pulse and, in
next, will move to theadvance rateat the beginning of the narrowing. No inlet cone and the tool will be
rápida para a profundidade de corte, em seguida, sincronizar e iniciar o corte.

The tool is moved to the initial X and Z positions before issuing the G76. The X position is the transmission alignment and the
Position Z is the beginning of the chains.
The tool will take a brief pause for synchronization before each threading pass, so that a
relief cut will be necessary at the entrance, unless the start of the line is beyond the edge of the material or
that an input cone be used.
Unless you are using an exit taper, the exit motion is not synchronized with the speed of the
a fast spindle and it will be a quick movement. With a slow spindle, the output movement can take just a small fraction of
a revolution. If the speed of the spindle is increased after completing several passes, the exit movements
subsequent ones will require a larger portion of a revolution, resulting in a very heavy cut during the
outflow movement. This can be avoided by providing a relief groove at the outlet or not changing the speed of the
axis during the threading process.
The final position of the tool will be at the end of the transmission line. A safe Z movement will be necessary with a
internal thread to remove the tool from the hole.
It is a mistake if:

The active plan is not the ZX plan.


Other words on the axis, such as X or Y, are specified.
The regression value R² is less than 1.0.
All the required words are not specified
P-,J-,K-negative
It is greater than half the length of the transmission line.

HAL Connections
The pins [Link]-at-speed and [Link]-Z for the spindle must be connected in your HAL file.
before the G76 works. Look at the pins of thefusein the Movement section for more information.

Technical information
The fixed cycle of G76 is based on the synchronized movement of the spindle G33. For more information, refer to the Information.
Techniques of G33.
The sampling program G76 shows the use of the fixed cycle G76 and can be viewed and executed in any
machine using the configuration sim / [Link].

Example G76

G0Z-0.5X0.2
G76P0.05Z-1I-0.075J0.008K0.045Q29.5L2E0.045
Na figura, a ferramenta está na posição final após o término do ciclo G76. Você pode ver o caminho de entrada à direita
Do Q29.5 and the exit path to the left of L2 E0.045. The white lines are the cutting movements.

Figure 4. Example of the G76

37. Canned Cycles


The fixed cycles G81 to G89 and the fixed cycle G80 are described in this section.

All fixed cycles are performed in relation to the currently selected plane. Any of the nine planes can be
selected. Throughout this section, most descriptions assume that the XY plan has been selected. The behavior is
analogous if another plan is selected and the correct words must be used. For example, in plan G17.1, the action of
the fixed cycle is along W, and the locations or increments are given with U and V. In this case, replace U, V, W with X, Y, Z in
instruções. abaixo.
Rotary axis words are not permitted in fixed cycles. When the active plane is from the XYZ family, the axis words
UVW are not allowed. Likewise, when the active plane is one from the UVW family, the words from the XYZ axis do not
are allowed.

Common words
All fixed cycles use groups X, Y, Z or U, V, W, depending on the selected plan and the words R. The position R
(generally meaning retraction) is along the axis perpendicular to the currently selected plane (Z axis for plane
XY, etc.). Some fixed cycles use additional arguments.

37.2. Sticky words


For fixed cycles, we will call a fixed number when the same cycle is used in several lines of code in a
line, the number should be used the first time, but it is optional in the rest of the lines. Fixed numbers maintain their value.
in the rest of the lines if they are not explicitly programmed to be different. The number R is always sticky.
In incremental distance mode, the numbers X, Y, and R are treated as increments from the current position and Z
as an increment of the Z-axis position before the movement involving Z occurs. In absolute distance mode,
The numbers X, Y, R, and Z are absolute positions in the current coordinate system.

37.3. Repeat the Cycle


The number L is optional and represents the number of repetitions. L = 0 is not allowed. If the repetition feature is used,
it will normally be used in incremental distance mode, so that the same sequence of movements is
repeated in several equally spaced locations along a straight line. When L- is greater than 1 in mode
incremental with the selected XY plan, the X and Y positions are determined by adding the provided X and Y numbers
to the current X and Y positions (in the first round) or the X and Y positions at the end of the previous go-around (in the repetitions). Thus,
if you programL10, you will receive 10 cycles. The first cycle will be the distance X, Y from the original location. The
Positions R and Z do not change during repetitions. The number L is not fixed. In absolute distance mode, L > 1
signify the same cycle in the same place several times, Omitting the word L is equivalent to specifying L = 1.

37.4. Collect the mode


The height of the retraction movement at the end of each repetition (referred to as Znas in the descriptions below) is determined by the
retraction mode configuration: either to the original Z position (if it is above the R position and the retraction mode
estiverG98, OLD_Z) or in another way for position R. See section G98 G99.

37.5. Fixed cycle errors


It is a mistake if:

as palavras do eixo estão faltando durante um ciclo fixo,


the words of the axis of different groups (XYZ) (UVW) are used together,
a number P is necessary and a negative number P is used,
a number L is used and is not evaluated as a positive integer,
the movement of the rotating axis is used during a fixed cycle,
reverse time advance rate is active during a fixed cycle,
the cutter compensation is active during a fixed cycle.

If the XY plan is active, the number Z will be fixed and it will be an error if:
the number Z is missing and the same fixed cycle was not active,
either the number R is less than the number Z.

If other plans are active, the error conditions will be analogous to the above XY conditions.

37.6. Preliminary and intermediate motion


The preliminary movement is a set of movements common to all fixed milling cycles. If the Z position
If the current is below position R, the Z axis will make a rapid movement to position R. This happens only once.
regardless of the value of L.
Furthermore, at the beginning of the first cycle and in each repetition, the following movements are made
A rapid movement parallel to the XY plane to the given XY position,
2. The Z axis makes a quick movement to position R, if it is not already in position R.

If another plan is active, the preliminary and intermediate movements are analogous.

37.7. Why use a fixed cycle?


There are at least two reasons to use fixed cycles. The first is code efficiency. A single hole would take several
lines of code to run.
The G81 Example 1 demonstrates how a fixed cycle can be used to produce 8 holes with ten lines of G code.
within the fixed cycle mode. The program below will produce the same set of 8 holes using five lines for the
fixed cycle. It does not follow exactly the same path nor drills in the same order as the previous example. But the
A program that writes about the economy of a good fixed cycle should be obvious.

Note Line numbers are not necessary, but they help clarify these examples.

Eight holes

N100 G90 G0 X0 Y0 Z0 (move coordinate to home)


N110 G1 F10 X0 G4 P0.1
N120 G91 G81 X1 Y0 Z-1 R1 L4 (fixed drilling cycle)
N130 G90 G0 X0 Y1
N140 Z0
N150 G91 G81 X1 Y0 Z-0.5 R1 L4 (fixed drilling cycle)
N160 G80 (turn off fixed cycle)
N170 M2 (end of the program)

The G98 for the second line above means that the return movement will be to the Z value in the first line, a
since it is greater than the specified value R.

Twelve holes in a square


This example demonstrates the use of the letter L to repeat a set of incremental drill cycles for blocks.
successive code within the same movement mode G81. Here we produce 12 holes using five lines of
code in fixed movement mode.
N1000 G90 G0 X0 A0 Z0 (move coordinates to home)
N1010 G1 F50 X0 G4 P0.1
N1020 G91 G81 X1 Y0 Z-0.5 R1 L4 (fixed drilling cycle)
N1030 X0 Y1 R0 L3 (repeat)
N1040 X-1 Y0 L3 (repeat)
N1050 X0 Y-1 L2 (repeat)
N1060 G80 (turn off the fixed cycle)
N1070 G90 G0 X0 (rapid move to home)
N1080 Y0
N1090 Z0
N1100 M2 (end of the program)

The second reason to use a fixed cycle is that they all produce movements and preliminary returns that you
can anticipate and control, regardless of the starting point of the fixed cycle.

38. G80 Cancel the Canned Cycle


G80 cancels the fixed cycle modal movement. G80 is part of modal group 1, therefore, programming any
Another G code from the modal group 1 will also cancel the fixed cycle.

It is a mistake if:

The axis words are programmed when G80 is active.

Example G80

G90 G81 X1 Y1 Z1.5 R2.8 (fixed cycle of absolute distance)


G80 (turn off the fixed cycle motion)
G0 X0 Y0 Z0 (rapid movement to home coordinates)

The following code produces the same final position and state of the machine as the previous code.

Example G0

G90 G81 X1 Y1 Z1.5 R2.8 (absolute distance fixed cycle)


G0 X0 Y0 Z0 (rapid movement to home coordinate)

The advantage of the first set is that the G80 line clearly deactivates the fixed cycle of G81. With the first set
of blocks, the programmer must activate the movement again with G0, as done in the next line, or any
another word G of the mode of movement.
If a fixed cycle is not deactivated with G80 or another movement word, the fixed cycle will try to repeat using the
next block of code that contains a word X, Y or Z. The following file exercises (G81) are a set
of eight holes, as shown in the following caption.

G80 Example 1

N100 G90 G0 X0 Y0 Z0 (home position)


N110 G1 X0 G4 P0.1
N120 G81 X1 Y0 Z0 R1 (fixed drilling cycle)
N130 X2
N140 X3
N150 X4
N160 Y1 Z0.5
N170 X3
N180 X2
N190 X1
N200 G80 (turn off fixed cycle)
N210 G0 X0 (rapid move to home)
N220 Y0
N230 Z0
N240 M2 (end of the program)

Note Observe the change in position z after the first four holes. In addition, this is one of the few
places where line numbers have some value, potentially directing a reader to a line
specific code.

Figure 5. G80 Cycle

The use of G80 in the N200 line is optional because G0 in the next line will turn off the G81 cycle. However, using G80 as
shown in Example 1, it will be easier to read the fixed cycle. Without this, it is not so obvious that all the blocks between N120 and the
N200 belongs to the fixed cycle.

39. Drilling Cycle G81

G81 (X-Y-Z-) or (U- V- W-) R- L-

The G81 cycle is intended for drilling.


The cycle works as follows:
Preliminary motion, as described in the section Preliminary and Between Motion.
2. Move the Z axis to thefeeding ratecurrent to position Z.
3. The Z axis makes a quick movement to clear Z.

Example 1 - Absolute Position G81


Assume that the current position is (X1, Y2, Z3) and the following NC code line is interpreted.

G90 G98 G81X4Y5Z1.5R2.8

This requires absolute distance mode (G90) and OLD_Z retraction mode (G98) and requests that the drilling cycle
G81 should be executed once.
The value X and position X are 4.
The value Y and the position Y are 5.
The value of Z and the position of Z are 1.5.
The value of R and the value of Z are 2.8. OLD_Z is 3.
The following movements occur:
A rapid movement parallel to the XY plane to (X4, Y5)
A rapid movement moves parallel to the Z axis to (Z2.8).
3. move parallel to the Z axis in theadvance ratefor (Z1.5)
4. a quick movement parallel to the Z axis to (Z3)
Example 2 - Relative Position G81
Assume that the current position is (X1, Y2, Z3) and the following NC code line is interpreted.

G91 G98 G81 X4 Y5 Z-0.6 R1.8 L3

This requires incremental distance mode (G91) and OLD_Z retraction mode (G98). It also requires the cycle of
The drilling of G81 should be repeated three times. The value of X is 4, the value of Y is 5, the value of Z is -0.6 and the value of R is 1.8. A
The initial position of X is 5 (= 1 + 4), the initial position of Y is 7 (= 2 + 5), the position Z is 4.8 (= 1.8 + 3), and the position Z is 4.2 (= 4.8-
0.6 ). OLD_Z is 3.
The first preliminary motion is a maximum fast movement along the Z axis to (X1, Y2, Z4.8), from
OLD_Z <clear Z.
The first repetition consists of 3 movements.
1. a rapid movement parallel to the XY plane to (X5, Y7)
2. move parallel to the Z axis in theadvancement ratefor (Z4.2)
3. a rapid movement parallel to the Z axis to (X5, Y7, Z4.8)

The second repetition consists of 3 movements. The position X is reset to 9 (= 5 + 4) and the position Y to 12 (= 7 +
5).
1. a rapid movement parallel to the XY plane to (X9, Y12, Z4.8)
2. move parallel to the Z-axis at the feed rate to (X9, Y12, Z4.2)
3. a rapid movement parallel to the Z axis to (X9, Y12, Z4.8)

The third repetition consists of 3 movements. Position X is redefined to 13 (= 9 + 4) and position Y to 17 (= 12 +


5).
1. a rapid movement parallel to the XY plane to (X13, Y17, Z4.8)
2. move parallel to the Z axis at the feed rate to (X13, Y17, Z4.2)
3. a rapid movement parallel to the Z axis to (X13, Y17, Z4.8)

Example 3 - Relative Position G81


Now suppose you run the first block of code G81 but from (X0, Y0, Z0) instead of (X1, Y2, Z3).

G90 G98 G81 X4 Y5 Z1.5 R2.8


As OLD_Z is below the value R, it adds nothing to the movement, but since the initial value of Z is lower
that the specified value in R will have an initial movement of Z during the preliminary movements.

Example 4 - Absolute G81 R> Z


This is a graph of the movement path for the second block of code g81.

G91 G98 G81 X4 Y5 Z-0.6 R1.8 L3

As this graph starts with (X0, Y0, Z0), the interpreter adds the initial Z0 and R1.8 and rapid movements to
this place. After this initial movement of Z, the repetition feature works the same way as in example 3, with the
final depth Z being 0.6 below the value of R.

Example 5 - Relative position R> Z

G90 G98 G81 X4 Y5 Z-0.6 R1.8

As this graph starts with (X0, Y0, Z0), the interpreter adds the initial Z0 and R1.8 and the rapid movements.
for this location as in Example 4. After this initial movement of Z, the rapid movement to X4 Y5 is made. Then the
Final depth Z is 0.6 below the R value. The repetition function would make Z move to the same location again.

40. G82 Drilling Cycle, Dwell

G82 (X-Y-Z-) or (U- V- W-) R- L- P-

The cycle G82 is intended for drilling with a pause at the bottom of the hole.
Preliminary motion, as described in the Preliminary and Between Motion section.
2. Move the Z axis to thefeed ratecurrent to position Z.
3. Dwell for the number P of seconds.
4. The Z axis makes a rapid movement to clear Z.

The G82 fixed cycle motion resembles G81, with the addition of a pause at the bottom of the movement.
The stop length is specified by a word P in block G82.

41. G83 Peck Drilling Cycle

G83 (X-Y-Z-) or (U- V- W-) R- L-

The cycle G83 (often called peck drilling) is intended for deep drilling or milling with break.
cavacos. The contractions in this cycle clean the notch of the shavings and cut all the long beams (which are common in
drilling in aluminum). This cycle receives a number Q that represents an increment delta along the Z axis. A
retraction before the final depth will always be to the retraction plane, even if G98 is in effect.
Final retraction will honor the G98 / 99 in effect. G83 works the same way as G81 with the addition of retracts.
during the drilling operation.
Preliminary motion, as described in the Preliminary and Between Motion section.
2. Move the Z axis in thefeeding ratecurrentfordown by delta or to position Z, whichever is less deep.
3. Quickly, return to the retraction plan specified by the word R.
4. Rapid mover back to the bottom of the current hole, stepped back a little.
5. Repeat steps 2, 3, and 4 until position Z is reached in step 2.
6. The Z axis moves quickly to clear Z.
It is a mistake if:

The number Q is negative or zero.

42. G84 Right-hand tapping cycle


This code is not currently implemented in LinuxCNC. It is accepted, but the behavior is undefined. See the
sectionG33.1

43. Boring cycle G85, Feed Out

G85 (X-Y-Z-) or (U- V- W-) R- L-

The G85 cycle is intended for boring or reaming, but it can be used for drilling or milling.
Preliminary motion, as described in the Preliminary and Between Motion section.
2. Move the Z axis only in theadvance ratecurrent to position Z.
3. Collect the Z axis at the current feed rate for the R plane, if this is less than the initial Z.
4. Gather at the transverse speed to clean Z.

44. Mandrel cycle G86, Spindle stop, Rapid move

G86 (X-Y-Z-) or (U- V- W-) R- L- P-

The G86 cycle is intended for annoyances. This cycle uses a P number for the number of seconds to stay.
Preliminary motion, as described in the Preliminary and Between Motion section.
2. Move the Z axis only in therate of progresscurrent to position Z.
Dwell for the number P of seconds.
4. Stop the spin of the spindle.

5. The Z axis makes a quick movement to clear Z.


6. Restart the axis in the direction it was going.
It is a mistake if:

the spindle is not spinning before this cycle is executed.

45. Rear boring cycle G87


This code is not currently implemented in LinuxCNC. It is accepted, but the behavior is undefined.

46. Mandrel cycle G88, spindle stop, manual exit


This code is not currently implemented in LinuxCNC. It is accepted, but the behavior is undefined.
47. Mandrel cycle G89, Dwell, Feed Out

G89 (X-Y-Z-) or (U- V- W-) R- L- P-

The G89 cycle is intended for annoyances. This cycle uses a number P, where P specifies the number of seconds to
will be attended.
Preliminary motion, as described in the Preliminary and Between Motion section.
2. Move the Z axis only in theadvance ratecurrent to position Z.
Dwell for P seconds.
4. Collect the Z axis at the current feed rate to clear Z.

48. Distance Mode G90, G91


G90 - absolute distance mode In absolute distance mode, the axis numbers (X, Y, Z, A, B, C, U, V, W)
they generally represent positions in terms of the currently active coordinate system. Any exceptions to
essa regra são descritas explicitamente na seçãoG80 G89.
G91 - incremental distance mode In incremental distance mode, the axis numbers usually
they represent increments of the current coordinate.

Example G90

G90 (define the absolute distance mode)


G0 X2.5 (rapid movement to coordinate X2.5, including any compensation in effect)

Example G91

G91 (incremental distance mode set)


G0 X2.5 (rapid move 2.5 from the current position along the X axis)

See section G0 for more information.

49. Arc Distance Mode G90.1, G91.1


G90.1 - absolute distance mode for I, J, and K offsets. When G90.1 is in effect, both I and J must
should be specified with G2 / 3 for the XY plane or J and K for the XZ plane or it is an error.
G91.1 - incremental distance mode for I, J, and K compensations. G91.1 returns I, J, and K to the behavior
standard.

50. Displacement of the coordinate system G92

Axles G92

Notice G92 only after your machine has been positioned at the desired point.
Use the

The G92 makes the current point have the coordinates you want (without movement), where the axis words contain the
numbers of the axes you want. All words on the axis are optional, except that at least one must be
used. If a word of the axis is not used for a certain axis, the offset for that axis will be zero.
When oG92 is executed, theoriginsof all coordinate systems move. They move in such a way that the
the value of the currently controlled point, in the currently active coordinate system, becomes the specified value. All the
origins of the coordinate system (G53-G59.3) are offset by that same distance.
The G92 uses the stored values in theparameters5211-5219 how the XYZABCUVW offset values for
each axis. The parameter values are absolute coordinates of the machine in native machine units,
as specified in the ini file. All axes defined in the ini file will be compensated when G92 is
active. If an axis has not been set after G92, the offset of that axis will be zero.
For example, suppose the current point is at X = 4 and there is currently no active G92 deviation. Then G92
X is programmed. This moves all the origins -3 in X, which makes the current point become X = 7. This -3 is saved.
in parameter 5211.
Being in incremental distance mode (G91 instead of G90) does not affect the action of G92.
Displacements G92 may already be in effect when G92 is called. If this is the case, the displacement is replaced.
for a new displacement that makes the current point become the specified value.
It is a mistake if:

all the words on the axis are omitted.

LinuxCNC stores the offsets from G92 and reuses them in the next execution of a program. To avoid this, one can...
program a G92.1 (to delete them), or program a G92.2 (to remove them - they are still stored).
See the Section of theCoordinate Systemfor an overview of coordinate systems.
See the SectionOffsetsfor more information.
See the Section ofParametersfor more information.

51. G92.1, G92.2 Redefine deviations G92


G92.1 - disable G92 offsets and reset themparameters5211 - 5219 for zero.
G92.2 - disables the offsets of G92, but keeps theparameters5211 - 5219 available.

Note G92.1 only clears the offsets from G92, to change the displacements of the coordinate system.
G53-G59.3 in the G code, useG10 L2 G10
you L20 .

52. G92.3 Restore offsets G92


G92.3 - define the G92 offset to the values saved in parameters 5211 to 5219.

You can define axis offsets in one program and use the same offsets in another program.
Program G92 in the first program. This will set parameters 5211 to 5219. Do not use G92.1 in the rest of the first.
program. The parameter values will be saved when the first program exits and restored when the second one starts.
for initiated. Use G92.3 close to the start of the second program. This will restore the offsets saved in the first program.

53. G93, G94, G95: Feed rate mode


G93 is the reverse time mode. In reverse feed rate mode, an F word means that the
movement must be completed in [one divided by number F] minutes. For example, if the number F is 2.0, the
the movement must be completed in half a minute.
When the reverse time advance mode is active, an F word should appear on each line that
have a G1, G2, or G3 movement, and a word F in a line that does not have G1, G2, or G3 is ignored. To be
The reverse time advancement mode does not affect the G0 movements (fast movement).
G94 is the units per minute mode. In the units per minute feed mode, a word F is
interpreted as meaning that the controlled point must move a certain number of inches
per minute, millimeters per minute or degrees per minute, depending on which units of length are used
being used and which axis or axes are moving.
G95 - Units per Revolution Mode In units per revolution mode, a word F is interpreted
as meaning that the controlled point must move a certain number of inches per rotation of the screw,
depending on which units of length are being used and which axes or axes are in motion. The
G95 is not suitable for threading, for threading use G33 or G76. G95 requires that the movement of
the fuse speed is connected.
It is a mistake if:

The reverse time feed mode is active and a line with G1, G2, or G3 (explicitly or implicitly)
does not have a word F.
A new feed rate is not specified after the switch to G94 or G95.

54. G96, G97 Spindle Control Mode

G96 <D-> S- (Constant Surface Speed Mode)


G97 (RPM mode)
D- Maximum spindle RPM
S - surface speed
G96 D- S-- selects constant surface speed in Spés per minute (if G20 is in effect) or
meters per minute (if G21 is in effect). D is optional.
When using G96, make sure that X0 in the current coordinate system (including offsets and lengths
of the tool) is either the center of rotation or that LinuxCNC does not provide the desired spindle speed. The G96 does not
is affected by the ray mode or diameter.
G97 selects the RPM mode.

Example line G96

G96 D2500 S250 (set the CSS with a maximum rotation of 2,500 and a surface speed of 250)

It is a mistake if:

If not specified with G96


A feed movement is specified in G96 mode while the spindle is not rotating.

G98, G99 Fixed cycle return level


G98 - retract to the position where the axis was before starting this series of one or more contiguous fixed cycles.
G99 - collect for the position specified by the word R of the fixed cycle.

Programming a G98 and the fixed cycle will use the Z position before the fixed cycle as the Z return position if it is greater than the
specified R value in the cycle. If it is lower, the R value will be used. The word R has different meanings in mode of
absolute distance and in incremental distance mode.

G98 retracts to the origin

G0 X1 Y2 Z3
G90 G98 G81 X4 Y5 Z-0.6 R1.8 F10

The G98 for the second line above means that the return movement will be to the Z value in the first line, a
time that is greater than the specified value R.
The initial plan (G98) is reset at any moment when the movement mode of the time cycle is
abandoned, either explicitly (G80) or implicitly (any motion code that is not a cycle).
Switching between cycle modes (for example, G81 to G83) DOES NOT reset the initial plane. It is possible to switch between G98
the G99 during a series of cycles.

Last updated 2018-12-13 18:10:00 MST

You might also like