camInstructor Video Blog

Macro B Programming - Introduction

Written by camInstructor Mike | 2/20/19 11:00 AM

Macro B Programming doesn't have to be scary! Here's a brief introduction into some of the capabilities of Macro B Programming.

Having a look at Fanuc Macro B Programming. We'll go through a very basic program to provide an introduction into what you can do with macro programming. I'm going to focus on the Fanuc Macro B language since it happens to be very common control and the Haas macro language is pretty much exactly the same. In the accompanying video, the software being used is Cimco Edit 8. Another popular software for simulating your macro programs is NCplot. Here are links to both of those softwares...

Cimco

NCPlot

In the example, I start with a very basic gcode program that profiles a rectangle that is 6"x4". From there input those length and width values into variables.

#1=6.0

#2=4.0

Now instead of calling X6.0 in the program, you can call X#1. Same goes for the Y location, instead of Y4.0 we're calling Y#2. So why would you want to do this? Typing X6.0 is pretty much the same as typing X#1. The reason is flexibility. 

You can now simply edit the variable values and the program will automatically update to the new sizes. In the example, there is only one callout for variables 1 and 2 so this is not a great example just yet but we can increase the complexity a bit and then maybe show some of the power of fanuc macro b programming.

In the example, I add in a radius at one of the corners and a new variable to hold the size of that radius. In the program, to cut this radius correctly the original command of X#1 needs to be updated to stop short of the end of the part. It needs to stop short by the size of the defined radius. We can use macro math functions for this. When doing math, otherwise referred to as an equation, we need to encase it in square brackets [ ]. Our equation will look like this...

X[#1-#3]

This will set the value for X to whatever #1 - #3 is. Using math inside of your programs will unleash some amazing capabilities for you. Even if you do not completely use macro programming, these equations are still valuable.

Trying to figure out the feedrate for a tap? Lets pretend a mill is used, so inches per minute are needed, using a 1/2-13 tap running at 200 rpm....for the G84 canned cycles F values you can type in F[1/13*200] no need for a calculator!

Keep an eye out for video 2 on Fanuc Macro B Programming!

Macro B Programming Part 2

 

 

Want to learn more about CNC? Check out;

camInstructor for Teachers - Independent Learners - Students