# Help with gcode

**URL:** <https://community.inventables.com/t/help-with-gcode/23449>\
**Category:** Uncategorized\
**Created:** [May 8, 2016, 2:29am UTC](https://community.inventables.com/t/help-with-gcode/23449 "2016-05-08T02:29:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MitchWillard](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/mitchwillard/32/52719_2.png) [@MitchWillard](https://community.inventables.com/u/MitchWillard)\
**Post date:** [May 8, 2016, 2:29am UTC](https://community.inventables.com/t/help-with-gcode/23449/1 "2016-05-08T02:29:10Z")

</div>

Looking for some help with generating a couple lines of gcode for using my keyhole bit.

I was able to jog the machine to get a few keyhole slots cut but I’d like to have some actual gcode so the bit moves at like 40/in min, instead of the default jog speed which is real fast and adrupt for cutting.

I need something that will move the z axis down say… .35" / y axis forward .5" / y axis back .5" / z axis up .35" , at that 40/in per min

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![AllenMassey](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/allenmassey/32/84441_2.png) [@AllenMassey](https://community.inventables.com/u/AllenMassey)\
**Post date:** [May 8, 2016, 2:37am UTC](https://community.inventables.com/t/help-with-gcode/23449/2 "2016-05-08T02:37:02Z")

</div>

This thread has it

> [@Keyhole Slot G Code](https://community.inventables.com/t/keyhole-slot-g-code/15616):
>
> Don’t know if this will be helpful, but I searched all over for a way to cut t-hole slots for hanging pictures and frames. It needs to plunge to a quarter of an inch, and then nibble forward, back up, nibble forward, back up, etc. This is if you don’t want the hassle of first cutting a quarter inch pocket, then following up with the keyhole bit. This code is for 1/8" depth of cut slot cutters. The bottom of the cut is only .25" deep so this is safe for .5" material. This code slows the plun…

---

<div class="post-metadata">

**Author:** ![ErikJenkins](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/erikjenkins/32/84368_2.png) [@ErikJenkins](https://community.inventables.com/u/ErikJenkins)\
**Post date:** [May 8, 2016, 2:38am UTC](https://community.inventables.com/t/help-with-gcode/23449/3 "2016-05-08T02:38:27Z")

</div>

G17  
G20  
G91  
S12000 M3  
G1 Z -0.35 F40  
G1 Y 0.5  
G1 Y -0.5  
G1 Z 0.35  
M5  
M2

This does what you asked…turns on spindle…cuts…and turns off spindle

---

<div class="post-metadata">

**Author:** ![ErikJenkins](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/erikjenkins/32/84368_2.png) [@ErikJenkins](https://community.inventables.com/u/ErikJenkins)\
**Post date:** [May 8, 2016, 2:40am UTC](https://community.inventables.com/t/help-with-gcode/23449/4 "2016-05-08T02:40:41Z")

</div>

Always test above the work (air cut) to make sure it does what you want. The code does what you asked, but look at what Allen linked…

---

<div class="post-metadata">

**Author:** ![MitchWillard](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/mitchwillard/32/52719_2.png) [@MitchWillard](https://community.inventables.com/u/MitchWillard)\
**Post date:** [May 8, 2016, 2:41am UTC](https://community.inventables.com/t/help-with-gcode/23449/5 "2016-05-08T02:41:26Z")

</div>

Could you explain the lines of code so I could get a better understanding?

---

<div class="post-metadata">

**Author:** ![ErikJenkins](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/erikjenkins/32/84368_2.png) [@ErikJenkins](https://community.inventables.com/u/ErikJenkins)\
**Post date:** [May 8, 2016, 2:45am UTC](https://community.inventables.com/t/help-with-gcode/23449/6 "2016-05-08T02:45:10Z")

</div>

G17 - default XY plane  
G20 - inches  
G91 - relative position  
S12000 M3 - spindle 12k rpm M3 - spindle on  
G1 - linear move at F40 - 40 inches per minute  
M5 - spindle off  
M2 - end

This example requires you to position the bit directly over the start position of the slot…again, check out Allen’s link above to cleanly cut a slot. This example will just plow through for half an inch…the link above will nibble the wood.

---

<div class="post-metadata">

**Author:** ![WillAdams](https://yyz1.discourse-cdn.com/flex009/user_avatar/community.inventables.com/willadams/32/67263_2.png) [@WillAdams](https://community.inventables.com/u/WillAdams)\
**Post date:** [May 9, 2016, 4:36pm UTC](https://community.inventables.com/t/help-with-gcode/23449/7 "2016-05-09T16:36:39Z")

</div>

G-code is pretty straight-forward. Page on it here: [Shapeoko CNC Router, Rigid, Accurate, Reliable, and Affordable](http://www.shapeoko.com/wiki/index.php/G-Code)
