6 days by cncdivi

Everyone dislikes when their CNC machine encounters a malfunction, and it’s impossible to fully guarantee that such an incident will never occur. These malfunctions can be damaging to the tools, the parts being constructed, the fixtures (ever seen a vise that’s been milled on top?), and the machines themselves.

They can significantly hinder your productivity. More than anything, they pose challenges for machinists. No one truly wants to experience a machine failure, though we manage it when it does happen. Even though you can’t entirely prevent these occurrences with full certainty, it doesn’t imply that you can’t utilize every available resource to aid in avoiding such mishaps.

Being careful about all aspects of setting up a job helps. Make sure all that offset information, whether it be tool offsets or work offsets, is right when you enter it into the machine.  Double check it just to be sure.

Checking your work helps too.  Every CNC machinist is familiar with the idea of “Cutting Air” with a new job to make sure nothing too crazy happens.  Many also run the job a lot more slowly, particularly as each new tool approaches the work, just to be sure all will be well.

There’s one other thing that can be done before the g-code ever lands on the machine, and that’s to run it through some simulation to be sure that what’s come out of your CAM program or what you’ve hand programmed, looks good.

Let’s talk more about that simulation angle and see how it’s done.

Geometry versus G-Code Simulation

The first thing we need to talk about are the two major types of simulation:  Geometry versus G-Code Simulation.  Most CAM programs these days will show you a neat simulation of the tool running around machining a part.  It’s very reassuring to see that happening and it makes you think you’ve done your homework when it comes to simulating the code.  

There’s just one little problem:  for most CAM software, what you’ve done is simulate the Geometry, not the G-Code.  That leaves open a lot of room for errors even though the simulation looked marvelous.

Let me explain how that works.

When your CAM program is doing its thing, it produces two outputs:

1.  G-Code is produced via the Postprocessor.

2.  Geometry is produced, often in standard file formats referred to as “APT” or “CL” data.

The simulators included with CAM take that geometry, the APT or CL Data, and use that to create the simulation.  As a matter of fact, the vast majority of CAM makers even use the very same simulator, which is made by a company called Machine Works.

APT is actually a programming language in its own right, and so is similar to g-code.  APT has been around since 1956, which is a very long time indeed!  For most CAM software, the APT is what is fed to the Postprocessor, and it is the job of the Postprocessor to convert APT to g-code.  Things are done this way to get away from the fact that there are so darned many different g-code dialects across all the many CNC controls out there.  This simplifies the CAM software’s job considerably to the point where some CAM manufacturers also use a 3rd party to create the post processor, and even more commonly to customize the post processor for specific machines.

A CL file is actually the technical term for the output of the APT.  APT stands for “Automatically Programmed Tool” and CL stands for “Cutter Location”.

Now that you know what’s really going on, what’s so bad about simulation using the APT instead of the g-code?  Well, the answer is simple–your CNC machine will be receiving g-code, not APT or a CL file.  If there is any problem whatsoever translating the geometry information into g-code, that will be missed entirely by geometry-based simulation.  What you want to do is run a simulation of what your machine will actually be executing, not some intermediate by-product.  At least that’s what you want if you care about checking the accuracy of the g-code before it gets put onto the CNC Machine and run for real.

Aside from helping to spot crashes before they happen, there are a lot of time-saving reasons to use a good g-code simulator on everything before it runs on a machine.  If you’re at all concerned with keeping your spindles turning as much as possible, you should be doing g-code simulation.  If your CADCAM system is remote from your shop floor, even just a little bit (mine is up two flights of stairs for the mill and a 15 minute drive for the lathe), you should be doing g-code simulation.  The reason is that you don’t want to wait until the g-code is on the machine to discover some alarm or other that will prevent you from running the code.  You want to be locked and loaded before that code ever hits the machine.

G-Wizard Editor’s New Soft Limits Feature

Now that we understand the difference between Geometry and G-Code Simulation, let’s delve into G-Wizard Editor’s new Soft Limit Alarm feature.

If you simulate some g-code, GW Editor captures a bunch of information about that g-code and puts it on the Info tab.  Here is the Info Tab for the Home Switch Rear Panel engraving sample file, for example:

HSRPEInfoTab

Info Tab for HomeSwitchRearPanelEngrave…

The Info Tab provides a bunch of vital statistics for your g-code program.  Number of lines, number of bytes of code, the total travel for each axis as well as the minimum and maximum values, travel at feedrates, range of Feeds and Speeds, and a whole lot else.  As you can see from the backplot on the right, this is sheet work.  I used a piece of aluminum about 3/16″ thick to make this panel.  What that means is I don’t want the cutter going too much deeper than that.  As is my usual practice, I designated part zero in the Z-axis to be the top of the workpiece.  So, anything about zero is cutting air and anything below is cutting into the material, or possibly into my machine or fixtures if I’m not careful!

Let’s take a closer look at the alarm setup, and let’s set an alarm for Z = 0.  That’s not actually what we want, but it’ll make it easier to see what’s going on with the Soft Limits.  Here is what it looks like:

SoftLimitAlarm

Soft Limit Alarms are set on the Info Tab…

I’ve enabled the Soft Limit Alarm for the Z axis with the checkbox, and I am just going to use 0.0 as the minimum and 100,000.0 as the maximum.  You could do more if you wanted to take the time, for example, set the maximum to be the limits of travel or some such on your machine.  I’m also not bothering with X and Y.  There’s nothing really to crash into there on this job.  If I was running a 4th axis job, I’d probably want to set those limits as well.

GW Editor will save this information across sessions, so the same alarms will be there the next time you load a file.  They do need to be customize for the file in most cases, although not in all cases.  For example, it isn’t too hard to imagine if you do mostly sheet work, say plywood on a CNC Router, that the same Z limits would suffice for most jobs.

Now here’s what happens if we hit a limit:

SoftLimitAlarm2

Any line that ends with the cutter having broken a soft limit gets a limit error…

Any line that ends with the cutter having broken a soft limit gets a limit error.  You can see the error on the lower right in the hint window.  By only flagging the lines where the cutter ends with a limit error, it is easier to see which lines are starting the bad behavior.  In this case, we set the limit at 0.0, so every line that is cutting some material gets an error.  In practice you’d set it for the actual limit you want to enforce.  It’s a question of how close you’re willing to let the cutter come to the sensitive parts of your machine and fixtures.  I like to use a figure of 0.1″ or 1/8″.  That’s plenty close enough and is easy to measure with a rule or tape measure.  It doesn’t take much time on a job to identify what the proper limits are.  In some cases they don’t change.  The top of my vise pretty much stays put.  I just need to figure out how far below part 0 the top of the vise is to set the limit.

Soft Limit Alarms give you another tool in your arsenal to help avoid crashes.  There are a lot of kinds of crashes, but this one can help with one of the most costly where the cutter gets plunged into the machine table.  Like I said starting out, nobody can give you a 100% guarantee against crashes, but every little bit of extra insurance helps!

If you haven’t tried G-Wizard Editor yet for your own simulation and error checking needs, check it out.  We offer a free 30-day trial.

 

Like what you read on CNCCookbook?

Join 100,000+ CNC'ers!  Get our latest blog posts delivered straight to your email inbox once a week for free. Plus, we’ll give you access to some great CNC reference materials including:

  • Our Big List of over 200 CNC Tips and Techniques
  • Our Free GCode Programming Basics Course
  • And more!

Just enter your name and email address below:

Full Name
Email *
100% Privacy: We will never Spam you!

Rate this post

Recently updated on March 10th, 2024 at 12:15 pm