Posted on 1 Comment

Hand Editing G-code for Better Machining

One of the issues I’m having with with my cutting the pentaflake pattern for my Backyard Tabletop project is that the router bit stops in one of the corners of each pentagon shape before moving up. This causes the bit to rub against the side of the cut as it raises, burning the wood, heating and dulling the bit. The problem gets worse as the job progresses, as you can see in this picture:

Side view of the pentaflake pattern showing burn marks getting worse across the piece.
Side view of the pentaflake pattern showing burn marks getting worse across the piece.

What I found out on the Maslow forums is that this is a common machining problem for which there is a common machining solution: something called ‘lead-out’, where the bit moves away from the edge of the cut before performing the z-axis move. Unfortunately, the software I’m using, Easel, does not support that function. The other common software used in the Maslow community, MakerCAM MakerCAM, doesn’t even seem to be working, it’s an online tool (as is Easel) and I can’t connect to the site. I looked at some videos on how to use Fusion360, which I have some experience with for 3D printing, but it seemed quite complicated in comparison to Easel or MakerCAM.

I decided to try Fusion360 anyway, first bringing in the .svg file I made in Inkscape, but that bogged down my computer, and brought out the pinwheel of death. I then tried generating the pattern in Fusion, but after the pattern got over 30 elements or so, it bogged down my computer again. Don’t know if it’s Fusion or my computer (an older MacBook Pro), but I gave up on it at that point.

I’ve modified g-code files before for 3D printing. G-code is human readable, and actually pretty easy to understand. I knew that the best way to modify the file would be to use regex, though I hadn’t used regular expressions in a while. Fortunately, there are a lot of online resources for learning regex, and the RegexOne interactive tutorial got me up and running pretty quickly.

I brought the .nc file into the Atom editor,, and wrote a regex to find the entry point for each pentagon shape in the g-code. I added a g-code command to move to that point before each z-axis up move, essentially creating a lead-out.

Editing G-code in Atom using regex.
Editing G-code in Atom using regex.

I loaded the .nc file into Ground Control (the software for controlling the Maslow), and it looks good, but I won’t know for sure until I run it. I reattached the bushing (see previous post) using 2 part epoxy, and I’m waiting for it to cure overnight before testing again.

1 thought on “Hand Editing G-code for Better Machining

  1. […] modified the g-code (see Hand Editing G-Code for Better Machining), and I added a bungee over the top of the router to keep constant sideways pressure on […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.