Digital Readout Kit for Mills, Lathes, & Grinding
Published

When to Use Custom Macros With a CAM System

Custom macros can offer benefits even when using a CAM system to prepare programs – but must be implemented with the right considerations.

Share

Custom macros can improve safety and quality when used correctly within CAM systems. Photo: Getty

There are some applications in which computer aided manufacturing (CAM) systems and the use of custom macros truly conflict. With part families, for example, the application should be handled using one method or the other, but not both. Additionally, with certain canned cycle applications, like thread milling or bolt circle patterns, a CAM system can easily generate the required G-code commands, often making the use of canned cycle custom macros seem inappropriate.

Too many people in manufacturing conclude from this that, when using a CAM system to prepare programs, there is no reason to use a custom macro. But there are things that custom macros can do, often behind the scenes, that improve safety, minimize mistakes, improve quality and reduce production time. There are also situations when machine actions must be taken in real time based upon some condition that exists when the machine is in cycle. In these cases, a CAM system cannot help — but a custom macro running in the CNC can make the related decisions.

Utility Applications. I call any custom macro enhancing the way a CNC machine behaves a utility application. As Ben Staats of Abcissa Ordinate LLC puts it, “I like the term ‘marriage’ of CAM to macros for the fact that when you mix in program restarts that require human intervention on bridge mills where castings are expensive, things must happen correctly — and utility macros fit the bill.”

Ben’s utility application involves tracking the current origin point for multiple surfaces being machined on a bridge mill. Up to five sides of the workpiece could be worked on, and if the incorrect origin is selected or if the origin position is improperly entered (by operator error), the result would likely be a machine crash.

A CAM system will, of course, correctly output programmed coordinates for any of the five sides being machines. But it cannot properly determine the position of the workpiece on the machine table, nor can it assign the related program origins. This was done by a custom macro and only after the setup was made.

There are many times when utility custom macros enhance the ways CNC machines behave, regardless of the programming method used to create the G-code program. Often, setup programs assigning program zero involve custom macro techniques. Indeed, if a touch probe is used with a FANUC CNC, there are custom macros used to control it.

Custom macros also allow people to error-trap certain mistakes that operators make. If a mistake is made, the custom macro can generate an alarm that stops the machine. Common mistakes trapped in this fashion include improper offset entries, incorrect specification of axis starting position and attempting to run the wrong program. Any time a mistake is made, the possibility of “trapping” it with custom macro should be considered. No CAM system will have access to the real-time data needed to trap these kinds of erroneous conditions at the machine.

Real-time applications. As stated, custom macros run in real time — while the machine is in production. A spindle probe may, for example, measure the amount of raw material that is on a given surface for machining. The related custom macro can then determine the number of machining passes that must be made. A CAM system cannot do this since the number of required passes will change based on probing results. This data is not available to the CAM system at the time of program creation.

Canned-cycle applications. Most CAM systems do generate G code that incorporates the use of certain canned cycles. For machining centers, most will take advantage of hole-machining canned cycles (G81, G82, G83 and the like). For turning centers, many specify threading to be done by a canned cycle. This shortens the G-code program and makes it easier to manipulate the way machining occurs at the machine with simple program edits.

Consider other possibilities when shortening programs or providing more control of program behavior at the machine. A company may be using end mills to rough machine round pockets or cored holes using helical motion. This provides a way to machine deep holes with an end mill that has a short flute or insert. Again, a CAM system can easily generate the G-code commands to helix mill based upon a specified depth-of-cut per pass, but many commands will be required and there will be no way to change the depth per pass at the machine.

If a CAM system can generate a calling command to the related custom macro (all current CAM systems should allow this), it can create a helix-milling custom macro and keep it in the CNC memory. This will allow CNC users to easily change the depth per pass and anything else about how helix milling is done right at the machine.

Getting back to Ben’s marriage analogy, be sure the custom macro applications elected to use with CAM system programming are compatible. As with any good marriage, eliminating conflict is a job all its own.

World Machine Tool Survey
OASIS Inspection Systems
The view from my shop.
VERISURF
Precision grinding & hard turning custom solutions
Gravotech
MMS Made in the USA
IMTS 2024
IMTS 2024
Gardner Business Intelligence
CHIRON Group, one stop solution for manufacturing.
DN Solutions

Related Content

Understanding G27, G28, G29 and G30

Take a closer look at these reference position commands.

Read More

Tips for Designing CNC Programs That Help Operators

The way a G-code program is formatted directly affects the productivity of the CNC people who use them. Design CNC programs that make CNC setup people and operators’ jobs easier.

Read More

7 CNC Parameters You Should Know

Parameters tell the CNC every little detail about the specific machine tool being used, and how all CNC features and functions are to be utilized.

Read More
Basics

Understanding CNC Machine Accuracy and Repeatability

Properly evaluating machine tool capability requires understanding how the both user and the builder can influence precision.

Read More

Read Next

3 Mistakes That Cause CNC Programs to Fail

Despite enhancements to manufacturing technology, there are still issues today that can cause programs to fail. These failures can cause lost time, scrapped parts, damaged machines and even injured operators.

Read More
Large Part Machining

The Cut Scene: The Finer Details of Large-Format Machining

Small details and features can have an outsized impact on large parts, such as Barbco’s collapsible utility drill head.

Read More
CNC Turnkey Package for Knee Mills and Lathes