Command line utility to 'clean' GCode

I’m 99% sure that it creates a new file, but the first time you run it, save a
copy just in case I’m wrong.

David Lang

I’m calling it from webcontrol menu and I don’t want to overwrite the original uploaded file.

run it manually on a test file. I’m pretty sure that you have to tell it the
name of the output file (or it creates it from the input file)

it just does not make sense to try to overwrite the file that you are reading,
that is just inherently unreliable. But it does happen, which is why I’m only
99% sure :slight_smile:

David Lang

It automatically produces a new file.

I.e. will become

Both files will be available in the folder.

Which I can absolutely concur with.

GCodeClean takes the input filename and inserts a -gcc before the end. And if you feed that file back through it (although you shouldn’t because it is a one pass cleaner) then it will insert -gcc again.

1 Like

It works as stated except it is -gcc when I run it…

yep true - I simply copied TimS’ typo - it is -gcc for GCodeClean

And lo - a new GCodeClean has been released: v0.9.6 - Release FileNotFoundException & Tweak Tolerances · md8n/GCodeClean

FileNotFoundException is now returned as Exit code 2 (Exit code 0 means success).

The default or user supplied tolerances are now tweaked into more limited ranges of ‘sensibleness’ based on the units in use in the GCode (mm / inch)

And a little update to the README


I’ve added a linux-arm build to the releases - v0.9.6 - now including linux-arm

This should work out ofthe box on a Raspberry Pi (32 bit) - if someone wants to test it

1 Like

GCodeClean hits v1.0.0 :tada: - Software - Maslow CNC Forums

1 Like
1 Like

GCodeClean hits v1.0.3 :sparkles: - Software - Maslow CNC Forums

1 Like

For random intermixing of metric and imperial I’d just set a flag/store a conversion factor, either 25.4 or the reciprocal . Stay with the original units, convert the aberrant ones. If the hand gcoders care they can use another utility, and with a bizarre CAM program that flops around anybody that complains can do the same. I suspect you’ll only see it in testing but there are strange people out there…

I’ve been using a non-Maslow rotary axis router lately, a Bob’s Revolution, that uses XZA axes, haven’t tried GCodeClean with it but I’m guessing you don’t support rotary axes. Could be fun, in a hair pulling out kind of way. It was just converted to FluidNC and an ESP32 controller and other than some home switch issues (of course, they’re abominations, and one is sticky), and UGS’s visualizer dying on nearly 150K lines of gcode files it’s been working pretty well.

I’ve literally just been thinking about the issues of a rotary axis. I haven’t started exploring anything yet though

I’m having fun with the Revo. My eventual goal is to do ornamental turning, but I’ve been planning on that for around 10 years or so and never gotten to it. VCarve will do OK rotary wrapping, haven’t tried Scorch’s gcodewrapper yet, and UGS (at least with grbl)'s visualizer displays it properly but can’t jog or zero the A without writing macros.

I can send you some large test files if/when you need them. I don’t even want to think about how arcs would work on it. It also seems that you have to keep track of cutting speeds yourself since A is in degrees per minute and not units as the bit spins. Not sure if VCarve actually does that, but so far it hasn’t proven a problem.

My plan, in the first case is to ‘fail’ the run. I am going to assume that this would be something rare. And then later if someone squeaks enough about it I’ll convert everything to a single unit (whatever they started with)

1 Like
1 Like