Mitsubishi Electric
Published

5 Reasons Why You Should Know How to Write Custom Macros

Custom macros enhance what can be done in G-code programs, giving users the ability to code operations that were previously not possible.

Share

Photo Credit: Getty Images

FANUC Custom Macro is the most popular version of parametric programming. Indeed, several CNC manufacturers emulate it to provide parametric programming capabilities in their CNCs. Custom macros enhance what can be done in G-code programs, giving you the ability to do things you may think to be impossible. The first step to doing anything, of course, is to know that it is possible.

Here, are five application categories for custom macro — five reasons why you should understand custom macro — and almost all companies have applications that fall into at least one of these categories.

1. Part families

Similar components making up a part family are often described on a single drawing with variable dimensions. You must reference a chart on the drawing to determine the dimensions for a given part in the family. Even if each component is described on a separate drawing, you may be required to take one CNC program and modify it slightly to create a different CNC program for a similar workpiece. The more parts in the family, the more beneficial a part-family custom macro becomes.

Ideally, the machining process will be the same for all parts in the family — possibly even using the same cutting tools for multiple parts. If so, it is possible to write one custom macro program for all parts in the family. CNC operators could specify the values of changing dimensions (variables) at the machine between jobs — or each part could utilize its own “calling program,” which will specify variable settings and then call the part-family custom macro.

One important benefit of a part-family custom macro is program maintenance. If anything changes that affects all parts in the family — possibly a design change or a process improvement — only the (one) custom macro program need be changed. Compare this to having to change every hard-and-fixed program if a custom macro is not used.

2. User-created canned cycles

CNC manufacturers provide canned cycles for commonly performed machining operations, such as hole machining operations on machining centers and roughing, finishing and threading operations on turning centers. Even if you utilize a CAM system to create G-code programs, the CAM system probably makes use of at least some control-based canned cycles.

Advantages of canned cycles include shortened CNC programs and simple, at-the-machine program modifications to improve or correct the way a machining operation is performed. With hole machining, for instance, it is very easy to switch from a standard drilling cycle to a deep-hole or a chip-break peck drilling cycle with just a couple of easy program edits.

CNC manufacturers only provide canned cycles for operations that comprise a great percentage of those their users perform. Your company surely performs other machining operations that cannot be commanded by a canned cycle, such as thread milling or face milling on machining centers or necking grooves or knurling on turning centers.

With custom macro, it is possible to write a canned cycle program to perform even the most obscure machining operation — it could be an operation that only your company performs — and you can command its execution with a user-defined G code and even make it modal.

3. Utilities

A utility application enhances the way the CNC machine behaves. It could reduce setup or cycle time, improve safety or make the machine easier to work with. Frankly speaking, whenever you see a CNC operator struggling with a task, it is possible that a utility custom macro can help.

Utility applications are possible because custom macro provides access to certain CNC functions that are not accessible through normal G-code programming, such as access to machine position, offset registers, alarm generation and more. With access to these CNC functions, it is possible, for instance, to create a setup-enhancing custom macro that helps with program zero assignment.

If a machining center does not have a touch probe, custom macro programs can be developed to use an edge finder to do just about anything a touch probe can do, including locating the program zero point and placing program zero assignment values into fixture offset registers. The only difference is that making the edge finder touch each surface must be done manually.

This just scratches the surface of what utility custom macros can do. The potential is limited only by your imagination and ingenuity. When asked if a given application is possible, my answer is almost always: “Yes — now we just have to figure out how to do it.”

4. Complex motions

CNC manufacturers provide interpolation for basic motion types, such as linear interpolation, circular interpolation and helical interpolation. While the standard interpolation types are adequate for most CNC users, you may need more.

Consider a taper-thread milling operation. While straight thread can be machined using helical interpolation, taper threads require a spiral motion. The X- or Y-axis radius changes as the thread milling cutter moves in the Z-axis. Most CNC manufacturers do not provide this kind of motion as an interpolation type. With custom macro, you can create spiral interpolation, making a tapered-thread milling cutter move as it should to machine a tapered thread.

5. Interfacing with machine accessories

Custom macro is used to “connect” a CNC machine to several kinds of complex accessory devices, such as touch probes, post-process gauging systems and automatic loading systems. It is usually the accessory device manufacturer that provides the related custom macros, so end users are not involved. That said, there are simpler devices an end user could tackle, such as indexers and clamping systems. Knowing how it is done would save your company the cost of getting an outside vendor involved.

Mitsubishi Electric
BIMU 2024
Universal Homepage Package W4900 Indicator
Gravotech
JTEKT
Paperless Parts
Gardner Business Intelligence
Hurco
Discover a variety of the best CNC machines
Formnext Chicago on April 8-10, 2025.
An ad for Formnext Chicago on April 8-10, 2025.
VERISURF

Related Content

5 Tips for Running a Profitable Aerospace Shop

Aerospace machining is a demanding and competitive sector of manufacturing, but this shop demonstrates five ways to find aerospace success.

Read More
Five-Axis

Fearless Five-Axis Programming Fosters Shop Growth

Reinvestment in automation has spurred KCS Advanced Machining Service’s growth from prototyping to low-and mid-volume parts. The key to its success? A young staff of talented programmers. 

Read More
Sponsored

How this Job Shop Grew Capacity Without Expanding Footprint

This shop relies on digital solutions to grow their manufacturing business. With this approach, W.A. Pfeiffer has achieved seamless end-to-end connectivity, shorter lead times and increased throughput.

Read More

5 Reasons Why Machine Shop Ownership Is Changing

Mergers, acquisitions and other ownership changes are an effect of Boomer-age shop owners retiring, but only in part. Also important: The way we think about machining has changed.    

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

Encountering Surface Finishes in the Everyday World

Surface measurement is becoming increasingly important to ensure proper performance of a manufactured product. Advanced surface measurement tools are not only beneficial in the manufacturing industry but also have unconventional applications.

Read More
Basics

Obscure CNC Features That Can Help (or Hurt) You

You cannot begin to take advantage of an available feature if you do not know it exists. Conversely, you will not know how to avoid CNC features that may be detrimental to your process.

Read More
Mitsubishi Electric