summaryrefslogtreecommitdiff
path: root/docs/html/gcode.html
blob: dd9cc0c9e6b7b9ae3082389a41825832bb9463e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<!-- 
Copyright (C) 2006, 2007 Jeff Epler

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-->
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<STYLE type="text/css"><!--
table { border: 1px solid black; border-collapse: collapse; }
table #titlerow th { border-bottom: 2px solid black; border-left: 2px solid black; text-align: center; }
table #titlerow th:first-child { border-bottom: 2px solid black; border-left: 0px; text-align: center; }
table td:first-child { border-left: 0px; }
table td { border-left: 1px solid black; padding-left: .25em; padding-right: .25em; }
table th { text-align: left; border-bottom: 1px solid black; border-top: 1px solid black; }
@media print {
@page { margin: .150in; }
html { padding: 0; margin: 0; }
body { padding: 3px; margin: 3px; }
* { font-size: 8pt }
a { text-decoration: none; color: black; }
table { width: 100%; }
}
td { background: white; color: black; }
tr.odd td { background: #d9d9d9; }
tr.head td, tr.head th { background: black; color: white; }
--></STYLE>
<TITLE>LinuxCNC "G-Code" Quick Reference</TITLE>
</HEAD>

<BODY>
<TABLE ID=ref1>
<CAPTION> LinuxCNC "G-Code" Quick Reference </CAPTION>
<COL id="group"> <COL id="code"> <COL id="params"> <COL id="description">
<TR id="titlerow"> <TH>Code <TH>Parameters <TH>Description </TR>
<TR> <TH>Motion <TD COLSPAN=2 STYLE="border-bottom: 1px solid black">(X Y Z A B C U V W apply to all motions) </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G0">G0</A> <TD> <TD> Rapid motion </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G1">G1</A> <TD> <TD> Coordinated motion ("Straight feed") </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G2-G3-Arc">G2, G3</A> <A HREF="gcode/gcode.html#sec:G2-G3-Arc"></A> <TD> I J K or R, P <TD> Coordinated helical motion ("Arc feed") CW or CCW </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G4-Dwell">G4</A> <TD> P <TD> Dwell (no motion for P seconds) </TR>

<TR> <TD> <A HREF="gcode/gcode.html#sec:G5-Cubic-Spline">G5</A> <TD> I J P Q <TD> Cubic spline </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G5_1-Quadratic-Spline">G5.1</A> <TD> I J <TD> Quadratic spline </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G5_2-G5_3-NURBS">G5.2</A> <TD> P L <TD> NURBS, add control point </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G5_2-G5_3-NURBS">G5.3</A> <TD> <TD> NURBS, execute </TR>

<TR> <TD> <A HREF="gcode/gcode.html#sec:G38-probe">G38.2&hellip;G38.5</A> <TD> <TD> Straight probe </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G33-Spindle-Sync">G33</A> <TD> K <TD> Spindle-synchronized motion </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G33_1-Rigid-Tapping">G33.1</A> <TD> K <TD> Rigid tapping </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G80-Cancel-Modal">G80</A> <TD> <TD> Cancel motion mode  </TR>
<TR> <TH>Canned cycles <TD COLSPAN=2>(X Y Z or U V W apply to canned cycles, depending on active plane) </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G81-Drilling-Cycle">G81</A>, <A HREF="gcode/gcode.html#sec:G82-Drilling-Dwell">G82</A> <TD> R L (P) <TD> Drilling cycle without (with) dwell </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G83-Drilling-Peck">G83</A>, <A HREF="gcode/gcode.html#sec:G73-Drilling-Cycle">G73</A> <TD> R L Q <TD> Peck and Chip-break drilling cycles </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G85-Boring-Feed-Out">G85</A>, <A HREF="gcode/gcode.html#sec:G89-Boring-Dwell">G89</A> <TD> R L (P) <TD> Boring cycle without (with) dwell </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G76-Threading-Canned">G76</A> <TD> P Z I J R K Q H L E<TD> Multipass lathe threading cycle </TR>
<TR> <TH COLSPAN=3>Distance Mode </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G90-G91">G90</A> <TD> <TD> Absolute distance mode </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G90-G91">G91</A> <TD> <TD> Incremental distance mode </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G90_1-G91_1">G90.1</A> <TD> <TD> Arc centers I,J,K are absolute </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G90_1-G91_1">G91.1</A> <TD> <TD> Arc centers I,J,K are relative to the arc's starting point </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G7-Diameter-Mode">G7</A> <TD> <TD> X Diameter mode (lathe) </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G8-Radius-Mode">G8</A> <TD> <TD> X Radius mode (lathe) </TR>
<TR> <TH COLSPAN=3>Feed Rate Mode </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G93-G94-G95-Mode">G93</A> <TD> <TD> Inverse time feed rate </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G93-G94-G95-Mode">G94</A> <TD> <TD> Units per minute feed rate </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G93-G94-G95-Mode">G95</A> <TD> <TD> Units per revolution </TR>
<TR> <TH COLSPAN=3>Spindle Control </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M3-M4-M5">M3, M4</A> <TD> S <TD> Turn spindle clockwise or counterclockwise </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M3-M4-M5">M5</A> <TD> <TD> Stop spindle </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M19">M19</A> <TD> <TD> Orient spindle </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G96-G97-Spindle">G96</A> <TD> S D <TD> CSS mode (Constant Surface Speed)</TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G96-G97-Spindle">G97</A> <TD> <TD> RPM mode </TR>
<TR> <TH COLSPAN=3>Coolant </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M7-M8-M9">M7</A> <TD> <TD> Turn mist on </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M7-M8-M9">M8</A> <TD> <TD> Turn flood on </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M7-M8-M9">M9</A> <TD> <TD> Turn all coolant off </TR>
<TR> <TH COLSPAN=3>Tool Length Offset </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G43">G43</A> <TD> H <TD> Use tool length offset from tool table</TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G43_1">G43.1</A> <TD> I K <TD> Use specified tool length offset for transient tool</TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G49-Tool">G49</A> <TD> <TD> Cancel tool length offset </TR>
<TR> <TH COLSPAN=3>Stopping </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M0-M1">M0</A> <TD> <TD> Program Pause </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M0-M1">M1</A> <TD> <TD> Optional Pause </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M2-M30">M2, M30</A> <TD> <TD> End Program </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M60">M60</A> <TD> <TD> Pallet Change Pause </TR>
<TR> <TH COLSPAN=3>Units </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G20-G21-Units">G20</A> <TD> <TD> Inches </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G20-G21-Units">G21</A> <TD> <TD> Millimeters </TR>
<TR> <TH>Plane Selection <TD COLSPAN=2>(affects G2, G3, G81&hellip;G89, G40&hellip;G42) </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G17-G18-G19">G17</A> <TD> <TD> Select XY plane </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G17-G18-G19">G18</A> <TD> <TD> Select XZ plane </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G17-G18-G19">G19</A> <TD> <TD> Select YZ plane </TR>
<TR> <TH COLSPAN=3>Cutter Radius Compensation </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G40">G40</A> <TD> <TD> Cancel cutter radius compensation </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G41-G42">G41,G42</A> <TD> D <TD> Start cutter radius compensation left or right </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G41_1-G42_1">G41.1, G42.1</A> <TD> D L <TD> Start cutter radius compensation left or right, transient tool </TR>
<TR> <TH COLSPAN=3>Path Control Mode </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G61-G61_1">G61</A> <TD> <TD> Exact Path mode </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G61-G61_1">G61.1</A> <TD> <TD> Exact Stop mode </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G64">G64</A> <TD> P <TD> Continuous mode with optional path tolerance </TR>
<TR> <TH COLSPAN=3>Return Mode in Canned Cycles </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G98-G99-Set">G98</A> <TD> <TD> Retract to prior position </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G98-G99-Set">G99</A> <TD> <TD> Retract to R position </TR>
<TR> <TH COLSPAN=3>Other Modal Codes </TR>
<TR> <TD> <A HREF="gcode/other-code.html#sec:F-feed-rate">F</A> <TD> <TD> Set Feed Rate </TR>
<TR> <TD> <A HREF="gcode/other-code.html#sec:S-spindle-speed">S</A> <TD> <TD> Set Spindle Speed </TR>
<TR> <TD> <A HREF="gcode/other-code.html#sec:T-Select-Tool">T</A> <TD> <TD> Select Tool (also see <a href="gcode/m-code.html#sec:M6-Tool-Change">M6</a>)</TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M48-M49-Override">M48, M49</A> <TD> <TD> Speed and Feed Override Control</TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M50-Feed-Override">M50</A> <TD> P0 (off) or P1 (on) <TD> Feed Override Control</TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M51-Spindle-Override">M51</A> <TD> P0 (off) or P1 (on) <TD> Spindle Speed Override Control</TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M52-Adaptive-Feed-Control">M52</A> <TD> P0 (off) or P1 (on) <TD> Adaptive Feed Control</TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M53-Feed-Stop-Control">M53</A> <TD> P0 (off) or P1 (on) <TD> Feed Stop Control</TR>
<TR> <TD><A HREF="gcode/gcode.html#sec:G54-G59_3">G54&hellip;G59.3</A> <TD> <TD> Select coordinate system </TR>
<TR> <TH COLSPAN=3>Flow-control Codes </TR>
<TR> <TD> <A HREF="gcode/o-code.html#sec:subroutines">O- sub</A> <TD> <TD>Subroutines, sub/endsub call</TR>
<TR> <TD> <A HREF="gcode/o-code.html#sec:looping">O- while</A> <TD> <TD>Looping, while/endwhile do/while</TR>
<TR> <TD> <A HREF="gcode/o-code.html#sec:conditional">O- if</A> <TD> <TD>Conditional, if/else/endif</TR>
<TR> <TD> <A HREF="gcode/o-code.html#sec:repeat">O- repeat</A> <TD> <TD>Run enclosed code more than once</TR>
<TR> <TD> <A HREF="gcode/m-code.html#_m70_save_modal_state_a_id_sec_m70_save_modal_state_a">M70</A> <TD> <TD>Save modal state</TR>
<TR> <TD> <A HREF="gcode/m-code.html#_m71_invalidate_stored_modal_state_a_id_sec_m71_invalidate_stored_modal_state_a">M71</A> <TD> <TD>Invalidate stored state</TR>
<TR> <TD> <A HREF="gcode/m-code.html#_m72_restore_modal_state_a_id_sec_m72_restore_modal_state_a">M72</A> <TD> <TD>Restore modal state</TR>
<TR> <TD> <A HREF="gcode/m-code.html#_m73_save_and_autorestore_modal_state_a_id_sec_m73_save_autorestore_modal_state_a">M73</A> <TD> <TD>Save and Auto-restore modal state</TR>
<TR> <TH COLSPAN=3>Input/Output Codes </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M62-M65">M62&hellip;M65</A> <TD> P <TD> Digital Output Control </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M66-Input-Control">M66</A> <TD> P E L Q <TD> Digital and Analog Input Control </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M67-Analog-Output">M67</A> <TD> T <TD> Analog Output Synchronized with Motion </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M68-Analog-Output">M68</A> <TD> T <TD> Analog Output Immediate </TR>
<TR> <TH COLSPAN=3>Non-modal Codes </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M6-Tool-Change">M6</A> <TD> T <TD> Change tool </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M61-Set-Current-Tool-Number">M61</A> <TD> Q <TD> Set Current Tool </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G4-Dwell">G4</A> <TD> P <TD> Dwell (seconds) </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G10-L1_">G10 L1</A> <TD> P Q R <em>axes</em> <TD> Tool offset, radius, orientation setting </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G10-L10">G10 L10</A> <TD> P <em>axes</em> <TD> Tool offset, setting calculated from workpiece</TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G10-L11">G10 L11</A> <TD> P <em>axes</em> <TD> Tool offset, setting calculated from fixture</TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G10-L2_">G10 L2</A> <TD> P R <em>axes</em> <TD> Coordinate system origin, rotation setting </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G10-L20">G10 L20</A> <TD> P <em>axes</em> <TD> Coordinate system origin setting calculated</TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G28-G28_1">G28, G28.1</A> <TD> <TD> Return to or Set reference point 1 </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G30-G30_1">G30, G30.1</A> <TD> <TD> Return to or Set reference point 2 </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G53-Move-in">G53</A> <TD> <TD> Motion in machine coordinate system </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G92">G92</A> <TD> <em>axes</em> <TD> Offset coordinate systems and set parameters </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G92_1-G92_2">G92.1</A> <TD> <TD> Cancel offset coordinate systems and set parameters to zero </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G92_1-G92_2">G92.2</A> <TD> <TD> Cancel offset coordinate systems but do not reset parameters </TR>
<TR> <TD> <A HREF="gcode/gcode.html#sec:G92_3">G92.3</A> <TD> <TD> Apply parameters to offset coordinate systems  </TR>
<TR> <TD> <A HREF="gcode/m-code.html#sec:M100-to-M199">M101&hellip;M199</A> <TD> P Q <TD> User-defined M-codes </TR>
<TR> <TH COLSPAN=3>Comments &amp; Messages</TR>
<TR> <TD> <A HREF="gcode/overview.html#sec:comments">(&hellip;)</A> <TD> <TD> An inline comment </TR>
<TR> <TD> <A HREF="gcode/overview.html#sec:messages">(MSG,&hellip;)</A> <TD> <TD> Display a message "<STRONG>&hellip;</STRONG>" to the user (e.g., in a popup)</TR>
<TR> <TD> <A HREF="gcode/overview.html#sec:debug-messages">(DEBUG,&hellip;)</A> <TD> <TD> Display a message (with variables substituted) like MSG</TR>
<TR> <TD> <A HREF="gcode/overview.html#sec:print-messages">(PRINT,&hellip;)</A> <TD> <TD> Display a message (with variables substituted) to stderr</TR>
</TABLE>
<SCRIPT type="text/javascript"><!--
var rows=document.evaluate('//tr', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
var j=0;
for(var i=0; i<rows.snapshotLength; i++) {
    var it = rows.snapshotItem(i);
    var th = document.evaluate('th', it, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    if(th.snapshotLength) {
        it.setAttribute('class', 'head');
        j = 0;
    } else {
        if(j) it.setAttribute('class', 'odd');
        j = !j;
    }
}

function fixup_urls() {
var links=document.evaluate('//a[@href]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    for(var i=0; i<links.snapshotLength; i++) {
        var it = links.snapshotItem(i);
        it.setAttribute('href',
            "http://linuxcnc.org/docs/devel/html/" + it.getAttribute('href'));
    }
}

// In the LinuxCNC package, gcode/gcode.html is (probably) not included.  In this
// case, fix up the links to point at the online version instead of a local
// version
if(document.location.protocol == "file:") {
    try {
        var x = document.implementation.createDocument("", "", null);
        x.load("gcode/gcode.html");
        x.onerror = fixup_urls;
    } catch(err) {
        fixup_urls();
    }
}
// --></SCRIPT>
</BODY>