Simulate gcode before you cut

This is about how to verify your code, and more before it hits your machine.

I’m a hobby CNC machinist, that works with wood. As I learned more about CNC machining, I found myself using a g code simulator to save time. I would spend the time to setup the job and use the correct x,y & z origin (top of material, and lower left corner. I would try to set safe retract heights and protect me, my work piece and my CNC machine from damage of going in a direction that I didn’t expect or even want.

I didn’t trust the g code, or the program that was generating it. I was using carbide motion and I would have thought that it would tell you if you are doing it wrong. Well, I learned quickly that this was not correct at all.

So now I developed a strategy to name my gcode files. Use a meaningful name(project name) and then the pass number, and the tool type and name. An example of this is eagle plaque – pass 1 – .25 EM.gcode. A 2nd tool pass may be eagle plaque – pass 2 – .5 60 vbit.gcode. Now I can tell the tools that I created toolpaths for and the correct order for the job. I save these into dropbox and read those files on a different computer in my shop.

Now even with this wonderful strategy, I get to the shop, install the -0.25″ endmill for my first pass, zero in all 3 axis, and hit start. I can hardly wait to see this in action, this is going to be great. Wait, the machine is moving in the wrong direction, wait. Oh, and I forgot to install that E-stop. Oh no, crash. drove the machine into a clamp, maybe broke a bit. It didn’t go the right direction. Or in another scenario, I cut the job, it is making great passes, and we are down to making the profile cut last to cut this out. 6 passes, to cut through. About 4 passes down, i’m not seeing chips coming out, it is MDF dust (powder). Oh no, cutting up spoil board again. Not sure how this happened, but now deep groves (1/4 inch) in my spoil board). Oh yea, forgot to reset the depth of the wood in Vectric Aspire. had planned on .75 inch, but switched to .5 inch. Well, at least the cut worked, but….

What is a GCode Simulator & How to Use One

A GCode Simulator is software(either installed on machine, or loaded into web browser. I use a web browser based called https://ncviewer.com/

This allows me to visually see what the backplot. Does it look like what I wanted it to. By double clicking on the lines in top view on ncviewer.com, I can expand the digital readout and verify the outside coordinates of the file. I then click end view and do the same for depth. Does it show the depth up from the bottom (zero on wasteboard) or down from the top (zero on the top of the wood). By opening up each file seperately, I can verify that the file for the .25 endmill is the correct file.

ncviewer.com example of vcarved stars, showing max depth as .1713″ deep
Ncviewer.com example of zero at top of work, with start of cut 1″ up and 1″ to the right.

This lets me verify the file to run vs the name on the file for the tool. If i’m running from vectric aspire or vcarve, I’ll save the Job setup sheet and print it off. This will have a material size, home / start position, clearance, and each toolpath, with tools and runtime.

sample of Vectric job setup sheet.

Am I ready to cut? Not yet.

I make a sample gcode toolpath of the outside of my work, and run it on my machine as an aircut. What is an aircut. Zero the bit above your worksurface, with the correct x and y zero, but with the bit zeroed about 1 inch high above top of workpiece. Then run the sample file and i can see the part work, no issues with machine. On the shapeoko, it has soft limits that it will not warn about, but when it gets there it stops running and you really have no idea why. This will allow you to find this before the bit ever contacts the wood.

Now zero you z axis( i use paper method, very fast and repeatable to zero bit accurately, and run job.

Clamping and holding work down

Time for clamping wood to the spoilboard. I’ve started using a method that someone has shown me that really works. If i’m doing a cutout on the project, I might use carpet tape to hold the inside piece down, and use drywall screws to hold the complete work piece down. To do this accurately, i’ll draw 1/8″ circles more than bit width distance from items being machined. The i’ll place the board to be cut on the wasteboard, as close and accurate as possible but not clamp it. ‘Then run the program as a vcarve, on the circles, and install drywall screws where the holes are. now no chance in hitting hold downs or screws, easy to deal with and quick.

small red holes show where screws are attached for hold down.

Hope this helps develop good processes when you work. I’ve done this as well as when building furniture, to run a sample cut on machine on scrap and test fit. Much easier before you complete the whole job and find they won’t fit together.