New tool GCodeShim...it does what it sounds like....enjoy!

Browse around for inspiration, or share your work to inspire others!

Moderators: al wolford, sbk, Bob, Kayvon

Post Reply
Rando
Posts: 757
Joined: Tue Jan 06, 2015 3:24 pm
Location: Boise, ID
Contact:

New tool GCodeShim...it does what it sounds like....enjoy!

Post by Rando »

Everyone:

You know I luv ya all, right? I feel yer pain. I've broken those bits, I've ruined those parts, I've seen stuff...and things. I don't recommend it!

What's he on about, now?

In my work, I've found that sometimes I just need to "shim" a toolpath a tiny amount because the material's thicker, or not entirely flat. So I wrote a tool. A rather smallish tool, but one that can help with the occasional need to shim, but maybe more usefully, to check the EXTENT of the cutting.

On more than a few threads, people report the machine cutting where they didn't think it should...like into the bed :( . In at least one instance, that was because the extents of the cutting in GCode effectively went "outside of the work envelope" of the machine. As in, it drilled through the BED! Surely there must be some sanity check we can do that tells us "whoa...you're gonna plunge HOW far?"

Although I use this tool primarily for shimming toolpaths, it also reports the extents...on all axes (yeah, even S (spindle speed), and P (dwell time)). Give the -HelpAxes, or -ha option a try to find out how it treats them. So, if you run this tool on your tap file (Windows command line), it will at least output a table of those extents.

Installing GCodeShim

To install it, just extract the files in the ZIP archive below into whatever folder you keep your tap files in. As long as you have .NET installed, that should be all there is to it.
GCodeShimJan2017Rando.zip
Zip file with program and help text and examples transcript
(19.4 KiB) Downloaded 357 times
Notes about GCodeShim

* Runs on Windows, I've at least run it on 7,8 and 10. It should run normally on any system with .NET, though it might whine about needing an updated version of that.

* To get command line help use the -help or -h option. Or just give it garbage on the command line, and it'll print that help out too. The zip file and this post both have a copy of the -help transcript:
GCodeShimHelp.txt
Transcript of -help
(7.91 KiB) Downloaded 361 times
* Sometimes I'm neglectful of including exception handling (a programming thing), sorry. That means that if you give it a file name it can't find, or it's the wrong format, it very likely will throw up a whole raft of incomprehensible gobbledygook that says Thom should have added error-handling ;-). My only advice is to make sure the files are there and they're the right kind.

* I haven't tested the incoming OR outgoing GCode on any machine other than my CNCShark, but I have examined it pretty thoroughly in a GCode backplotter, and I've run shimmed toolpaths dozens of times now.

* The program file itself "wants" to be in the same folder as your tap files, so that's where you should unzip the program.

* When you're using the program, remember "--". Put that between your offset/ceiling/floor values and the first file name, if there's no other command-line option (starting with '-') between them. So, GCodeShim.exe -offset X+1 MyFile.tap won't work, but GCodeShim.exe -offset X+1 -- MyFile.tap will work.

* Mind your units! It just does add and subtract, so if you add 0.005 to a millimeter design, you're NOT going to get an offset of 0.005 inches.

* if you don't supply an output file name, the input files are renamed orig--.... If you run GCodeShim on that toolpath more than once, the second run will copy the modified output from the first run over the true original tap file. So, avoid running sequentially on a file if at all possible, and if you just have to, make sure you keep a copy of the original CAM-output TAP file.

Well yeah, but how do I use this magical beast?

* To run it, start a command-shell (Windows key, then type "cmd.exe" and it should find it), then CD to the drive and folder where you're storing those tap files. Then it's just using it like below:

This command provides a report of the axes and their extents in a GCode file, but doesn't change the content. It DOES, however, move the MyCoolProject.tap to orig--MyCoolProject.tap, and then outputs the file that has no changes. Thus, the output file isn't the literal same file, but it should be effectively identical save for a few comments at the top indicating that GCodeShim processed it. In this situation, feel free to run either file.

C:\Users\Me\MyVectricDesign>GCodeShim.exe MyCoolProject.tap

The following moves the GCode UP 0.5 (of whatever units are used in the file) in Z. You might say this is a cutting-air shimming, but it requires no changes to the CNC setup/zeros, and no changes needed to your Vectric design. To use the offset file, use the MyCoolProject.tap file, and if you want the original one, run the file named orig--...

C:\Users\Me\MyVectricDesign>GCodeShim.exe -outputName MyCoolProjectMoved.tap -offset Z+0.5 -- MyCoolProject.tap

This example moves all the tap files right by 0.010 in X, and 0.010 negative in Y. The original input files are RENAMED to orig--..., so you can get them back without problems.

C:\Users\Me\MyVectricDesign>GCodeShim.exe -offset X+0.010 Y+0.010 -- MyCoolProject*.tap

Yes, wildcards for file names are allowed. I haven't tested just how GOOD they work, and I suspect it will merrily mangle a non-GCode if you tell it to. But, you can do some cool stuff. Let's say you have a set of randomly-named GCode files like ASDF.tap, QER.tap, LOJH.tap, and the like. And you want QER run first, and ASDF run second, LOJH third. So, you'd use a command like this:

C:\Users\Me\MyVectricDesign>GCodeShim.exe -Name MyProject -Prefix Step -offset X+0.010 Y+0.010 ASDF.tap QER.tap LOJH.tap

Will produce six files named:

Step01--MyProject.tap
Step02--MyProject.tap
Step03--MyProject.tap
orig--ASDF.tap
orig--QER.tap
orig--LOJH.tap

When I make my production build scripts (do you do that?) to convert the individual toolpath files into a cohesive set of operations, it starts with five "machine setups" as BobCAD calls them, and 16 engraving blocks, output into seven "job" files, of about 1.5MB total. Why so many? Because I use the shim program to align the engraving chunks to the exact profile of the material, as opposed to the deformed-but-not-quite-exact solid model that I map the engraving paths onto. Those total of 36 toolpath individual toolpath files, and 4 power-control files (see my other post on the power controller, in the show-off area...link later) get shimmed as needed by this program, while the 7 "job" files get split out into the individual steps, and then reorganized and joined back into 8 "combination" files. What that means is that instead of hand-loading 18 toolpaths for each of the two part types, I load 4. Yup, 4 steps. I load material, run step one, leave for an hour. I rotate the part, run the second step, and repeat that for the four steps. VERY easy. But, sorry, you can't have the splatter-gather GCodeSG yet. It's a beast, does a lot of stuff, and not things I suspect any of you do. Do you?

Do any others do significant manipulation of the GCode between when it comes out of the CAM program(s) and you run it (pendant or console)?

Floor-to-Ceiling Offset what?

For you advanced types out there, GCodeShim can perform three operations on any numerical axis in a GCode file:

1) Offset plus or minus the indicated value to every reference to that axis in the file.
2) Floor the values of an axis to a specific value. Essentially, it moves all the values "down" (in the negative axis direction) so that the lowest point is at the specified value.
2) Ceiling the values of an axis to a specific value. Essentially, it moves all the values "up" (in the positive axis direction) so that the hightest point is at the specified value.

Floor and Ceiling can each be combined with Offset on an axis, but you can't have both Floor and Ceiling on an axis.

What on earth are those for? Let's say you wanted to carve something in a board, and you set the zero-location as the bottom of the board, because you want to not change the X0Y0Z0 (I avoid moving origins unless absolutely necessary), but you DO want to adjust the toolpath to different thickness boards, say 0.510", 0.425", 0.60", and so, you just measure the board thicknesses, run a set of GCodeShim operations to Ceiling the Z for the different board heights. The offset value, however, is NOT the board thickness. The offset would be:

Ceiling value = designThickness + (actualThickness-designThickness)

Similarly, a floor value would be:

Floor value = designBottomHeight + (actualThickness-designThickness)

Yeah, they're obscure uses, and I haven't had a time where it couldn't just as easily be done with an offset of actual-design, but it's needed when you want to do BOTH Floor/Ceiling and Offset in the same command.

Support, etc.

I'll provide nominal support, just drop me a line at thom at Tango Charlie Tango Randolph.com (tee cee tee randolph dot com). But let's face it: no warranty of any kind; I'm sure it has bugs. If people want me to, I'm happy to update the zip file, adding the source code; it's C# written in Visual Studio. I just figured very few here would want to dig in that deep.

Regards, and hope this proves useful. Well, and I hope the system doesn't boot the zip file! Oh right...the zip file:

Thom
Attachments
GCodeShimExampleTranscripts.txt
Transcripts from actual build commands I use.
(19.33 KiB) Downloaded 345 times
=====================================================
ThomR.com Creative tools and photographic art
A proud member of the Pacific Northwest CNC Club (now on Facebook)

Post Reply