# The GCode section

**URL:** <https://forum.onefinitycnc.com/t/the-gcode-section/950>\
**Category:** Troubleshooting (X35/X50)\
**Created:** [September 22, 2020, 8:06pm UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950 "2020-09-22T20:06:01Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![MindOfMcClure](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/mindofmcclure/32/38_2.png) [@MindOfMcClure](https://forum.onefinitycnc.com/u/MindOfMcClure)\
**Post date:** [September 22, 2020, 8:06pm UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/1 "2020-09-22T20:06:01Z")

</div>

@Mark

Question, so I noticed when I tried to do my first carve last night which was from GCode generated out of Easel, the carve went well but the machine did not prompt to probe like it does when I ran your sample file that came with the machine.

My question is, does the code in the GCode section of the controller get injected into ALL jobs that the machine runs, or is there something I need to add to the code for example from Easel to get it to probe as the sample file does? If it does not, is there a way to auto inject it into the code so it always prompts no matter what file you use?

First few lines of my Easel file:

G20  
G90  
G1 Z0.15000 F9.0  
G0 X2.30038 Y2.99948  
G1 Z-0.15000 F15.0  
G1 X2.30209 Y3.00787 F60.0  
G1 X2.29376 Y3.01270 F60.0  
G1 X2.28934 Y3.01059 F60.0  
G1 X2.28848 Y2.99960 F60.0

 ![image](https://us1.discourse-cdn.com/flex022/uploads/onefinitycnc/original/2X/f/fdd5f0ba7ba1bdec972e0cbfe53c879aa8917092.jpeg)

---

<div class="post-metadata">

**Author:** ![OnefinityCNC](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/onefinitycnc/32/7_2.png) [@OnefinityCNC](https://forum.onefinitycnc.com/u/OnefinityCNC)\
**Post date:** [September 22, 2020, 9:56pm UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/2 "2020-09-22T21:56:22Z")

</div>

It has to do with the post processor that @Mark used when he programmed that file. (vectric with the post processor that asks for probe). M6 is the probe command. Easel does not put an m6 probe command in their export gcode, so if you use easel, it will never ask to probe during the cut. You’ll need to probe before running the file.

---

<div class="post-metadata">

**Author:** ![OnefinityCNC](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/onefinitycnc/32/7_2.png) [@OnefinityCNC](https://forum.onefinitycnc.com/u/OnefinityCNC)\
**Post date:** [September 22, 2020, 10:01pm UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/3 "2020-09-22T22:01:06Z")

</div>

to answer your question, all the code in the gcode section of the controller does is tell the controller what to do when it receives a m/g/s/f/gcode command.

---

<div class="post-metadata">

**Author:** ![MindOfMcClure](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/mindofmcclure/32/38_2.png) [@MindOfMcClure](https://forum.onefinitycnc.com/u/MindOfMcClure)\
**Post date:** [September 22, 2020, 10:19pm UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/4 "2020-09-22T22:19:54Z")

</div>

adding @charleyntexas

**Can I not just add this code to my GCode export from Ease to achieve the same thing?l:**  
M70  
G21  
G0 Z100  
M0 M6 (MSG, Attach T-Plate & Magnet to Router)  
F100  
G91  
G0 Z100 _[OR should this line be: G38.2 Z-100]_  
G0 Z25  
M0 (MSG, Remove T-Plate & Magnet)  
M72

In reading through the Buildbotics manual it looks like that is right, at least to my novice eye.

Thanks,  
-Alex

---

<div class="post-metadata">

**Author:** ![OnefinityCNC](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/onefinitycnc/32/7_2.png) [@OnefinityCNC](https://forum.onefinitycnc.com/u/OnefinityCNC)\
**Post date:** [September 22, 2020, 11:41pm UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/5 "2020-09-22T23:41:10Z")

</div>

at this to the very top of the easel gcode to add probing:  
T1 M6

---

<div class="post-metadata">

**Author:** ![MindOfMcClure](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/mindofmcclure/32/38_2.png) [@MindOfMcClure](https://forum.onefinitycnc.com/u/MindOfMcClure)\
**Post date:** [September 23, 2020, 12:01am UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/6 "2020-09-23T00:01:11Z")

</div>

Thanks… that’s exactly what I needed… much appreciated!

---

<div class="post-metadata">

**Author:** ![MindOfMcClure](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/mindofmcclure/32/38_2.png) [@MindOfMcClure](https://forum.onefinitycnc.com/u/MindOfMcClure)\
**Post date:** [September 23, 2020, 12:47am UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/7 "2020-09-23T00:47:44Z")

</div>

Any idea why I’m getting this error?

| Level | Source | Location | Repeat | Message |
| --- | --- | --- | --- | --- |
| message | Planner | MCT Oil Holder.nc:5 | 1 | Attach T-Plate & Magnet |
| error | Planner | Planner.py:370 | 1 | Traceback (most recent call last): File “/usr/local/lib/python3.5/dist-packages/bbctrl-1.0.2-py3.5.egg/bbctrl/Planner.py”, line 367, in restart self.planner.restart(id, position) RuntimeError: Planner ID 40680 not found. Queue empty. |
| error | Planner | Planner.py:383 | 1 | Z axis position -133.737mm is less than minimum soft limit -133mm While executing GCode block:G1 Z-0.625 F15 At: ./upload/MCT Oil Holder.nc:13827 Caused by: Z axis position -133.737mm is less than minimum soft limit -133mm |
| message | Planner | MCT Oil Holder.nc:10 | 1 | Remove T-Plate, Magnet & Start Spindle |
| message | Planner | MCT Oil Holder.nc:5 | 1 | Attach T-Plate & Magnet |

---

<div class="post-metadata">

**Author:** ![Mark](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/mark/32/129_2.png) [@Mark](https://forum.onefinitycnc.com/u/Mark)\
**Post date:** [September 23, 2020, 1:30am UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/8 "2020-09-23T01:30:33Z")

</div>

Hey Alex… Looks like your bit can’t reach the bottom of your cutting profile. If possible, try pulling the bit out of the router collet by roughly 1mm (looks like you need at least .737mm more), or use a longer bit. If these suggestions aren’t possible, try mounting the Z-Slider using the lower set of holes or adding another layer to your wasteboard. Hope this helps. Please let me know how it goes. Talk soon…

---

<div class="post-metadata">

**Author:** ![sghawley](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sghawley](https://forum.onefinitycnc.com/u/sghawley)\
**Post date:** [September 23, 2020, 8:36pm UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/9 "2020-09-23T20:36:33Z")

</div>

Alex,  
For future reference, only one M code is allowed for each line of code. M0 is program stop, and M6 is tool change.  
More than one G code is allowed as long as they are not from the same group. Example, you cannot put a G0(rapid move) and a G1(linear feed rate move) on the same line.

---

<div class="post-metadata">

**Author:** ![MindOfMcClure](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/mindofmcclure/32/38_2.png) [@MindOfMcClure](https://forum.onefinitycnc.com/u/MindOfMcClure)\
**Post date:** [September 23, 2020, 9:32pm UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/10 "2020-09-23T21:32:45Z")

</div>

Thank you Steven, that is super helpful. I was reading the buildbotics manual and they had both on a single line. So without that understanding it made sense to have both, but with your clarity it makes it more clear for sure.

Cheers’

---

<div class="post-metadata">

**Author:** ![sghawley](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sghawley](https://forum.onefinitycnc.com/u/sghawley)\
**Post date:** [September 24, 2020, 11:04am UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/11 "2020-09-24T11:04:27Z")

</div>

Alex,  
If you saw it in the Buildbotics manual, I may be mistaken about this controller. My 40+ years of programming G-code for CNC milling machines was mostly with Fanuc controllers. On their controllers, the rule is that only one M-code is allowed for each block of code. My apologies if I confused the issue.

---

<div class="post-metadata">

**Author:** ![MindOfMcClure](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/mindofmcclure/32/38_2.png) [@MindOfMcClure](https://forum.onefinitycnc.com/u/MindOfMcClure)\
**Post date:** [September 24, 2020, 1:10pm UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/12 "2020-09-24T13:10:10Z")

</div>

Thanks Steven

I’m sure putting it on two lines is safer and I cannot see any downside of doing that as it will be the next executed line regardless.

Appreciate your help and the experience you bring to the board!

-Alex

---

<div class="post-metadata">

**Author:** ![charleyntexas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/charleyntexas/32/118_2.png) [@charleyntexas](https://forum.onefinitycnc.com/u/charleyntexas)\
**Post date:** [September 25, 2020, 11:53am UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/13 "2020-09-25T11:53:19Z")

</div>

Just so you know, you can actually manually edit your gcode files and add multiple optional stop points and message boxes that will popup on screen giving you custom messages.

I created a gcode file that is actually a combination of four different carving files to carve 4 different parts. The parts are placed in a jig so they are always aligned the same. After each part is finished I inserted an optional stop code (M0) with a message to attach my probe magnet. When I click continue, the spindle moves to a pre designated location and probers the Z height and resets it. Then moves back to home and another MO with a message tells me to remove the magnet. When I remove the probe magnet and click on Continue, the router turns on automatically and it carves the part it just probed. This repeats until the last part is carved and the spindle moves towards the back of the machine instead of home so it is out of the way for me to change the parts out for the next set.

After I change out the parts putting in fresh blanks, I just hit the play button and the spindle moves to home and the first optional stop pops up telling me to put on the probe magnet. and everything just repeats. If you are making the same parts over and over this is a huge time saver.

---

<div class="post-metadata">

**Author:** ![GregoryG](https://avatars.discourse-cdn.com/v4/letter/g/97f17d/32.png) [@GregoryG](https://forum.onefinitycnc.com/u/GregoryG)\
**Post date:** [May 27, 2022, 3:38pm UTC](https://forum.onefinitycnc.com/t/the-gcode-section/950/14 "2022-05-27T15:38:36Z")

</div>

Hi Charlie,  
I am hoping you would give an example of a Gcode that you added these stops?
