Skip to content
g-code.rst 79.6 KiB
Newer Older
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G38.2`` - probe toward workpiece, stop on contact, signal error if failure
* ``G38.3`` - probe toward workpiece, stop on contact
* ``G38.4`` - probe away from workpiece, stop on loss of contact, signal error if failure
* ``G38.5`` - probe away from workpiece, stop on loss of contact
Fabrice Salvaire's avatar
Fabrice Salvaire committed
Program ``G38.n axes`` to perform a straight probe operation. The axis words are optional, except that
Fabrice Salvaire's avatar
Fabrice Salvaire committed
at least one of them must be used. The axis words together define the destination point that the
probe will move towards, starting from the current location. If the probe is not tripped before the
destination is reached G38.2 and G38.4 will signal an error.

The tool in the spindle must 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 probe ball) in a straight line at the current `feed rate <#sec:set-feed-rate>`__ toward the
programmed point. In inverse time feed mode, the feed rate is such that the whole motion from the
current point to the programmed point would take the specified time. The move stops (within machine
acceleration limits) when the programmed point is reached, or when the requested change in the probe
input takes place, whichever occurs first.

After successful probing, parameters #5061 to #5069 will be set to the X, Y, Z, A, B, C, U, V, W
coordinates of the location of the controlled point at the time the probe changed state (in the
current work coordinate system). After unsuccessful probing, they are set to the coordinates of the
programmed point. Parameter 5070 is set to 1 if the probe succeeded and 0 if the probe failed. If
the probing operation failed, G38.2 and G38.4 will signal an error by posting an message on screen
if the selected GUI supports that. And by halting program execution.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
A comment of the form ``(PROBEOPEN filename.txt)`` will open ``filename.txt`` and store the 9-number
Fabrice Salvaire's avatar
Fabrice Salvaire committed
coordinate consisting of XYZABCUVW of each successful straight probe in it. The file must be closed
Fabrice Salvaire's avatar
Fabrice Salvaire committed
with ``(PROBECLOSE)``. For more information see the `Comments <#gcode:comments>`__ Section.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
An example file ``smartprobe.ngc`` is included (in the examples directory) to demonstrate using probe
moves to log to a file the coordinates of a part. The program ``smartprobe.ngc`` could be used with
``ngcgui`` with minimal changes.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* the current point is the same as the programmed point.
* no axis word is used
* cutter compensation is enabled
* the feed rate is zero
* the probe is already in the target state

G40 Compensation Off
--------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G40`` - turn cutter compensation off. If tool compensation was on the next move must be a linear
Fabrice Salvaire's avatar
Fabrice Salvaire committed
   move and longer than the tool diameter. It is OK to turn compensation off when it is already off.

G40 Example

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   ; current location is X1 after finishing cutter compensated move
   G40 (turn compensation off)
   G0 X1.6 (linear move longer than current cutter diameter)
   M2 (end program)

See `G0 <#gcode:g0>`__ & `M2 <#mcode:m2-m30>`__ sections for more information.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* A G2/G3 arc move is programmed next after a G40.
* The linear move after turning compensation off is less than the tool diameter.

G41, G42 Cutter Compensation
----------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G41 <D-> (left of programmed path)
   G42 <D-> (right of programmed path)

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``D`` - tool number
Fabrice Salvaire's avatar
Fabrice Salvaire committed

The D word is optional; if there is no D word the radius of the currently loaded tool will be used
(if no tool is loaded and no D word is given, a radius of 0 will be used).

If supplied, the D word is the tool number to use. This would normally be the number of the tool in
the spindle (in which case the D word is redundant and need not be supplied), but it may be any
valid tool number.

To start cutter compensation to the left of the part profile, use G41.  G41 starts cutter
compensation to the left of the programmed line as viewed from the positive end of the axis
perpendicular to the plane.

To start cutter compensation to the right of the part profile, use G42.  G42 starts cutter
compensation to the right of the programmed line as viewed from the positive end of the axis
perpendicular to the plane.

The lead in move must be at least as long as the tool radius. The lead in move can be a rapid move.

Cutter compensation may be performed if the XY-plane or XZ-plane is active.

User M100-M199 commands are allowed when Cutter Compensation is on.

The behavior of the machining center when cutter compensation is on is described in the `Cutter
Compensation <#sec:cutter-compensation>`__ Section along with code examples.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* The D number is not a valid tool number or 0.
* The YZ plane is active.
* Cutter compensation is commanded to turn on when it is already on.

.. _g411-g421-dynamic-cutter-compensation:

G41.1, G42.1 Dynamic Cutter Compensation
----------------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G41.1 D- <L-> (left of programmed path)
   G42.1 D- <L-> (right of programmed path)

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``D`` - cutter diameter
* ``L`` - tool orientation (see `lathe tool orientation <#lathe-tool-orientation>`__)
Fabrice Salvaire's avatar
Fabrice Salvaire committed

G41.1 & G42.1 function the same as G41 & G42 with the added scope of being able to program the tool
diameter. The L word defaults to 0 if unspecified.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* The YZ plane is active.
* The L number is not in the range from 0 to 9 inclusive.
* The L number is used when the XZ plane is not active.
* Cutter compensation is commanded to turn on when it is already on.

G43 Tool Length Offset
----------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``H`` - tool number (optional)
Fabrice Salvaire's avatar
Fabrice Salvaire committed

G43 enables tool length compensation. G43 changes subsequent motions by offsetting the axis
coordinates by the length of the offset. G43 does not cause any motion. The next time a compensated
axis is moved, that axis’s endpoint is the compensated location.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
``G43`` without an H word uses the currently loaded tool from the last ``Tn M6``.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
``G43 Hn`` uses the offset for tool n.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

G43 H- Example Line

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* the H number is not an integer, or
* the H number is negative, or
* the H number is not a valid tool number (though note that 0 is a valid tool number on nonrandom
  tool changer machines, it means "the tool currently in the spindle")

.. _g431-dynamic-tool-length-offset:

G43.1: Dynamic Tool Length Offset
---------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G43.1 axes`` - change subsequent motions by replacing the current offset(s) of axes. G43.1 does
Fabrice Salvaire's avatar
Fabrice Salvaire committed
  not cause any motion. The next time a compensated axis is moved, that axis’s endpoint is the
  compensated location.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

G43.1 Example

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G90 (set absolute mode)
   T1 M6 G43 (load tool 1 and tool length offsets, Z is at machine 0 and DRO shows Z1.500)
   G43.1 Z0.250 (offset current tool offset by 0.250, DRO now shows Z1.250)
   M2 (end program)

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* See `G90 <#gcode:g90-g91>`__ & `T <#sec:select-tool>`__ & `M6 <#mcode:m6>`__ sections for more
  information.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* motion is commanded on the same line as ``G43.1``
Fabrice Salvaire's avatar
Fabrice Salvaire committed

.. _g432-apply-additional-tool-length-offset:

G43.2: Apply additional Tool Length Offset
------------------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``H`` - tool number
Fabrice Salvaire's avatar
Fabrice Salvaire committed

G43.2 applies an additional simultaneous tool offset.

G43.2 Example

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G90 (set absolute mode)
   T1 M6 (load tool 1)
Fabrice Salvaire's avatar
Fabrice Salvaire committed
   G43 (or G43 H1 - replace all tool offsets with T1``s offset)
   G43.2 H10 (also add in T10``s tool offset)
Fabrice Salvaire's avatar
Fabrice Salvaire committed
   M2 (end program)

You can sum together an arbitrary number of offsets by calling G43.2 more times. There are no
built-in assumptions about which numbers are geometry offsets and which are wear offsets, or that
you should have only one of each.

Like the other G43 commands, G43.2 does not cause any motion. The next time a compensated axis is
moved, that axis’s endpoint is the compensated location.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``H`` is unspecified, or
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* the given tool number does not exist in the tool table

G49: Cancel Tool Length Compensation
------------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G49`` - cancels tool length compensation
Fabrice Salvaire's avatar
Fabrice Salvaire committed

It is OK to program using the same offset already in use. It is also OK to program using no tool
length offset if none is currently being used.

G53 Move in Machine Coordinates
-------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed
To move in the `machine coordinate system <#sec.machine-corrdinate-system>`__, program ``G53`` on the
same line as a linear move. ``G53`` is not modal and must be programmed on each line. ``G0`` or ``G1``
Fabrice Salvaire's avatar
Fabrice Salvaire committed
does not have to be programmed on the same line if one is currently active.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
For example ``G53 G0 X0 Y0 Z0`` will move the axes to the home position even if the currently selected
Fabrice Salvaire's avatar
Fabrice Salvaire committed
coordinate system has offsets in effect.

G53 Example

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G53 G0 X0 Y0 Z0 (rapid linear move to the machine origin)
   G53 X2 (rapid linear move to absolute coordinate X2)

* See `G0 <#gcode:g0>`__ section for more information.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* G53 is used without G0 or G1 being active,
* or G53 is used while cutter compensation is on.

.. _g54-g593-select-coordinate-system:

G54-G59.3 Select Coordinate System
----------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G54`` - select coordinate system 1
* ``G55`` - select coordinate system 2
* ``G56`` - select coordinate system 3
* ``G57`` - select coordinate system 4
* ``G58`` - select coordinate system 5
* ``G59`` - select coordinate system 6
* ``G59.1`` - select coordinate system 7
* ``G59.2`` - select coordinate system 8
* ``G59.3`` - select coordinate system 9
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

====== == ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
Select CS X    Y    Z    A    B    C    U    V    W    R
====== == ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
G54    1  5221 5222 5223 5224 5225 5226 5227 5228 5229 5230
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
====== == ==== ==== ==== ==== ==== ==== ==== ==== ==== ====

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* selecting a coordinate system is used while cutter compensation is on.

See the `Coordinate System <#cha:coordinate-system>`__ Section for an overview of coordinate
systems.

.. _g61-g611-exact-path-mode:

G61, G61.1 Exact Path Mode
--------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G61`` - Exact path mode, movement exactly as programed. Moves will slow or stop as needed to
  reach every programed point. If two sequential moves are exactly co-linear movement will not stop.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G61.1`` - Exact stop mode, movement will stop at the end of each programed segment.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

G64 Path Blending
-----------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G64 <P- <Q->>

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``P`` - motion blending tolerance
* ``Q`` - naive cam tolerance
* ``G64`` - best possible speed.
* ``G64 P- <Q- >`` blending with tolerance.
* ``G64`` - without P means to keep the best speed possible, no matter how far away from the
Fabrice Salvaire's avatar
Fabrice Salvaire committed
   programmed point you end up.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G64 P- Q-`` - is a way to fine tune your system for best compromise between speed and
Fabrice Salvaire's avatar
Fabrice Salvaire committed
  accuracy. The P- tolerance means that the actual path will be no more than P- away from the
  programmed endpoint. The velocity will be reduced if needed to maintain the path. In addition,
  when you activate G64 P- Q- it turns on the ``naive cam detector``; when there are a series of
  linear XYZ feed moves at the same `feed rate <#sec:set-feed-rate>`__ that are less than Q- away
  from being collinear, they are collapsed into a single linear move. On G2/G3 moves in the G17 (XY)
  plane when the maximum deviation of an arc from a straight line is less than the G64 P- tolerance
  the arc is broken into two lines (from start of arc to midpoint, and from midpoint to end). those
  lines are then subject to the naive cam algorithm for lines. Thus, line-arc, arc-arc, and arc-line
  cases as well as line-line benefit from the ``naive cam detector``. This improves contouring
  performance by simplifying the path. It is OK to program for the mode that is already active. See
  also the `Trajectory Control <#sec:trajectory-control>`__ Section for more information on these
  modes. If Q is not specified then it will have the same behavior as before and use the value of
  P-.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

G64 P- Example Line

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G64 P0.015 (set path following to be within 0.015 of the actual path)

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

G73 Drilling Cycle with Chip Breaking
-------------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``R`` - retract position along the Z axis.
* ``Q`` - delta increment along the Z axis.
* ``L`` - repeat
Fabrice Salvaire's avatar
Fabrice Salvaire committed
The ``G73`` cycle is drilling or milling with chip breaking. This cycle takes a Q number which
represents a ``delta`` increment along the Z axis.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

#. Preliminary motion.

   * If the current Z position is below the R position, The Z axis does a `rapid move <#gcode:g0>`__
     to the R position.
   * Move to the X Y coordinates

#. Move the Z-axis only at the current `feed rate <#sec:set-feed-rate>`__ downward by delta or to
   the Z position, whichever is less deep.
#. Rapid up a bit.
#. Repeat steps 2 and 3 until the Z position is reached at step 2.
#. The Z axis does a rapid move to the R position.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* the Q number is negative or zero.
* the R number is not specified

G74 Left-hand Tapping Cycle, Dwell
----------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The ``G74`` cycle is intended for tapping with floating chuck and dwell at the bottom of the hole.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

#. Preliminary motion, as described in the `Preliminary and In-Between Motion
   <#gcode:preliminary-motion>`__ section.
#. Disable Feed and Speed Overrides.
#. Move the Z-axis at the current feed rate to the Z position.
#. Stop the selected spindle (chosen by the $ parameter)
#. Start spindle rotation clockwise.
#. Dwell for the P number of seconds.
#. Move the Z-axis at the current feed rate to clear Z
#. Restore Feed and Speed override enables to previous state

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The length of the dwell is specified by a ``P-`` word in the G84 block.  Thread pitch is F divided
Fabrice Salvaire's avatar
Fabrice Salvaire committed
by S. In example S100 F125 gives pitch of 1.25MM per revolution.

G76 Threading Cycle
-------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

|G76 Threading|

Figure 3. G76 Threading

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``Drive Line`` - A line through the initial X position parallel to the Z.
* ``P-`` - The ``thread pitch`` in distance per revolution.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``Z-`` - The final position of threads. At the end of the cycle the tool will be at this Z
  position.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``I-`` - The ``thread peak`` offset from the ``drive line``. Negative ``I`` values are external
  threads, and positive ``I`` values are internal threads. Generally the material has been turned to
  this size before the ``G76`` cycle.
* ``J-`` - A positive value specifying the ``initial cut depth``. The first threading cut will be
  ``J`` beyond the ``thread peak`` position.
* ``K-`` - A positive value specifying the ``full thread depth``. The final threading cut will be
  ``K`` beyond the ``thread peak`` position.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

Optional settings

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``$-`` - The spindle number to which the motion will be synchronised (default 0). For example is
  $1 is programmed then the motion will begin on the reset od spindle.1.index-enable and proceed in
  synchrony with the value of spindle.1.revs
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``R-`` - The ``depth degression``. ``R1.0`` selects constant depth on successive threading
Fabrice Salvaire's avatar
Fabrice Salvaire committed
  passes. ``R2.0`` selects constant area. Values between 1.0 and 2.0 select decreasing depth but
  increasing area.  Values above 2.0 select decreasing area. Beware that unnecessarily high
  degression values will cause a large number of passes to be used. (degression = a descent by
  stages or steps.)
* ``Q-`` - The ``compound slide angle`` is the angle (in degrees) describing to what extent
  successive passes should be offset along the drive line. This is used to cause one side of the
  tool to remove more material than the other. A positive ``Q`` value causes the leading edge of the
  tool to cut more heavily. Typical values are 29, 29.5 or 30.
* ``H-`` - The number of ``spring passes``. Spring passes are additional passes at full thread
  depth. If no additional passes are desired, program ``H0``.
* ``E-`` - Specifies the distance along the drive line used for the taper. The angle of the taper
  will be so the last pass tapers to the thread crest over the distance specified with E.`` E0.2``
  will give a taper for the first/last 0.2 length units along the thread. For a 45 degree taper
  program E the same as K
* ``L-`` - Specifies which ends of the thread get the taper. Program ``L0`` for no taper (the
  default), ``L1`` for entry taper, ``L2`` for exit taper, or ``L3`` for both entry and exit
  tapers. Entry tapers will pause at the drive line to synchronize with the index pulse then move at
  the `feed rate <#sec:set-feed-rate>`__ in to the beginning of the taper. No entry taper and the
  tool will rapid to the cut depth then synchronize and begin the cut.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

The tool is moved to the initial X and Z positions prior to issuing the G76. The X position is the
Fabrice Salvaire's avatar
Fabrice Salvaire committed
``drive line`` and the Z position is the start of the threads.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

The tool will pause briefly for synchronization before each threading pass, so a relief groove will
be required at the entry unless the beginning of the thread is past the end of the material or an
entry taper is used.

Unless using an exit taper, the exit move is not synchronized to the spindle speed and will be a
`rapid move <#gcode:g0>`__. With a slow spindle, the exit move might take only a small fraction of a
revolution.  If the spindle speed is increased after several passes are complete, subsequent exit
moves will require a larger portion of a revolution, resulting in a very heavy cut during the exit
move. This can be avoided by providing a relief groove at the exit, or by not changing the spindle
speed while threading.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The final position of the tool will be at the end of the ``drive line``. A safe Z move will be needed
Fabrice Salvaire's avatar
Fabrice Salvaire committed
with an internal thread to remove the tool from the hole.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* The active plane is not the ZX plane
* Other axis words, such as X- or Y-, are specified
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* The ``R-`` degression value is less than 1.0.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* All the required words are not specified
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``P-``, ``J-``, ``K-`` or ``H-`` is negative
* ``E-`` is greater than half the drive line length
Fabrice Salvaire's avatar
Fabrice Salvaire committed

HAL Connections

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The pins ``spindle.N.at-speed`` and the ``encoder.n.phase-Z`` for the spindle must be connected in your
Fabrice Salvaire's avatar
Fabrice Salvaire committed
HAL file before G76 will work. See the `spindle <#sec:motion-pins>`__ pins in the Motion section for
more information.

Technical Info

The G76 canned cycle is based on the G33 Spindle Synchronized Motion.  For more information see the
G33 `Technical Info <#gcode:g33-tech-info>`__.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The sample program ``g76.ngc`` shows the use of the G76 canned cycle, and can be previewed and
executed on any machine using the ``sim/lathe.ini`` configuration.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

G76 Example

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G0 Z-0.5 X0.2
   G76 P0.05 Z-1 I-.075 J0.008 K0.045 Q29.5 L2 E0.045

In the figure the tool is in the final position after the G76 cycle is completed. You can see the
entry path on the right from the Q29.5 and the exit path on the left from the L2 E0.045. The white
lines are the cutting moves.

|G76 Example|

Figure 4. G76 Example

Canned Cycles
-------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The canned cycles ``G81`` through ``G89`` and the canned cycle stop ``G80``
Fabrice Salvaire's avatar
Fabrice Salvaire committed
are described in this section.

All canned cycles are performed with respect to the currently-selected plane. Any of the nine planes
may be selected. Throughout this section, most of the descriptions assume the XY-plane has been
selected. The behavior is analogous if another plane is selected, and the correct words must be
Fabrice Salvaire's avatar
Fabrice Salvaire committed
used. For instance, in the ``G17.1`` plane, the action of the canned cycle is along W, and the
Fabrice Salvaire's avatar
Fabrice Salvaire committed
locations or increments are given with U and V. In this case substitute U,V,W for X,Y,Z in the
instructions below.

Rotary axis words are not allowed in canned cycles. When the active plane is one of the XYZ family,
the UVW axis words are not allowed.  Likewise, when the active plane is one of the UVW family, the
XYZ axis words are not allowed.

Common Words
~~~~~~~~~~~~

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

Sticky Words
~~~~~~~~~~~~

Fabrice Salvaire's avatar
Fabrice Salvaire committed
For canned cycles, we will call a number ``sticky`` if, when the same cycle is used on several lines
Fabrice Salvaire's avatar
Fabrice Salvaire committed
of code in a row, the number must be used the first time, but is optional on the rest of the
lines. Sticky numbers keep their value on the rest of the lines if they are not explicitly
programmed to be different. The R number is always sticky.

In incremental distance mode X, Y, and R numbers are treated as increments from the current position
and Z as an increment from the Z-axis position before the move involving Z takes place. In absolute
distance mode, the X, Y, R, and Z numbers are absolute positions in the current coordinate system.

Repeat Cycle
~~~~~~~~~~~~

The L number is optional and represents the number of repeats. L=0 is not allowed. If the repeat
feature is used, it is normally used in incremental distance mode, so that the same sequence of
motions is repeated in several equally spaced places along a straight line. When L- is greater than
1 in incremental mode with the XY-plane selected, the X and Y positions are determined by adding the
given X and Y numbers either to the current X and Y positions (on the first go-around) or to the X
and Y positions at the end of the previous go-around (on the repetitions). Thus, if you program
Fabrice Salvaire's avatar
Fabrice Salvaire committed
``L10`` , you will get 10 cycles. The first cycle will be distance X,Y from the original location. The
Fabrice Salvaire's avatar
Fabrice Salvaire committed
R and Z positions do not change during the repeats. The L number is not sticky.  In absolute
Fabrice Salvaire's avatar
Fabrice Salvaire committed
distance mode, L>1 means ``do the same cycle in the same place several times``, Omitting the L word is
Fabrice Salvaire's avatar
Fabrice Salvaire committed
equivalent to specifying L=1.

Retract Mode
~~~~~~~~~~~~

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The height of the retract move at the end of each repeat (called ``clear Z`` in the descriptions
Fabrice Salvaire's avatar
Fabrice Salvaire committed
below) is determined by the setting of the retract mode: either to the original Z position (if that
Fabrice Salvaire's avatar
Fabrice Salvaire committed
is above the R position and the retract mode is ``G98``, OLD_Z), or otherwise to the R position. See
Fabrice Salvaire's avatar
Fabrice Salvaire committed
the `G98 G99 <#gcode:g98-g99>`__ Section.

Canned Cycle Errors
~~~~~~~~~~~~~~~~~~~

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* axis words are all missing during a canned cycle,
* axis words from different groups (XYZ) (UVW) are used together,
* a P number is required and a negative P number is used,
* an L number is used that does not evaluate to a positive integer,
* rotary axis motion is used during a canned cycle,
* inverse time feed rate is active during a canned cycle,
* or cutter compensation is active during a canned cycle.

If the XY plane is active, the Z number is sticky, and it is an error if:

* the Z number is missing and the same canned cycle was not already active,
* or the R number is less than the Z number.

If other planes are active, the error conditions are analogous to the XY conditions above.

Preliminary and In-Between Motion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Preliminary motion is a set of motions that is common to all of the milling canned cycles. If the
current Z position is below the R position, the Z axis does a `rapid move <#gcode:g0>`__ to the R
position. This happens only once, regardless of the value of L.

In addition, at the beginning of the first cycle and each repeat, the following one or two moves are
made

#. A `rapid move <#gcode:g0>`__ parallel to the XY-plane to the given XY-position,
#. The Z-axis make a rapid move to the R position, if it is not already at the R position.

If another plane is active, the preliminary and in-between motions are analogous.

Why use a canned cycle?
~~~~~~~~~~~~~~~~~~~~~~~

There are at least two reasons for using canned cycles. The first is the economy of code. A single
bore would take several lines of code to execute.

The G81 `Example 1 <#gcode:g81-example>`__ demonstrates how a canned cycle could be used to produce
8 holes with ten lines of G code within the canned cycle mode. The program below will produce the
same set of 8 holes using five lines for the canned cycle. It does not follow exactly the same path
nor does it drill in the same order as the earlier example. But the program writing economy of a
good canned cycle should be obvious.

Eight Holes

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   N100 G90 G0 X0 Y0 Z0 (move coordinate home)
   N110 G1 F10 X0 G4 P0.1
   N120 G91 G81 X1 Y0 Z-1 R1 L4(canned drill cycle)
   N130 G90 G0 X0 Y1
   N140 Z0
   N150 G91 G81 X1 Y0 Z-0.5 R1 L4(canned drill cycle)
   N160 G80 (turn off canned cycle)
   N170 M2 (program end)

The G98 to the second line above means that the return move will be to the value of Z in the first
line since it is higher that the R value specified.

|eight|

Twelve Holes in a Square

This example demonstrates the use of the L word to repeat a set of incremental drill cycles for
successive blocks of code within the same G81 motion mode. Here we produce 12 holes using five lines
of code in the canned motion mode.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   N1000 G90 G0 X0 Y0 Z0 (move coordinate home)
   N1010 G1 F50 X0 G4 P0.1
   N1020 G91 G81 X1 Y0 Z-0.5 R1 L4 (canned drill cycle)
   N1030 X0 Y1 R0 L3 (repeat)
   N1040 X-1 Y0 L3 (repeat)
   N1050 X0 Y-1 L2 (repeat)
   N1060 G80 (turn off canned cycle)
   N1070 G90 G0 X0 (rapid move home)
   N1080 Y0
   N1090 Z0
   N1100 M2 (program end)

|twelve|

The second reason to use a canned cycle is that they all produce
preliminary moves and returns that you can anticipate and control
regardless of the start point of the canned cycle.

G80 Cancel Canned Cycle
-----------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G80`` - cancel canned cycle modal motion. ``G80`` is part of modal group 1, so programming any other
Fabrice Salvaire's avatar
Fabrice Salvaire committed
  G code from modal group 1 will also cancel the canned cycle.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* Axis words are programmed when G80 is active.

G80 Example

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G90 G81 X1 Y1 Z1.5 R2.8 (absolute distance canned cycle)
   G80 (turn off canned cycle motion)
   G0 X0 Y0 Z0 (rapid move to coordinate home)

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

G0 Example

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G90 G81 X1 Y1 Z1.5 R2.8 (absolute distance canned cycle)
   G0 X0 Y0 Z0 (rapid move to coordinate home)

The advantage of the first set is that, the G80 line clearly turns off the G81 canned cycle. With
the first set of blocks, the programmer must turn motion back on with G0, as is done in the next
line, or any other motion mode G word.

If a canned cycle is not turned off with G80 or another motion word, the canned cycle will attempt
to repeat itself using the next block of code that contains an X, Y, or Z word. The following file
drills (G81) a set of eight holes as shown in the following caption.

G80 Example 1

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

|G80 Cycle|

Figure 5. G80 Cycle

The use of G80 in line N200 is optional because the G0 on the next line will turn off the G81
cycle. But using the G80 as shown in Example 1, will provide for easier to read canned
cycle. Without it, it is not so obvious that all of the blocks between N120 and N200 belong to the
canned cycle.

G81 Drilling Cycle
------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The ``G81`` cycle is intended for drilling.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

The cycle functions as follows:

#. Preliminary motion, as described in the `Preliminary and In-Between Motion
   <#gcode:preliminary-motion>`__ section.
#. Move the Z-axis at the current `feed rate <#sec:set-feed-rate>`__ to the Z position.
#. The Z-axis does a `rapid move <#gcode:g0>`__ to clear Z.

Example 1 - Absolute Position G81

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G90 G98 G81 X4 Y5 Z1.5 R2.8

This calls for absolute distance mode (G90) and OLD_Z retract mode (G98)
and calls for the G81 drilling cycle to be performed once.

The X value and X position are 4.

The Y value and Y position are 5.

The Z value and Z position are 1.5.

The R value and clear Z are 2.8. OLD_Z is 3.

The following moves take place:

#. a `rapid move <#gcode:g0>`__ parallel to the XY plane to (X4, Y5)
#. a rapid move move parallel to the Z-axis to (Z2.8).
#. move parallel to the Z-axis at the `feed rate <#sec:set-feed-rate>`__ to (Z1.5)
#. a rapid move parallel to the Z-axis to (Z3)

|G81ex1|

Example 2 - Relative Position G81

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

This calls for incremental distance mode (G91) and OLD_Z retract mode (G98). It also calls for the
G81 drilling cycle to be repeated three times. The X value is 4, the Y value is 5, the Z value is
-0.6 and the R value is 1.8. The initial X position is 5 (=1+4), the initial Y position is 7 (=2+5),
the clear Z position is 4.8 (=1.8+3), and the Z position is 4.2 (=4.8-0.6). OLD_Z is 3.

The first preliminary move is a maximum rapid move along the Z axis to (X1,Y2,Z4.8), since OLD_Z <
clear Z.

The first repeat consists of 3 moves.

#. a `rapid move <#gcode:g0>`__ parallel to the XY-plane to (X5, Y7)
#. move parallel to the Z-axis at the `feed rate <#sec:set-feed-rate>`__ to (Z4.2)
#. a rapid move parallel to the Z-axis to (X5, Y7, Z4.8)

The second repeat consists of 3 moves. The X position is reset to 9 (=5+4) and the Y position to 12
(=7+5).

#. a `rapid move <#gcode:g0>`__ parallel to the XY-plane to (X9, Y12, Z4.8)
#. move parallel to the Z-axis at the feed rate to (X9, Y12, Z4.2)
#. a rapid move parallel to the Z-axis to (X9, Y12, Z4.8)

The third repeat consists of 3 moves. The X position is reset to 13 (=9+4) and the Y position to 17
(=12+5).

#. a `rapid move <#gcode:g0>`__ parallel to the XY-plane to (X13, Y17, Z4.8)
#. move parallel to the Z-axis at the feed rate to (X13, Y17, Z4.2)
#. a rapid move parallel to the Z-axis to (X13, Y17, Z4.8)

|G81ex2|

Example 3 - Relative Position G81

Now suppose that you execute the first G81 block of code but from (X0, Y0, Z0) rather than from (X1,
Y2, Z3).

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G90 G98 G81 X4 Y5 Z1.5 R2.8

Since OLD_Z is below the R value, it adds nothing for the motion but since the initial value of Z is
less than the value specified in R, there will be an initial Z move during the preliminary moves.

|G81|

Example 4 - Absolute G81 R > Z

This is a plot of the path of motion for the second g81 block of code.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Since this plot starts with (X0, Y0, Z0), the interpreter adds the initial Z0 and R1.8 and rapid
moves to that location. After that initial Z move, the repeat feature works the same as it did in
example 3 with the final Z depth being 0.6 below the R value.

|G81a|

Example 5 - Relative position R > Z

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G90 G98 G81 X4 Y5 Z-0.6 R1.8

Since this plot starts with (X0, Y0, Z0), the interpreter adds the initial Z0 and R1.8 and rapid
Fabrice Salvaire's avatar
Fabrice Salvaire committed
moves to that location as in ``Example 4``.  After that initial Z move, the `rapid move <#gcode:g0>`__
Fabrice Salvaire's avatar
Fabrice Salvaire committed
to X4 Y5 is done. Then the final Z depth being 0.6 below the R value. The repeat function would make
the Z move in the same location again.

G82 Drilling Cycle, Dwell
-------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The ``G82`` cycle is intended for drilling with a dwell at the bottom of the hole.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

#. Preliminary motion, as described in the `Preliminary and In-Between Motion
   <#gcode:preliminary-motion>`__ section.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
#. Move the Z-axis at the current `feed rate <#sec:set-feed-rate>`__ to the Z position.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
#. Dwell for the P number of seconds.
#. The Z-axis does a `rapid move <#gcode:g0>`__ to clear Z.

The motion of a G82 canned cycle looks just like G81 with the addition of a dwell at the bottom of
Fabrice Salvaire's avatar
Fabrice Salvaire committed
the Z move. The length of the dwell is specified by a ``P-`` word in the G82 block.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

G83 Peck Drilling Cycle
-----------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The ``G83`` cycle (often called peck drilling) is intended for deep drilling or milling with chip
Fabrice Salvaire's avatar
Fabrice Salvaire committed
breaking. The retracts in this cycle clear the hole of chips and cut off any long stringers (which
Fabrice Salvaire's avatar
Fabrice Salvaire committed
are common when drilling in aluminum). This cycle takes a Q number which represents a ``delta``
increment along the Z-axis. The retract before final depth will always be to the ``retract`` plane
Fabrice Salvaire's avatar
Fabrice Salvaire committed
even if G98 is in effect. The final retract will honor the G98/99 in effect. G83 functions the same
as G81 with the addition of retracts during the drilling operation.

#. Preliminary motion, as described in the `Preliminary and In-Between Motion
   <#gcode:preliminary-motion>`__ section.
#. Move the Z-axis at the current `feed rate <#sec:set-feed-rate>`__ downward by delta or to the Z
   position, whichever is less deep.
#. Rapid move back out to the retract plane specified by the R word.
#. Rapid move back down to the current hole bottom, backed off a bit.
#. Repeat steps 2, 3, and 4 until the Z position is reached at step 2.
#. The Z-axis does a `rapid move <#gcode:g0>`__ to clear Z.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* the Q number is negative or zero.

G84 Right-hand Tapping Cycle, Dwell
-----------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The ``G84`` cycle is intended for tapping with floating chuck and dwell at the bottom of the hole.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

#. Preliminary motion, as described in the `Preliminary and In-Between Motion
   <#gcode:preliminary-motion>`__ section.
#. Disable Feed and Speed Overrides.
#. Move the Z-axis at the current feed rate to the Z position.
#. Stop the seleted spindle (chosen by the $ parameter)
#. Start spindle rotation counterclockwise.
#. Dwell for the P number of seconds.
#. Move the Z-axis at the current feed rate to clear Z
#. Restore Feed and Speed override enables to previous state

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The length of the dwell is specified by a ``P-`` word in the G84 block.  Thread pitch is F divided
Fabrice Salvaire's avatar
Fabrice Salvaire committed
by S. In example S100 F125 gives pitch of 1.25MM per revolution.

G85 Boring Cycle, Feed Out
--------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The ``G85`` cycle is intended for boring or reaming, but could be used for drilling or milling.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

#. Preliminary motion, as described in the `Preliminary and In-Between
   Motion <#gcode:preliminary-motion>`__ section.
#. Move the Z-axis only at the current `feed rate <#sec:set-feed-rate>`__ to the Z position.
#. Retract the Z-axis at the current feed rate to the R plane if it is lower than the initial Z.
#. Retract at the traverse rate to clear Z.

G86 Boring Cycle, Spindle Stop, Rapid Move Out
----------------------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The ``G86`` cycle is intended for boring. This cycle uses a P number for the number of seconds to
Fabrice Salvaire's avatar
Fabrice Salvaire committed
dwell.

#. Preliminary motion, as described in the `Preliminary and In-Between Motion
   <#gcode:preliminary-motion>`__ section.
#. Move the Z-axis only at the current `feed rate <#sec:set-feed-rate>`__ to the Z position.
#. Dwell for the P number of seconds.
#. Stop the selected spindle turning. (Chosen by the $ parameter)
#. The Z-axis does a `rapid move <#gcode:g0>`__ to clear Z.
#. Restart the spindle in the direction it was going.

Fabrice Salvaire's avatar
Fabrice Salvaire committed
**It is an error if:**
Fabrice Salvaire's avatar
Fabrice Salvaire committed

* the spindle is not turning before this cycle is executed.

G87 Back Boring Cycle
---------------------

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

G88 Boring Cycle, Spindle Stop, Manual Out
------------------------------------------

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

G89 Boring Cycle, Dwell, Feed Out
---------------------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
The ``G89`` cycle is intended for boring. This cycle uses a P number, where P specifies the number of
Fabrice Salvaire's avatar
Fabrice Salvaire committed
seconds to dwell.

#. Preliminary motion, as described in the `Preliminary and In-Between Motion
   <#gcode:preliminary-motion>`__ section.
#. Move the Z-axis only at the current `feed rate <#sec:set-feed-rate>`__ to the Z position.
#. Dwell for the P number of seconds.
#. Retract the Z-axis at the current feed rate to clear Z.

G90, G91 Distance Mode
----------------------

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G90`` - absolute distance mode In absolute distance mode, axis numbers (X, Y, Z, A, B, C, U,
  V, W) usually represent positions in terms of the currently active coordinate system. Any
  exceptions to that rule are described explicitly in the `G80 G89 <#gcode:g80-g89>`__ Section.
Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G91`` - incremental distance mode In incremental distance mode, axis numbers usually represent
Fabrice Salvaire's avatar
Fabrice Salvaire committed
  increments from the current coordinate.
Fabrice Salvaire's avatar
Fabrice Salvaire committed

G90 Example

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G90 (set absolute distance mode)
   G0 X2.5 (rapid move to coordinate X2.5 including any offsets in effect)

G91 Example

Fabrice Salvaire's avatar
Fabrice Salvaire committed
.. code:: text
Fabrice Salvaire's avatar
Fabrice Salvaire committed

   G91 (set incremental distance mode)
   G0 X2.5 (rapid move 2.5 from current position along the X axis)

* See `G0 <#gcode:g0>`__ section for more information.

.. _g901-g911-arc-distance-mode:

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

Fabrice Salvaire's avatar
Fabrice Salvaire committed
* ``G90.1`` - absolute distance mode for I, J & K offsets. When G90.1 is in effect I and J both must
Fabrice Salvaire's avatar
Fabrice Salvaire committed
  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 & K offsets. G91.1 Returns I, J & K to their
  default behavior.