But wait! There’s more!
GCodeClean dances on the walls v1.0.4
tl;dr - You probably want to get this one if you work with nasty GCode.
It was all supposed to be so simple …
As I was running through some tests (using a particularly nasty bit of GCode - thanks @cmullins70 Z-Axis Plunge of Death - #4 by cmullins70) I noticed that certain curves (from linear to arc deduplication) were scrambled, although most of them were fine.
And down the rabbit-hole I fell.
This particular nasty bit of GCode used multiple coordinate planes, so not just G17
, but G18
and G19
also. Why? Really bad CAM programming I suspect, from the looks of what it was used for.
However, while GCodeClean has the maths to support this, I never really got it working, simply assuming that there would only ever be one coordinate plane in use for a whole file.
So now that I have the preamble context in a really sweet spot, I could get each function that needed to know the coordinate plane to define an initial context, and then update that line by line (of GCode) to always have the correct coordinate plane with which to feed into the processing. Hey presto , linear to arc dedup suddenly works properly for all coordinate planes.
But that left another issue (cover your children’s ears for this one), it’s totally legal to change units in a GCode file, going from inch to mm and back again. Why anyone would want to do this is beyond me (utter perversity I’m guessing), but ‘supporting’ this abomination was ‘the right thing to do’ with regard to making the code cleaner and sticking to the NIST spec. So here it is…
Release v1.0.4 - Handle a changing context everywhere · md8n/GCodeClean (github.com)