Testing Offsets For Correctness
Custom macro B (a popular version of parametric programming) gives you the ability to access tool offset values from within your program (with system variables in the #2000 series). It also gives you the ability to make tests (with the IF statement) as well as to generate alarms based upon finding problems.
Custom macro B (a popular version of parametric programming) gives you the ability to access tool offset values from within your program (with system variables in the #2000 series). It also gives you the ability to make tests (with the IF statement) as well as to generate alarms based upon finding problems.
With these abilities, you can determine whether offset values fall within an acceptable range. You can determine, for example, the range of machining center tool lengths for a given program. In one program, your shortest tool might be just over three inches long (a face mill) and your longest tool may be just under twelve inches long. In this case, you know that if a tool length compensation offset value is under three inches or over twelve inches, something is drastically wrong. Possibly the operator missed a decimal point during offset entry (typing 0.35 instead of 3.5, for example).
Testing one offset is relatively easy. Consider the following commands to test offset number one based upon the given scenario:
O0001
N1 IF [#2001 GT 3.0] GOTO 3
N2 #3000 = 100 (TOOL TOO SHORT)
N3 IF [#2001 LT 12.0] GOTO 5
N4 #3000 =101 (TOOL TOO LONG)
N5 ...
Admittedly, these are not fail-safe tests. A tool's offset value could fall in this range and still be incorrectly entered. But we can at least confirm that offset number one's value falls within allowable limits.
Testing several tools in this manner could get rather cumbersome, especially if these commands are specified right in your main program. Every program would require these tedious testing commands. Additionally, repeating these tests every time you run a cycle would be time consuming. It could take three to five seconds to test twenty tools in this fashion. That may not sound like a lot, but when you add it to every cycle of a 1000-piece run, the additional time consumed is substantial. And testing in this manner for a great number of tools would require many redundant commands.
These three problems can be solved with the help of a special utility custom macro. The only limitation of this macro (which could be overcome with a little more effort) is that tools must be in numerical sequence. For example, all tools—one through forty-seven—could easily be tested. But this particular custom macro will not work in a job that uses tools one through fifteen and nineteen through forty-seven.
The offset testing custom macro will be evoked right at the beginning of your main program (the very first command). Here is an example.
O0001 (Main program)
N005 G65 P8001 A1.0 B47.0 S3.0 T12.0
In our example, A is the first tool offset number to be tested, B is the last tool offset number to be tested (this program uses tools one through forty-seven), S is the shortest tool length, and T is the longest tool length.
As stated, you won't want the offset tests to be made every time the program is run. Doing so would waste precious cycle time. The only times you'll need the offset tests will be for the very first cycle that's run (during verification) and if any of the tool offset values are changed during the production run after dull tools are replaced. To achieve this, we'll use a kind of "check sum" test to determine if offset values need to be tested. Shown in the box is the offset testing custom macro along with documentation explaining each line.
O8001 (Offset testing custom macro utility program)
N1 #100 = #1 (Set offset counter to first tool)
N2 #500 = 0 (Initialize offset value total to zero)
N3 IF [#100 GT #2] GOTO 7 (Test if finished totaling offsets)
N4 #500 = #500 + #[2000 + #100] (Add current offset value to #500)
N5 #100 = #100 + 1 (Step offset counter)
N6 GOTO 3 (Go back to test if finished)
N7 IF [#501 EQ #500] GOTO 17
N8 #501 = #500 (Store #500 in #501)
N9 #100 = #1 (Set offset counter back to first offset)
N10 IF [#100 GT #2] GOTO 17 (Test if finished)
N11 IF [ #[2000 + #100] GT #19] GOTO 3 (Test current offset)
N12 #3000 = 100 (TOOL TOO SHORT)
N13 IF [ #[2000 + #100] LT #20] GOTO 5 (Test current offset)
N14 #3000 =101 (TOOL TOO LONG)
N15 #100 = #100 +1 (Step offset counter)
N16 GOTO 10 (Go back to test if finished)
N17 M99 (End of custom macro)
Read Next
The Automation Event for CNC Machine Shops
Get sensible, real-world automation solutions during this half-day workshop co-located with IMTS 2024.
Read MoreIMTS Elevate Workshop: Make Your Shop a Top Shop
This ½-day program offers attendees insight into the results from this year's Modern Machine Shop Top Shops annual benchmarking survey.
Read MoreIncreasing Productivity with Digitalization and AI
Job shops are implementing automation and digitalization into workflows to eliminate set up time and increase repeatability in production.
Read More