/ docs / html / gcode.html
gcode.html
  1  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2     "http://www.w3.org/TR/html4/strict.dtd">
  3  <!-- 
  4  Copyright (C) 2006, 2007 Jeff Epler
  5  
  6      This program is free software; you can redistribute it and/or modify
  7      it under the terms of the GNU General Public License as published by
  8      the Free Software Foundation; either version 2 of the License, or
  9      (at your option) any later version.
 10  
 11      This program is distributed in the hope that it will be useful,
 12      but WITHOUT ANY WARRANTY; without even the implied warranty of
 13      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14      GNU General Public License for more details.
 15  
 16      You should have received a copy of the GNU General Public License
 17      along with this program; if not, write to the Free Software
 18      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 19  -->
 20  <HTML>
 21  <HEAD>
 22  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
 23  <STYLE type="text/css"><!--
 24  table { border: 1px solid black; border-collapse: collapse; }
 25  table #titlerow th { border-bottom: 2px solid black; border-left: 2px solid black; text-align: center; }
 26  table #titlerow th:first-child { border-bottom: 2px solid black; border-left: 0px; text-align: center; }
 27  table td:first-child { border-left: 0px; }
 28  table td { border-left: 1px solid black; padding-left: .25em; padding-right: .25em; }
 29  table th { text-align: left; border-bottom: 1px solid black; border-top: 1px solid black; }
 30  @media print {
 31  @page { margin: .150in; }
 32  html { padding: 0; margin: 0; }
 33  body { padding: 3px; margin: 3px; }
 34  * { font-size: 8pt }
 35  a { text-decoration: none; color: black; }
 36  table { width: 100%; }
 37  }
 38  td { background: white; color: black; }
 39  tr.odd td { background: #d9d9d9; }
 40  tr.head td, tr.head th { background: black; color: white; }
 41  --></STYLE>
 42  <TITLE>LinuxCNC "G-Code" Quick Reference</TITLE>
 43  </HEAD>
 44  
 45  <BODY>
 46  <TABLE ID=ref1>
 47  <CAPTION> LinuxCNC "G-Code" Quick Reference </CAPTION>
 48  <COL id="group"> <COL id="code"> <COL id="params"> <COL id="description">
 49  <TR id="titlerow"> <TH>Code <TH>Parameters <TH>Description </TR>
 50  <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>
 51  <TR><TD><A HREF="gcode/g-code.html#gcode:g0">G0</A><TD><TD>Rapid Move</TR>
 52  <TR><TD><A HREF="gcode/g-code.html#gcode:g1">G1</A><TD><TD>Linear Move</TR>
 53  <TR><TD><A HREF="gcode/g-code.html#gcode:g2-g3">G2, G3</A><TD>I J K or R, P<TD>Arc Move</TR>
 54  <TR><TD><A HREF="gcode/g-code.html#gcode:g4">G4</A><TD>P<TD>Dwell</TR>
 55  <TR><TD><A HREF="gcode/g-code.html#gcode:g5">G5</A><TD>I J P Q<TD>Cubic Spline</TR>
 56  <TR><TD><A HREF="gcode/g-code.html#gcode:g5.1">G5.1</A><TD>I J<TD>Quadratic Spline</TR>
 57  <TR><TD><A HREF="gcode/g-code.html#gcode:g5.2-g5.3">G5.2</A><TD>P L<TD>NURBS</TR>
 58  <TR><TD><A HREF="gcode/g-code.html#gcode:g38">G38.2 - G38.5</A><TD><TD>Straight Probe</TR>
 59  <TR><TD><A HREF="gcode/g-code.html#gcode:g33">G33</A><TD>K ($)<TD>Spindle Synchronized Motion</TR>
 60  <TR><TD><A HREF="gcode/g-code.html#gcode:g33.1">G33.1</A><TD>K ($)<TD>Rigid Tapping</TR>
 61  <TR><TD><A HREF="gcode/g-code.html#gcode:g80">G80</A> <TD><TD>Cancel Canned Cycle</TR>
 62  
 63  <TR><TH>Canned cycles<TD COLSPAN=2>(X Y Z or U V W apply to canned cycles, depending on active plane)</TR>
 64  <TR><TD><A HREF="gcode/g-code.html#gcode:g81">G81</A><TD>R L (P)<TD>Drilling Cycle</TR>
 65  <TR><TD><A HREF="gcode/g-code.html#gcode:g82">G82</A><TD>R L (P)<TD>Drilling Cycle, Dwell</TR>
 66  <TR><TD><A HREF="gcode/g-code.html#gcode:g83">G83</A><TD>R L Q<TD>Drilling Cycle, Peck</TR>
 67  <TR><TD><A HREF="gcode/g-code.html#gcode:g84">G84</A><TD>R L (P) ($)<TD>Right-hand Tapping Cycle, Dwell</TR>
 68  <TR><TD><A HREF="gcode/g-code.html#gcode:g73">G73</A><TD>R L Q<TD>Drilling Cycle, Chip Breaking</TR>
 69  <TR><TD><A HREF="gcode/g-code.html#gcode:g74">G74</A><TD>R L (P) ($)<TD>Left-hand Tapping Cycle, Dwell</TR>
 70  <TR><TD><A HREF="gcode/g-code.html#gcode:g85">G85</A><TD>R L (P)<TD>Boring Cycle, Feed Out</TR>
 71  <TR><TD><A HREF="gcode/g-code.html#gcode:g89">G89</A><TD>R L (P)<TD>Boring Cycle, Dwell, Feed Out</TR>
 72  <TR><TD><A HREF="gcode/g-code.html#gcode:g76">G76</A><TD>P Z I J R K Q H L E ($)<TD>Threading Cycle</TR>
 73  
 74  <TR><TH COLSPAN=3>Distance Mode</TR>
 75  <TR><TD><A HREF="gcode/g-code.html#gcode:g90-g91">G90, G91</A><TD><TD>Distance Mode</TR>
 76  <TR><TD><A HREF="gcode/g-code.html#gcode:g90.1-g91.1">G90.1, G91.1</A><TD><TD>Arc Distance Mode</TR>
 77  <TR><TD><A HREF="gcode/g-code.html#gcode:g7">G7</A><TD><TD>Lathe Diameter Mode</TR>
 78  <TR><TD><A HREF="gcode/g-code.html#gcode:g8">G8</A><TD><TD>Lathe Radius Mode</TR>
 79  
 80  <TR><TH COLSPAN=3>Feed Rate Mode </TR>
 81  <TR><TD><A HREF="gcode/g-code.html#gcode:g93-g94-g95">G93, G94, G95</A><TD>S ($)<TD>Feed Rate Mode</TR>
 82  
 83  <TR><TH COLSPAN=3>Spindle Control </TR>
 84  <TR><TD><A HREF="gcode/m-code.html#mcode:m3-m4-m5">M3, M4, M5</A><TD>S ($)<TD>Spindle Control</TR>
 85  <TR><TD><A HREF="gcode/m-code.html#mcode:m19">M19</A><TD>R Q (P) ($)<TD>Orient Spindle</TR>
 86  <TR><TD><A HREF="gcode/g-code.html#gcode:g96-g97">G96, G97</A><TD> S D ($)<TD>Spindle Control Mode</TR>
 87  
 88  <TR><TH COLSPAN=3>Coolant </TR>
 89  <TR><TD><A HREF="gcode/m-code.html#mcode:m7-m8-m9">M7, M8, M9</A><TD><TD>Coolant Control</TR>
 90  
 91  <TR><TH COLSPAN=3>Tool Length Offset </TR>
 92  <TR><TD><A HREF="gcode/g-code.html#gcode:g43">G43</A> <TD> H <TD>Tool Length Offset</TR>
 93  <TR><TD><A HREF="gcode/g-code.html#gcode:g43.1">G43.1</A> <TD> <TD>Dynamic Tool Length Offset</TR>
 94  <TR><TD><A HREF="gcode/g-code.html#gcode:g43.2">G43.2</A> <TD> H <TD>Apply additional Tool Length Offset</TR>
 95  <TR><TD><A HREF="gcode/g-code.html#gcode:g49">G49</A> <TD> <TD>Cancel Tool Length Compensation</TR>
 96  
 97  <TR><TH COLSPAN=3>Stopping </TR>
 98  <TR><TD><A HREF="gcode/m-code.html#mcode:m0-m1">M0, M1</A><TD><TD>Program Pause</TR>
 99  <TR><TD><A HREF="gcode/m-code.html#mcode:m2-m30">M2, M30</A><TD> <TD>Program End</TR>
100  <TR><TD><A HREF="gcode/m-code.html#mcode:m60">M60</A><TD><TD>Pallet Change Pause</TR>
101  
102  <TR><TH COLSPAN=3>Units </TR>
103  <TR><TD><A HREF="gcode/g-code.html#gcode:g20-g21">G20, G21</A><TD> <TD>Units (inch, mm)</TR>
104  
105  <TR><TH>Plane Selection <TD COLSPAN=2>(affects G2, G3, G81&hellip;G89, G40&hellip;G42) </TR>
106  <TR><TD><A HREF="gcode/g-code.html#gcode:g17-g19.1">G17 - G19.1</A><TD><TD>Plane Select</TR>
107  
108  <TR><TH COLSPAN=3>Cutter Radius Compensation </TR>
109  <TR><TD><A HREF="gcode/g-code.html#gcode:g40">G40</A><TD><TD>Compensation Off</TR>
110  <TR><TD><A HREF="gcode/g-code.html#gcode:g41-g42">G41,G42</A><TD>D<TD>Cutter Compensation</TR>
111  <TR><TD><A HREF="gcode/g-code.html#gcode:g41.1-g42.1">G41.1, G42.1</A><TD>D L<TD>Dynamic Cutter Compensation</TR>
112  
113  <TR><TH COLSPAN=3>Path Control Mode </TR>
114  <TR><TD><A HREF="gcode/g-code.html#gcode:g61">G61 G61.1</A><TD><TD>Exact Path Mode</TR>
115  <TR><TD><A HREF="gcode/g-code.html#gcode:g61.1">G61.1</A><TD><TD>Exact Stop Mode</TR>
116  <TR><TD><A HREF="gcode/g-code.html#gcode:g64">G64</A><TD>P Q<TD>Path Blending</TR>
117  
118  <TR><TH COLSPAN=3>Return Mode in Canned Cycles </TR>
119  <TR><TD><A HREF="gcode/g-code.html#gcode:g98-g99">G98, G99</A><TD><TD>Canned Cycle Return Level</TR>
120  
121  <TR><TH COLSPAN=3>Other Modal Codes </TR>
122  <TR><TD><A HREF="gcode/other-code.html#sec:set-feed-rate">F</A><TD><TD>Set Feed Rate</TR>
123  <TR><TD><A HREF="gcode/other-code.html#sec:set-spindle-speed">S</A><TD>($)<TD>Set Spindle Speed</TR>
124  <TR><TD><A HREF="gcode/other-code.html#sec:select-tool">T</A><TD><TD>Select Tool</a>)</TR>
125  <TR><TD><A HREF="gcode/m-code.html#mcode:m48-m49">M48, M49</A><TD><TD>Speed and Feed Override Control</TR>
126  <TR><TD><A HREF="gcode/m-code.html#mcode:m50">M50</A><TD>P0 (off) or P1 (on)<TD>Feed Override Control</TR>
127  <TR><TD><A HREF="gcode/m-code.html#mcode:m51">M51</A><TD>P0 (off) or P1 (on) ($)<TD>Spindle Speed Override Control</TR>
128  <TR><TD><A HREF="gcode/m-code.html#mcode:m52">M52</A><TD>P0 (off) or P1 (on)<TD>Adaptive Feed Control</TR>
129  <TR><TD><A HREF="gcode/m-code.html#mcode:m53">M53</A><TD>P0 (off) or P1 (on)<TD>Feed Stop Control</TR>
130  <TR><TD><A HREF="gcode/g-code.html#gcode:g54-g59.3">G54-G59.3</A><TD><TD>Select Coordinate System</TR>
131  
132  <TR><TH COLSPAN=3>Flow-control Codes </TR>
133  <TR><TD><A HREF="gcode/o-code.html#ocode:subroutines">o sub</A><TD><TD>Subroutines, sub/endsub call</TR>
134  <TR><TD><A HREF="gcode/o-code.html#ocode:looping">o while</A><TD><TD>Looping, while/endwhile do/while</TR>
135  <TR><TD><A HREF="gcode/o-code.html#ocode:conditional">o if</A><TD><TD>Conditional, if/else/endif</TR>
136  <TR><TD><A HREF="gcode/o-code.html#ocode:repeat">o repeat</A><TD><TD>Repeat a loop of code</TR>
137  <TR><TD><A HREF="gcode/o-code.html#ocode:indirection">[]</A><TD><TD>Indirection</TR>
138  <TR><TD><A HREF="gcode/o-code.html#ocode:calling-files">o call</A><TD><TD>Call named file</TR>
139  <TR><TD><A HREF="gcode/m-code.html#mcode:m70">M70</A><TD><TD>Save modal state</TR>
140  <TR><TD><A HREF="gcode/m-code.html#mcode:m71">M71</A><TD><TD>Invalidate stored state</TR>
141  <TR><TD><A HREF="gcode/m-code.html#mcode:m72">M72</A><TD><TD>Restore modal state</TR>
142  <TR><TD><A HREF="gcode/m-code.html#mcode:m73">M73</A><TD><TD>Save and Auto-restore modal state</TR>
143  
144  <TR><TH COLSPAN=3>Input/Output Codes </TR>
145  <TR><TD><A HREF="gcode/m-code.html#mcode:m62-m65">M62 - M65</A><TD>P<TD>Digital Output Control</TR>
146  <TR><TD><A HREF="gcode/m-code.html#mcode:m66">M66</A><TD>P E L Q<TD>Wait on Input</TR>
147  <TR><TD><A HREF="gcode/m-code.html#mcode:m67">M67</A><TD>T<TD>Analog Output,Synchronized</TR>
148  <TR><TD><A HREF="gcode/m-code.html#mcode:m68">M68</A><TD>T<TD>Analog Output, Immediate</TR>
149  
150  <TR><TH COLSPAN=3>Non-modal Codes </TR>
151  <TR><TD><A HREF="gcode/m-code.html#mcode:m6">M6</A><TD>T<TD>Tool Change</TR>
152  <TR><TD><A HREF="gcode/m-code.html#mcode:m61">M61</A><TD>Q<TD>Set Current Tool</TR>
153  <TR><TD><A HREF="gcode/g-code.html#gcode:g10-l1">G10 L1</A><TD>P Q R<TD>Set Tool Table</TR>
154  <TR><TD><A HREF="gcode/g-code.html#gcode:g10-l10">G10 L10</A><TD>P<TD>Set Tool Table</TR>
155  <TR><TD><A HREF="gcode/g-code.html#gcode:g10-l11">G10 L11</A><TD>P<TD>Set Tool Table</TR>
156  <TR><TD><A HREF="gcode/g-code.html#gcode:g10-l2">G10 L2</A><TD>P R<TD>Set Coordinate System</TR>
157  <TR><TD><A HREF="gcode/g-code.html#gcode:g10-l20">G10 L20</A><TD>P<TD>Set Coordinate System</TR>
158  <TR><TD><A HREF="gcode/g-code.html#gcode:g28-g28.1">G28, G28.1</A><TD><TD>Go/Set Predefined Position</TR>
159  <TR><TD><A HREF="gcode/g-code.html#gcode:g30-g30.1">G30, G30.1</A><TD><TD>Go/Set Predefined Position</TR>
160  <TR><TD><A HREF="gcode/g-code.html#gcode:g53">G53</A><TD><TD>Move in Machine Coordinates</TR>
161  <TR><TD><A HREF="gcode/g-code.html#gcode:g92">G52, G92</A><TD><TD>Coordinate System Offset</TR>
162  <TR><TD><A HREF="gcode/g-code.html#gcode:g92.1-g92.2">G92.1, G92.2</A><TD><TD>Reset G92 Offsets</TR>
163  <TR><TD><A HREF="gcode/g-code.html#gcode:g92.3">G92.3</A><TD><TD>Restore G92 Offsets</TR>
164  <TR><TD><A HREF="gcode/m-code.html#mcode:m100-m199">M101 - M199</A><TD>P Q<TD>User Defined Commands</TR>
165  
166  <TR><TH COLSPAN=3>Comments &amp; Messages</TR>
167  <TR><TD><A HREF="gcode/overview.html#gcode:comments">; (&hellip;)</A><TD><TD>Comments</TR>
168  <TR><TD><A HREF="gcode/overview.html#gcode:messages">(MSG,&hellip;)</A><TD><TD>Messages</TR>
169  <TR><TD><A HREF="gcode/overview.html#gcode:debug">(DEBUG,&hellip;)</A><TD><TD>Debug Messages</TR>
170  <TR><TD><A HREF="gcode/overview.html#gcode:print">(PRINT,&hellip;)</A><TD><TD>Print Messages</TR>
171  </TABLE>
172  <SCRIPT type="text/javascript"><!--
173  var rows=document.evaluate('//tr', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
174  var j=0;
175  for(var i=0; i<rows.snapshotLength; i++) {
176      var it = rows.snapshotItem(i);
177      var th = document.evaluate('th', it, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
178      if(th.snapshotLength) {
179          it.setAttribute('class', 'head');
180          j = 0;
181      } else {
182          if(j) it.setAttribute('class', 'odd');
183          j = !j;
184      }
185  }
186  
187  function fixup_urls() {
188  var links=document.evaluate('//a[@href]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
189      for(var i=0; i<links.snapshotLength; i++) {
190          var it = links.snapshotItem(i);
191          it.setAttribute('href',
192              "http://linuxcnc.org/docs/devel/html/" + it.getAttribute('href'));
193      }
194  }
195  
196  // In the LinuxCNC package, gcode/g-code.html is (probably) not included.  In this
197  // case, fix up the links to point at the online version instead of a local
198  // version
199  if(document.location.protocol == "file:") {
200      try {
201          var x = document.implementation.createDocument("", "", null);
202          x.load("gcode/g-code.html");
203          x.onerror = fixup_urls;
204      } catch(err) {
205          fixup_urls();
206      }
207  }
208  // --></SCRIPT>
209  </BODY>