Lines and Arcs

When I started reading up on G-Code I noticed that, as well as straight lines, it could also define arcs and circles. I also noticed that the G-Code produced by Easel only contained short line segment, and no arcs at all.

My assumption was that this was an arbitrary limitation of Easel, and I wondered if there was any way to fix this.

I found a very clever python script called g1tog23.py written by Frank, which takes a G-Code file containing line segments, and where appropriate converts lots of contiguous line segments into an arc or circle. I tried this on a test design of five interlinked circles. It seemed to work, so I then tried sending it to the X-Carve.

The first problem was that the python script had inserted lots of A0.0000 commands. I couldn’t find this command on my g-code cheat sheet, so I have no idea what it’s supposed to do. Neither did the g-code interpreter on the X-Carve, which rejected it as an ‘Unknown Command’. So I simply stripped them out.

The next problem was that instead of drawing arcs, the X-Carve was drawing straight lines from the start and end position of the arcs. This was unhelpful.

Reading up some more on g-code, I learned about G64. This command is used to specify how accuratly arcs should be drawn. Without it, when you ask the interpreter to draw an arc, it draws a straight line and says “that’s close enough”. G64 is used to say “That’s not good enough, I want no more than n units of deviation from the arc”.

The interpreter does not support the G64 command.

But it does support G61! G61 means “No compromises! I want my arcs as accurataly as possible”. So once I manually issued that command before running the g-code, I got beautiful arcs and circles.

I discovered later that it’s actually quite common for G64 not to be supported, especially on single board computers, because the calculations involved are to intensive. It’s more common for the g-code generator itself to do the calculations to convert from arcs to line segments. That is clearly the reason why Easel is producing the g-code that it is.

It was disappointing that the result took just as long as carving without arcs. Disappointing, but obvious in hindsight. The bottleneck isn’t sending commands, or interpreting them, but doing the physical carving.

But using this script does mean that the size of the g-code file is drastically reduced, typically by about half. It could be worth using just for that reason.

And at least I’ve learned a lot more about g-code.