# G-Code Optimizers?

**URL:** <https://forums.maslowcnc.com/t/g-code-optimizers/3246>\
**Category:** Software\
**Created:** [April 10, 2018, 11:28am UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246 "2018-04-10T11:28:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maslonians207](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Maslonians207](https://forums.maslowcnc.com/u/Maslonians207)\
**Post date:** [April 10, 2018, 11:28am UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/1 "2018-04-10T11:28:59Z")

</div>

Hello, I’ve asked this elsewhere but it seemed like an important enough topic to address separate.

For context I’m using Easel for design so if your program does this on it’s own, you likely don’t care.

Talking about optimizing the toolpaths/g-code for efficiency and controlling the order in which objects are cut in case of having a lot of small cuts on a larger piece you want to throughcut. We all know you don’t want the machine cutting through and placing the tabs first, before then moving all around on a potentially destabilized inner portion.

Also, I conducted a ~6 hour cut yesterday of a map diagram for a kid’s school project. I watched a large portion of the cut and was awestruck by how inefficient the path was. It would move roughly 36" across the sheet, lower z axis, cut a tiny indent and then raise, move up ~24" and cut another little thing, no rhyme or reason.

In the same “object” even (like an eight letter word for example) six of the letters were cut to full depth before two of the inner letters were even starting to form. There were some shallow passes on the two non-fully cut letters, but the machine went and did a ton of other stuff before returning and finishing those letters. Just a head scratcher and resulted in probably 100 unneeded slow full z-axis lifts and plunges.

What say we, Maslow community?

---

<div class="post-metadata">

**Author:** ![Jayster](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jayster](https://forums.maslowcnc.com/u/Jayster)\
**Post date:** [April 10, 2018, 12:46pm UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/2 "2018-04-10T12:46:27Z")

</div>

This one has been used in the past and does a better job than not having one. See the before and after picture here with a download link: [Social Science Projects - American Flag and Liberty Bell](https://forums.maslowcnc.com/t/social-science-projects-american-flag-and-liberty-bell/1440/9)

---

<div class="post-metadata">

**Author:** ![madgrizzle](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/madgrizzle/32/1372_2.png) [@madgrizzle](https://forums.maslowcnc.com/u/madgrizzle)\
**Post date:** [April 10, 2018, 12:52pm UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/3 "2018-04-10T12:52:35Z")

</div>

If find that sometimes the gcode optimizer fails when dealing with bit changes. So, if you use multiple bits, create separate gcodes for them in order for the program I referenced in the other post to work.

---

<div class="post-metadata">

**Author:** ![Maslonians207](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Maslonians207](https://forums.maslowcnc.com/u/Maslonians207)\
**Post date:** [April 10, 2018, 1:52pm UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/4 "2018-04-10T13:52:23Z")

</div>

Jayster - I did see that, but couldn’t get it to download or work right I’m not sure what I was doing wrong.

madgrizzle - I haven’t cut anything with bit changes yet, but that makes sense!

I also located this which is web-based and looks really fast/simple/easy, but I have not tried it yet so if anyone does, please report back.  
[http://xyzbots.com/gcode-optimizer/](http://xyzbots.com/gcode-optimizer/)

---

<div class="post-metadata">

**Author:** ![Gero](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/gero/32/17487_2.png) [@Gero](https://forums.maslowcnc.com/u/Gero)\
**Post date:** [April 10, 2018, 2:06pm UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/5 "2018-04-10T14:06:53Z")

</div>

Manualy it can be done with

> [@A quick introduction video to generating gcode directly in OnShape using Kiri:Moto](https://forums.maslowcnc.com/t/a-quick-introduction-video-to-generating-gcode-directly-in-onshape-using-kiri-moto/3201/5):
>
> In bCNC I use the up and down arrows in the editor to put cuts (called blocks) in a more logical order

---

<div class="post-metadata">

**Author:** ![ScrumdyBum](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/scrumdybum/32/4779_2.png) [@ScrumdyBum](https://forums.maslowcnc.com/u/ScrumdyBum)\
**Post date:** [April 18, 2018, 3:50pm UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/6 "2018-04-18T15:50:18Z")

</div>

> [@madgrizzle](#):
>
> If find that sometimes the gcode optimizer fails when dealing with bit changes. So, if you use multiple bits, create separate gcodes for them in order for the program I referenced in the other post to work.

How do you open both gcode files in Ground Control?  
would you copy gcode contents from one .nc file to the other?  
Or after the first .nc file is cut, open the second .nc file and just click Play. Would the Home position be the same?

---

<div class="post-metadata">

**Author:** ![madgrizzle](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/madgrizzle/32/1372_2.png) [@madgrizzle](https://forums.maslowcnc.com/u/madgrizzle)\
**Post date:** [April 18, 2018, 3:53pm UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/7 "2018-04-18T15:53:28Z")

</div>

> [@ScrumdyBum](#):
>
> Or after the first .nc file is cut, open the second .nc file and just click Play.

Yep.

> [@ScrumdyBum](#):
>
> Would the Home position be the same?

Yep.

🙂

---

<div class="post-metadata">

**Author:** ![Jayster](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jayster](https://forums.maslowcnc.com/u/Jayster)\
**Post date:** [July 23, 2018, 5:32am UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/8 "2018-07-23T05:32:18Z")

</div>

I wanted to throw this out there now that there are more users and perhaps more experience. I use a free online g-code optimizer ([http://xyzbots.com/gcode-optimizer/](http://xyzbots.com/gcode-optimizer/)) that does a fairly good job with putting each new z-axis change in closer sequential order. I am, however, frustrated with how many z-axis changes there were. My whole project was one pass/one depth that really only needed the bit raised 5 times but it literally did it 29 times. I used Makercam.

Anyone had better luck with both limiting z-axis changes and an optimized flow?

---

<div class="post-metadata">

**Author:** ![dlang](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/dlang/32/859_2.png) [@dlang](https://forums.maslowcnc.com/u/dlang)\
**Post date:** [July 23, 2018, 6:45am UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/9 "2018-07-23T06:45:34Z")

</div>

makercam is known to be especially bad with Z axis movements, try a different  
CAM package

A number of people do use that optimizer

---

<div class="post-metadata">

**Author:** ![Peter\_Farell](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/peter_farell/32/15149_2.png) [@Peter\_Farell](https://forums.maslowcnc.com/u/Peter_Farell)\
**Post date:** [August 26, 2021, 2:47pm UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/10 "2021-08-26T14:47:37Z")

</div>

Noticed that the optimized G-Code from [GCODE Optimizer](http://xyzbots.com/gcode-optimizer/)  
produces code with lowercase G commands and XYZ Plots which, if you are using WebControl, fails to produce an image on your screen. One might think that there is nothing there to cut. the g-code is there but the lowercase is not recognized. I simply opened the optimized .nc file into notepadd++ and did a find and replace for g,x,y,z and f and made them capitols and walaaaa… now when you upload the new .nc file there is an image…

---

<div class="post-metadata">

**Author:** ![Peter\_Farell](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/peter_farell/32/15149_2.png) [@Peter\_Farell](https://forums.maslowcnc.com/u/Peter_Farell)\
**Post date:** [August 26, 2021, 2:50pm UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/11 "2021-08-26T14:50:41Z")

</div>

Noticed that the optimized G-Code from [GCODE Optimizer](http://xyzbots.com/gcode-optimizer/)  
produces code with lowercase G commands and XYZ Plots which, if you are using WebControl, fails to produce an image on your screen. One might think that there is nothing there to cut. the g-code is there but the lowercase is not recognized. I simply opened the optimized .nc file into notepadd++ and did a find and replace for g,x,y,z and f and made them capitols and walaaaa… now when you upload the new .nc file there is an image…

---

<div class="post-metadata">

**Author:** ![mooselake](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/mooselake/32/6218_2.png) [@mooselake](https://forums.maslowcnc.com/u/mooselake)\
**Post date:** [August 28, 2021, 1:40pm UTC](https://forums.maslowcnc.com/t/g-code-optimizers/3246/12 "2021-08-28T13:40:15Z")

</div>

Bug worthy of reporting
