Fanuc Macro Programming Training Series [ Part 1 – Fanuc Macro Programming Basics ]

Spread the love
R U Sitting Down ?? OK then Buckle up !!! We are about to begin a long … somewhat complex … but very beneficial series teaching the how’s … why’s … and details of the Fanuc Macro B Programming Language. If you do CNC programming and are utilizing a Fanuc Control … your review and understanding about what we are about to present will definitely send you to the next level of CNC programming. Over the next months … we will be interspersing articles in this series covering Fanuc Macro B programming from the basics to the complex. We will still be including and sharing some of our sought after CNC Tips and Tricks … but we will also be including articles in this series as we go along as well. So check back often … follow along … and hopefully we can help bring your CNC programming skills to the next level.

Part One : The Basics

What is Fanuc Custom Macro B ?

Custom Macro is the name given by Fanuc to it’s programming language that enables users to take the standard G code programming to another level. Custom Macro allows users to include instructions, mathematical equations, changing variables and a host of other advanced functions in a G code program. Because of the power of this language, anytime a thought occurs like ” I just need to repeat what I did here” or similar, it’s probably a good time to consider using custom macro programming. Some examples where Custom Macro programming can be employed :
  • Dimensions or other values require calculations or re-calculations “on the fly”.
  • The programming of family of parts or parts that repeat the basic operations but contain only dimensional changes.
  • Dimensions or other values need to be stored or transferred to other addresses in a program.
  • Complex operations where the basic pattern or cutting sequence remains the same … an example would be pocketing … but dimensional changes, that can be defined by one or a series of mathematical formulas, need to be re-calculated “on the fly”.
  • The basic “rule of thumb” is that Macro programming probably can be utilized anywhere where repetition exists.
As you explore this series, we will bring out many instances where macro programming can and should be employed … but we are also sure that these will open doors to macro programming examples in your own world as well. Keep an open mind !!!!

Macro Programming vs. Sub Programming

There are similarities and many differences between a CUSTOM MACRO program and a standard SUB PROGRAM. We outline in this chapter some of the major differences and similarities. SIMILARITIES :
  • Both types can be called from another program.
  • Both types are stored in memory  under their own program number.
  • Both types can be called to repeat a pre-determined number of times.
  • Both types can be called multiple times from other sub or macro programs.
  • Both types end with the M99 command.
  • Macro program body can perform and contain mathematical equations.
  • Macro program calls can establish values for variables used in the macro program.
  • A macro program can be called and made “modal” to repeat until the cancel command is issued.
  • Macro programs can be called from user defined G, M and T codes via parameter settings.
The creation of a custom macro program is identical to the creation of a sub program. Both types are registered to the memory under their own program number and stored separately in the memory. As with sub programs, the end of the custom macro program is done through the use of the M99 command. OK … there are some basics. If you have questions … I’m sure we will address them in the coming articles. SOOO … stay tuned for even Happier Chip Making !!
If you found this post valuable … Please help support “real world” CNC and check out our Real World Software at
Kenney Skonieczny – President Kentech Inc.

Kipware® software is one of the fastest growing brands in machine shops around the world because it solves REAL WORLD problems.




CAD/CAM is ONLY ONE option for CNC programming.



Stop Guesstimating and Start Estimating.



Let ALL your CNC’s operate seamlessly.