Skip to content
g-code.txt 81.7 KiB
Newer Older
2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433
. a <<gcode:g0,rapid move>> 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)

image::images/G81ex2.png[align="center"]

.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).

----
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.

image::images/G81.png[align="center"]

.Example 4 - Absolute G81 R > Z

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

----
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.

image::images/G81a.png[align="center"]

.Example 5 - Relative position R > Z

----
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 moves to that location as in 'Example 4'. After that initial Z
move, the <<gcode:g0,rapid move>> 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.

[[gcode:g82]]
== G82 Drilling Cycle, Dwell
(((G82 Drilling Cycle Dwell)))

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

The 'G82' cycle is intended for drilling with a dwell at the bottom of
the hole.

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

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

[[gcode:g83]]
== G83 Peck Drilling Cycle
(((G83 Peck Drilling)))

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

The 'G83' cycle (often called peck drilling) is intended for deep
drilling or
milling with chip breaking. The retracts in this cycle clear the hole
of chips and cut off any long stringers (which 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 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
   <<gcode:preliminary-motion,Preliminary and In-Between Motion>> section.
 . Move the Z-axis at the current <<sec:set-feed-rate,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 <<gcode:g0,rapid move>> to clear Z. 

It is an error if:

* the Q number is negative or zero.

[[gcode:g84]]
== G84 Right-hand Tapping Cycle, Dwell
(((G84 Right-hand Tapping Cycle Dwell)))

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

The 'G84' cycle is intended for tapping with floating chuck and dwell at the bottom of the hole.

    1. Preliminary motion, as described in the
       <<gcode:preliminary-motion,Preliminary and In-Between Motion>> section.

    2. Disable Feed and Speed Overrides.

    3. Move the Z-axis at the current feed rate to the Z position.

    4. Stop the seleted spindle (chosen by the $ parameter)

    5. Start spindle rotation counterclockwise.

    6. Dwell for the P number of seconds.

    7. Move the Z-axis at the current feed rate to clear Z

    8. Restore Feed and Speed override enables to previous state

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

[[gcode:g85]]
== G85 Boring Cycle, Feed Out
(((G85 Boring, Feed Out)))

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

The 'G85' cycle is intended for boring or reaming, but could be used
for drilling or milling.

 . Preliminary motion, as described in the
   <<gcode:preliminary-motion,Preliminary and In-Between Motion>> section.
 . Move the Z-axis only at the current <<sec:set-feed-rate,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. 

[[gcode:g86]]
== G86 Boring Cycle, Spindle Stop, Rapid Move Out
(((G86 Boring, Spindle Stop, Rapid Move Out)))

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

The 'G86' cycle is intended for boring. This cycle uses a P number
for the number of seconds to dwell.

 . Preliminary motion, as described in the
   <<gcode:preliminary-motion,Preliminary and In-Between Motion>> section.
 . Move the Z-axis only at the current <<sec:set-feed-rate,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 <<gcode:g0,rapid move>> to clear Z.
 . Restart the spindle in the direction it was going. 

It is an error if:

* 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.

[[gcode:g89]]
== G89 Boring Cycle, Dwell, Feed Out
(((G89 Boring, Dwell, Feed Out)))

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

The 'G89' cycle is intended for boring. This cycle uses a P number,
where P specifies the number of seconds to dwell.

 . Preliminary motion, as described in the
   <<gcode:preliminary-motion,Preliminary and In-Between Motion>> section.
 . Move the Z-axis only at the current <<sec:set-feed-rate,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. 

[[gcode:g90-g91]]
== G90, G91 Distance Mode
(((G90, G91 Distance Mode)))

* '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 <<gcode:g80-g89,G80 G89>> Section.

* 'G91' - incremental distance mode In incremental
  distance mode, axis numbers usually represent
  increments from the current coordinate.

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

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

* See <<gcode:g0,G0>> section for more information.

[[gcode:g90.1-g91.1]]
== G90.1, G91.1 Arc Distance Mode
(((Arc Distance Mode)))

* 'G90.1' - absolute distance mode for I, J & K offsets.
  When G90.1 is in effect I and J both must 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.

[[gcode:g92]]
== G92 Coordinate System Offset
(((G92 Coordinate System Offset)))

----
G92 axes
----

[WARNING]
Only use 'G92' after your machine has been positioned to the desired point. 

'G92' makes the current point have the coordinates you want (without
motion), where the axis words contain the axis numbers you want.
All axis words are optional, except that at least one must be used.
If an axis word is not used for a given axis, the offset for that axis 
will be zero. 

When 'G92' is executed, the <<sec.machine-corrdinate-system,origins>> 
of all coordinate systems move. They move such that the value of the 
current controlled point, in the currently active coordinate system, 
becomes the specified value. All of the coordinate system's origins 
(G53-G59.3) are offset this same distance. 

'G92' uses the values stored in <<sub:numbered-parameters,parameters>> 
5211-5219 as the X Y Z A B C U V W offset values for each axis. 
The parameter values are 'absolute' machine coordinates 
in the native machine 'units' as specified in the ini file.
All axes defined in the ini file will be offset when G92 is active. 
If an axis was not entered following the G92, that axis' offset 
will be zero. 

For example, suppose the current point is at X=4 and there is
currently no 'G92' offset active. Then 'G92 X7' is programmed. This
moves all origins -3 in X, which causes the
current point to become X=7. This -3 is saved in parameter 5211.

Being in incremental distance mode (G91 instead of G90) has no effect 
on the action of 'G92'.

'G92' offsets may be already be in effect when the 'G92' is called.
If this is the case, the offset is replaced with a new
offset that makes the current point become the specified value.

It is an error if:

* all axis words are omitted.

LinuxCNC stores the G92 offsets and reuses them on the next run of a
program. To prevent this, one can program a G92.1 (to erase them), or
program a G92.2 (to remove them - they are still stored).

[NOTE]
The 'G52' command can also be used to change this offset; see the
<<sec:g52-and-g92-offsets,Offsets>> Section for more details about
'G92' and 'G52' and how they interact.

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

See the <<gcode:parameters,Parameters>> Section for more information.

[[gcode:g92.1-g92.2]]
== G92.1, G92.2 Reset G92 Offsets

* 'G92.1' - turn off G92 offsets and reset <<sub:numbered-parameters,parameters>> 5211 - 5219 to zero.
* 'G92.2' - turn off G92 offsets but keep <<sub:numbered-parameters,parameters>> 5211 - 5219 available. 

[NOTE]
G92.1 only clears G92 offsets, to change G53-G59.3 coordinate system offsets
in G code use either <<gcode:g10-l2,G10 L2>> or <<gcode:g10-l20,G10 L20>>.

[[gcode:g92.3]]
== G92.3 Restore G92 Offsets
(((G92.3 Restore G92 Offsets)))

* 'G92.3' - set the G92 offset to the values saved in parameters 5211 to 5219

You can set 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 remainder of the
first program. The parameter values will be saved when the first
program exits and restored when the second one starts up.
Use 'G92.3' near the beginning of the second program. That will restore
the offsets saved in the first program.

[[gcode:g93-g94-g95]]
== G93, G94, G95: Feed Rate Mode
(((G93, G94, G95: Feed Rate Mode)))

* 'G93' - is Inverse Time Mode. In inverse time feed rate mode, an F word
  means the move should be completed in [one divided by the F number]
  minutes. For example, if the F number is 2.0, the move should be
  completed in half a minute.
+
When the inverse time feed rate mode is active, an F word must appear
on every line which has a G1, G2, or G3 motion, and an F word on a line
that does not have G1, G2, or G3 is ignored. Being in inverse time feed
rate mode does not affect G0 (<<gcode:g0,rapid move>>) motions.

* 'G94' - is Units per Minute Mode.
In units per minute feed mode, an F word is interpreted to mean
the controlled point should move at a certain number of inches per
minute, millimeters per minute, or degrees per minute, depending upon
what length units are being used and which axis or axes are moving.

* 'G95' - is Units per Revolution Mode
In units per revolution mode, an F word is interpreted to mean the
controlled point should move a certain number of inches per revolution
of the spindle, depending on what length units are being used and which
axis or axes are moving. G95 is not suitable for threading, for
threading use G33 or G76.
G95 requires that spindle.N.speed-in to be connected. The actual spindle
to which the feed is synchronised is chosen by the $ parameter

It is an error if:

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

[[gcode:g96-g97]]
== G96, G97 Spindle Control Mode
(((G96, G97 Spindle Control Mode)))

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

* 'D' - maximum spindle RPM
* 'S' - surface speed
* '$" - the spindle of which the speed will be varied. 

* 'G96 D- S-' - selects constant surface speed of 'S' feet per minute
                (if G20 is in effect) or meters per minute
                (if G21 is in effect). D- is optional.
+                
When using G96, ensure that X0 in
the current coordinate system (including offsets and tool lengths) is
the center of rotation or LinuxCNC will not give the desired ssurface speed.
G96 is not affected by radius or diameter mode.

To achieve CSS mode on selected spindles programme successive G96 commands
for each spindle prior to issuing M3.

* 'G97' selects RPM mode.

.G96 Example Line
----
G96 D2500 S250 (set CSS with a max rpm of 2500 and a surface speed of 250)
----

It is an error if:

* S is not specified with G96
* A feed move is specified in G96 mode while the spindle is not turning

[[gcode:g98-g99]]
== G98, G99 Canned Cycle Return Level
(((G98, G99 Canned Cycle Return)))

* 'G98' - retract to the position that axis was in just before this series
of one or more contiguous canned cycles was started.

* 'G99' - retract to the position specified by the R word of the canned cycle.

Program a 'G98' and the canned cycle will use the Z position prior to
the canned cycle as the Z return position if it is higher than the R
value specified in the cycle. If it is lower, the R value will be
used. The R word has different meanings in absolute distance mode and
incremental distance mode.

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

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.

The 'initial' (G98) plane is reset any time cycle motion mode is
abandoned, whether explicitly (G80) or implicitly (any motion code
that is not a cycle). Switching among cycle modes (say G81
to G83) does NOT reset the 'initial' plane. It is possible to switch
between G98 and G99 during a series of cycles.

// vim: set syntax=asciidoc: