Command line utility to 'clean' GCode

Hi Emile,

Here’s the latest versions of both of hook and hook 2 after the latest rounds of bug fixes and enhancements to the command line utility.

Not much drop in file sizes, although cutting performance on some of the curves may be better on the first one.

hook-gcc.nc (77.4 KB) hook 2-gcc.nc (9.4 KB)

Hi Jason,

I think of got the basics of line segments to arc conversion done now. Have a close up look at this one:
MothersDay-gcc.nc (134.0 KB)

Of course the code is up on GitHub already.

1 Like

Have you considered letting the estlcam developer know of the problem? I’ve contacted Christian a couple times with problems (in my case having to do with scanned/vector converted old chip carving designs, not the best files, manual selections had issues) and not gotten a response, but perhaps you’ll have better luck.

Has anyone tried loading this application in Visual Studio Community 2019 and doing a build?

he popped up here once for a short time, but the answers to most of our
questions was that he didn’t have an option to support them. Haven’t heard from
him for a while, hope he’s ok.

David Lang

I’ve reached out to him repeatedly via the contact email (because I’d like to pay for a license fee, but I can’t use Paypal) and I’ve had no reply.

But the reality is I really want a ‘free-standing’ GCode Linter/Parser.

I’ve got VS Enterprise, but I’m deliberately doing this via the dotnet cli and VS Code, just to ensure it’s maximum ‘accessibility’.

1 Like

I understand completely. The reason I asked was because I downloaded your .zip file and did everything exactly like it said. When I ran it, all my output g-code files were empty. So I loaded it into VS 2019 and did a build. When I ran that, all my output g-code files were empty. I am stumped. Any help is appreciated.

Last estlcam release was April 19th, just under a month ago.

Yes! The last file looks pretty great. I do see some minor things up close, but they don’t bother me. It looks to have rounded off the bottom of the inside heart, where in my original file the bottom was a sharp point. The little points that stick out from the outside cutout should have perfectly vertical and perfectly horizontal lines, two of them are slightly angled in the cleaned file. This could be from my original but the way it was designed they should have been at 90 degrees to each other. Again, this doesn’t bother me but it is there.

Another oddity, I can’t import this back into Easel because it doesn’t support the G3 command, it errors out on line 14 I think. I don’t really need that functionality, but it does a good job of estimating the cut time so I like to dump them back in nd see how it affects the total cut time.

Long story short, I can used the cleaned file so it is a win. :slight_smile:

Thanks again for your work on this.

Jason

1 Like

If you can send me a screen shot of the commands you typed I think I may be able to help.

There’s now also a self-contained Release build for Linux, Windows and OSX, you can get the relevant one from https://github.com/md8n/GCodeClean/releases/tag/v0.7.0 (open up Assets)

I’m currently only doing 64bit releases, but there’s loads of options available.

1 Like

Thanks for letting me know. I’ll get a copy, and reach out to him again.

It is, they show up as slightly off the orthogonal in both GroundControl and estlcam.

Interesting, I’ll go back and have a look at that. Although of course the line to arc conversion has to ‘guess’ at what it should and shouldn’t do, and maybe this is one of those things that requires some further ‘nuancing’

G3 is the same as G03, and likewise G2 is the same as G02 - so maybe just do a search and replace on the file and try again?

Of course if it doesn’t support G03 or G02 at all … well … um, yeah, maybe they need to do some work :wink:

I have attached my GCodeClean.zip

I got output when I copied tokenDefinitions.json to C:\Users\james\Source\Repos\GCodeClean\bin\Debug\netcoreapp3.1>

Must be a Path problem

I am not a fan of subdirectories

I started programming 6/1/1966 with wires and I remember when subdirectories were first invented.

My idea of a good time is to make one subdirectory and put everything that is needed in it.

That way the program will run until hell freezes over no matter what Microsoft does.

Sorry to be a bother.

Thanks

C:\Users\james\Source\Repos\GCodeClean\bin\Debug\netcoreapp3.1>gcodeclean jim1gcode.gc
.gc
Outputting to:jim1gcode-gcc.gc
Unhandled exception. System.IO.FileNotFoundException: Could not find file ‘C:\Users\james\Source\Repos\GCodeClean\bin\Debug\netcoreapp3.1\tokenDefinitions.json’.
File name: ‘C:\Users\james\Source\Repos\GCodeClean\bin\Debug\netcoreapp3.1\tokenDefinitions.json’

C:\Users\james\Source\Repos\GCodeClean>gcodeclean jim1gcode.gc
‘gcodeclean’ is not recognized as an internal or external command,
operable program or batch file.

C:\Users\james\Source\Repos\GCodeClean>pause
Press any key to continue . . .

GCodeClean.zip (575 KB)

Ahh - the tokenDefinitions - they must have fallen down the back of the sofa

OK, for your dotnetrun.bat file (put down the BAT JIM) - try this

dotnet run -- jim1gcode.gc
pause

Works perfectly. Cleaned the output. You are the person. Thanks

1 Like

Here’s the new release:

This includes the first actual bit of code for linting gcode.
It splits lines that include multiple commands (G, M, F, S, T) and it prioritises them according to their execution order.

1 Like

New release: https://github.com/md8n/GCodeClean/releases

This includes a couple of extra command line options:

  • --annotate - a simple flag to have annotations included. These will appear as inline comments
  • --minimise - How to minimise the gcode output.
    • soft - minimise only F and Z tokens. This is the default.
    • hard - minimise all tokens and eliminate spaces within lines (blank lines are still preserved)
    • custom - any selection of valid gcode codes (i.e. from this list ABCDFGHIJKLMNPRSTXYZ )

Another new release: https://github.com/md8n/GCodeClean/releases

This one is really a “behind the scenes” restructure. Most of the code I’ve now split off as a library, which should make it easier for someone else to reuse it in other applications. I’ve also started a test project, so I’ll add unit tests to that as I go.
I’ve also finally included some code I’ve been sitting on for over a week that shifts the way the GCode is handled internally within the library. Previously it was pretty much treated as an array of strings, now each line and each word is properly parsed into objects.

1 Like