Key CNC Concept 10—Verifying CNC Programs Safely
For the most part, CNC controls will follow the instructions given in a program to the letter. With the exception of basic syntax (program formatting) mistakes, the CNC control will rarely be able to tell if a mistake has been made.
This is the tenth article in a 10 part series about the key concepts of CNC. To start at the beginning, read this article.
For the most part, CNC controls will follow the instructions given in a program to the letter. With the exception of basic syntax (program formatting) mistakes, the CNC control will rarely be able to tell if a mistake has been made. While verifying any new program, the operator must be ready for anything. If, for example, the programmer made a mistake which tells the control to drive a tool at rapid into the workpiece, the control will follow the commands causing what is commonly referred to as a crash.
With a manually prepared program, just about anything could be wrong. The manual programmer might have meant to type X but instead typed Z. In this case, the resulting motion the machine makes will be totally unexpected. Literally every command in a manually prepared program may have a mistake and should be treated as suspect.
If a computer-aided manufacturing (CAM) system was used to prepare the CNC program, the basic syntax of the program will usually be correct. The basic motion commands the control is given should also be correct. However, even CAM generated programs will not be perfect. While they tend to be more correct than manually generated programs, problems could still exist with feeds, speeds, workholding, depth of cut, and so on. Conversationally generated CNC programs should be treated with the same respect as CAM generated programs. Keep in mind that even perfect programs will behave poorly if mistakes are made during setup such as with tool length measurements or the program zero measurement.
We cannot overstress the need for safe procedures when working with CNC equipment. While we are not trying to scare the beginner, we want to instill a high level of respect for this very powerful and potentially dangerous equipment.
There are three levels of priority that you should always adhere to when working with any machine tool.
- Operator Safety. Every step should be taken to ensure the safety of the person operating the CNC machine. As we give the actual procedures to verifying CNC programs a little later, you will see that each procedure stresses operator safety. As the beginner gains experience, the tendency will be to short cut these procedures in order to save some time. But if the recommended verification procedures are not followed, the operator is opening the door to a very dangerous situation.
- Machine Tool Safety. The second level of safety priority is the CNC machining center itself. Each operator must do his best to ensure that no damage to the machine can occur. CNC machine operation time is very expensive. When a CNC machine goes down for any reason, the actual cost of repairing the machine is usually very little compared to the lost production time. There is no excuse for a crash on the CNC machine due to operator or programmer mistakes. If the verification procedures we give are followed, you'll run much less risk of placing the machine in dangerous situations.
- Workpiece Safety. The third priority to CNC machine safety is making all workpieces to size. The cost of rough stock to be machined varies dramatically based on the user's application. In some cases, for very small parts being machined from completely rough stock, the cost of the material coming to the CNC machine may be as little as ten cents per part. In this case, the company may be willing to sacrifice several workpieces in order to verify the program. However, there are also times when the cost of the rough material coming to the CNC machine is very high. Possibly the material itself is very expensive, and/or previous operations might have been performed on the workpiece prior to the CNC machine operation. The user may have several hundred dollars (or more) invested in each workpiece prior to the CNC machine operation. In this case, the company cannot afford to lose even one workpiece during the program's verification. It is never necessary to scrap the first workpiece on any CNC machine. If the verification procedures we give are followed, the workpiece will come out with excess stock after each cut. Following the given techniques will allow the operator to sneak up on all critical dimensions being machined.
Before discussing the actual techniques to verify programs, let's first examine the kinds of mistakes the programmer tends to make that will cause a program to fail. Knowing these common mistakes will help you diagnose problems as they occur.
- Syntax Mistakes. A control will not even be able to execute the command with a syntax mistake. For example, the programmer may have meant to type a G code as G01, but by mistake typed G101. Most CNC controls do not even have a G101 command. With this kind of mistake, the control will go into alarm state the moment the erroneous command is read. If the machine is moving through its motions, the motions will stop and the program will halt. The display screen generally will show a message related to the cause of the problem. Syntax mistakes are usually silly mistakes the manual programmer makes while writing or typing the program. They are easy to diagnose because it is likely that as soon as the programmer sees the command generating the alarm, the mistake will be very obvious.
- Motion Mistakes. This kind of mistake can be a little more difficult to diagnose. While motion mistakes may still be silly mistakes on the pro-grammer's part (transposing numbers or axis letter addresses for example), generally they are caused by incorrect coordinate calculations. For example, maybe the programmer misinterpreted the dimensions on a drawing and came up with incorrect coordinate values for the tool to move through. In this case, the control would follow the program's instructions without generating an alarm. But the tool path would not
be correct. Other mistakes in this category include forgetting to instate or cancel tool offsets, reversing clockwise and counter clockwise commands, and improper mode selection for incremental versus absolute. This kind of mistake can be very serious if not found prior to machining. In many cases, it means the program is telling the control to, at best, not machine properly, or at worst, crash the tool into the workpiece, workholding device, or machine.
- Set-up Mistakes. Even a perfectly written CNC program will behave poorly if mistakes are made during setup. In most cases, the operator will have some measurements to make related to the setup and numbers to enter into the control before the program can be executed. For example, almost all CNC machining centers require that program zero be measured at the machine. Once this measurement is made, either the program must be modified, or the program zero values must be entered into fixture offsets (depending on how program zero is assigned). If these numbers are incorrectly measured or if mistakes are made during their entry, the control will not truly know where the program zero point is. All motions the program commands will be incorrect. In similar manner, tool lengths and diameters (for milling cutters) must be measured and entered correctly. If mistakes are made in this regard, the control will not truly know the length or diameter (radius) of each tool.
- Mistakes Of Omission. Most beginning manual programmers have the tendency to leave things out of the program. They forget to program a decimal point or they forget to turn on the coolant. They forget to program the feed rate. And so on. Knowing that you are prone to these mistakes of omission should help as you begin verifying programs.
Procedures For Program Verification
Now that you have an idea of the kinds of things to watch out for, let's discuss the actual procedures to verify programs. One technique you will want to get in the habit of using has to do with the feed hold button. Every time you press the cycle start button to activate the program, always have a finger resting on the feed hold button. If an unexpected rapid motion takes place, you will not have to go looking for the feed hold button. Your finger will be ready to press it. No matter what you are doing, until you have the program verified, use this technique. We guarantee it will save a crash some day!
The machine lock dry run
All CNC machines that have a conditional switch labeled machine lock allow this procedure. It allows the control to scan the program for syntax mistakes. Once the setup is made and all information related to the program is entered into the control (tool offsets, program zero, etc.), the operator will turn on the machine lock and dry run switches and will also turn up the dry run motion switch (usually feed rate override or jog feed rate) to its highest position to allow the control to move quickly through the program.
When the cycle is activated, the control will quickly scan the program for syntax mistakes. During the program's execution, the spindle will come on, the turret will index, and the control will appear to be actually running the program. However, the axes (X, Y, and Z) will not move.
This procedure allows the operator a relaxed way of ensuring the control can execute the program. Once the operator has confirmed that no axis motion is occurring (machine lock is truly on), they can rest easy until one of two things happens. Either the control will generate an alarm or it will complete the program without generating an alarm.
If the control finds a syntax mistake in the program and generates an alarm, the operator must diagnose the alarm, fix the problem and execute the program again. This must be repeated (with machine lock on) until the entire program can be executed without generating alarms.
When the control completes the execution of the entire program without generating an alarm, the operator will know that the control can accept the program. While there still may be serious motion mistakes within the program, at least the program can be executed from beginning to end without generating an alarm.
If a CAM system is used to prepare the CNC program, this procedure should not be required since there should be no syntax mistakes in the CNC program.
Free Flowing Dry Run
Once the machine lock dry run procedure has been successfully completed, the operator is ready to allow the program to cause axis motion. However, there could still be very serious mistakes in the program. In fact, the main reason for doing a free flowing dry run is to check for motion problems. The operator must be very careful indeed. At this time, the workholding setup has been made, but no workpiece is in position.
To execute this procedure, the operator will turn off the machine lock switch, turn down the dry run motion rate switch (typically jog feed rate) to its lowest position, and set the rapid override switch to its slowest motion rate. When the cycle is activated, the operator must have a finger ready to press the feed hold button.
With the jog feed rate switch set to its lowest position, the axes will barely creep along. As the operator increases the setting on this switch, the axes will move faster. The operator will increase the motion rate to a comfortable setting.
As each tool comes close to the workpiece or workholding device, the dry run motion rate can be turned down. If the operator is worried and wants to check something, the feed hold button can be pressed to temporarily stop the cycle. After pausing, pressing the cycle start button gets the machine moving again. If the operator wishes to cancel the cycle due to a motion mistake in the program, after pressing feed hold, the reset key can be pressed, the machine can be sent back to its reference point, and the problem can be corrected.
Aside from severe problems, the operator must also check for less serious problems. For example, the operator must check that the spindle is rotating in the correct direction for each tool and that basic motions the program generates appear to be correct.
In many cases, the operator will not be quite sure the program is correct
after doing only one free flowing dry run. The first time the program is executed in this way, the operator may be so concerned with serious mistakes that could cause damage to the machine, they pay little attention to the details of each movement. For this reason, many times the free flowing dry run must be repeated several times until the operator is satisfied that the motions are correct.
It is possible that the free flowing dry run will cause the machine to go into alarm state even though a machine lock dry run has been completed. Axis overtravels and problems related to offsets and other forms of compensation are among the things that can generate alarms in such a case.
Normal Air Cutting Cycle Execution
Before actually trying to run the first workpiece, there is one more important procedure to follow. The operator must execute the cycle one more time with the dry run switch turned off (and no part in position). This will allow the operator to see one thing that could not be seen during a free flowing dry run. The free flowing dry run allowed the operator to take control of all motion rates with the dry run motion rate switch. This means when dry run is turned on, the operator will not be able to tell the difference between rapid motions and cutting motions. They all appear the same.
Here is an example of a problem the normal air cutting cycle will allow the operator to correct. Suppose the programmer rapids a drill up to the workpiece to drill a hole. But in the command to drill the hole, the programmer leaves out the G01 word by mistake. Since the machine is currently in the rapid mode, the hole would be drilled at rapid, breaking the drill and possibly injuring the operator. For this reason, we recommend running the program one more time as if a part were being machined, but without a part in position. This way the operator can confirm that the machine is rapiding where it is supposed to and machining where it is supposed to.
For extremely long cycles, the operator can toggle the dry run switch on and off. Once the operator is sure the current command is a cutting command, he can temporarily turn on the dry run switch to allow the balance of the command to be completed quickly. Then, dry run can be turned off again. Repeating this technique allows the operator to go through a lengthy program quickly, yet assure the cutting commands are where they are supposed to be.
Running the first workpiece
At long last, the operator is finally ready to run the first workpiece. Yet each tool in the program includes at least one movement that poses a potentially dangerous situation. Most programmers rapid each tool within 0.100 inch of the workpiece surface before machining. This very small distance is impossible to check during the previous verification procedures. For this reason, the operator must be very careful with each tool's first approach to the workpiece. Also, if the tool rapids several times to different surfaces, the operator must be cautious with these motions as well.
For this reason, we recommend turning on dry run and single block during each tool's approach to the workpiece and during rapid motions to new machining surfaces. With dry run and single block on, the operator will have control of the motion rate during each tool's approach. As the tool gets close to the surface to be machined, the rate can be turned down to a very slow rate. And, since single block is on, the operator can rest assured the motion will stop at the end of the command. When the motion stops, the operator can check the clearance approach amount (usually 0.100 inch). If everything appears to be correct, the operator can turn off the dry run switch (never machine with dry run on!) and leave single block on. At the end of each command, the motion will stop and the operator will press the cycle start button to continue to the next command. When the coming command is a rapid move to another clearance position, the operator can turn on dry run to take control of the motion rate again. This procedure is repeated for every tool in the program.
On most controls, there is a position display that will help during each tool's first approach movement. It is commonly called the distance to go page. This page will show how much further a motion is going to be. For example, say the tool is currently approaching the workpiece. Motion is slowed by dry run and the operator has single block turned on to ensure that the machine will stop before cutting. As the tool comes within about 0.500 inch or so, the operator gets worried. He or she is concerned that the tool may not stop before it hits the workpiece, so feed hold is pressed to stop motion. At this point, the operator can check the distance to go. This distance can be compared to the tool's actual position relative to the workpiece.
Making good parts
The above discussions had operator safety as the primary concern. Yet the operator must also make good parts. While machining the very first workpiece, there are things the operator can do to ensure the first workpiece will come out to size.
If the operator considers what each tool is going to be doing during its machining operation, the tool offsets can be adjusted in a way that forces the tool to leave excess stock on the surface being machined. After machining with the trial offset, the machined surface can be measured and the operator will know exactly how much stock is yet to be machined. The offset can be adjusted accordingly, and the tool can be rerun. This time the tool will machine precisely to size. This sequence can be repeated for each tool in the program to assure that the first part will come out to print dimensions.
Here's the procedure again in list form:
- Consider what the tool will be machining
- Adjust the tool offsets for the tool in the direction of leaving excess stock
- Allow the tool to completely machine the workpiece
- Measure what the tool has done
- Adjust the offsets to machine to size
- Rerun the tool
- Measure to confirm that the new offset values are correct.
Running Production And Optimizing
Once the first part has been successfully completed, the operator is ready to run the production quantity of work-pieces. It may be wise to keep the machine from rapiding for the first few workpieces with rapid override until the operator is comfortable with the cycle.
If many workpieces must be run, it is worthwhile to monitor the first few parts being run. Many times the operator will find areas of the program that can be improved to minimize cycle time. Also, cutting conditions (feeds and speeds) can be adjusted to improve cycle time or lengthen tool life. However, if major changes are made in the program during optimizing, we recommend verifying the program again.
While the verification procedures we have given may seem like a great deal of work, we urge the beginner to use them. While it does take time it can easily be justified when compared to the possible consequences. Without verification procedures, CNC machining centers are very dangerous to operate. Even if no operator injury occurs during a crash, the time and expense during machine repair easily justifies being cautious while new programs are checked out.
It is common that a beginning operator is very cautious with the unfamiliar CNC machine. But after gaining experience, the operator becomes a little over confident. Then the operator starts short cutting the verification procedures. This is where problems begin. We liken this to a person learning how to snow ski. At first, the beginning skier is very concerned about hurting himself. No tricks or hot dogging are attempted. But after gaining confidence, the skier may attempt to do more than they are capable of. This is how legs get broken. The same can be said for the beginning CNC operator. As you gain confidence, you may be tempted to forego a procedure you would have done as a beginner. Watch out!
This is the tenth article in a 10 part series about the key concepts of CNC. To start at the beginning, read this article.
This concept introduces the three basic modes of operation, presents examples of when they are used, explores more about the mode switch, and categorizes each position of the mode switch into one of the three basic modes.
This concept examines the sequences of operation of a CNC machine by way of reference material related to key operational procedures.
It is common to machine several identical workpiece attributes from within a single program. Consider the four identical circular counter-bored holes that must be milled in the workpiece shown in Figure 1.