camInstructor Video Blog

Using WHILE and IF in Macro B

6/1/20 8:00 AM / by camInstructor Mike

Making a program that will face ANY size block using Macro B. This was taken from one of our YouTube Live Streams.

This video is pulled from our last live stream. The full stream was roughly an hour long.

Stream starts at about 5:11

Basic g code is just a way to 'connect the dots'. Custom Macro B allows the programmer to put some logic into the g code with tools such as loops and branches. It also provides additional Math functions and the ability to access information from the machine. Custom Macro B programs can be simple, they can be complex. From custom canned drilling cycles to probing routines to cutting simple shapes, there's almost nothing you can't do with Macro B programming.

0:00 Stream waiting to start

5:11 Introduction

6:27 Overview of softwares used in the demo

8:08 Starting the program

19:04 Add parameters to the program

26:13 Discussing the need for logic in this program

28:44 Creating the logic discussed

39:05 First look at NCPlots live variable display


45:00 Back to the program

46:00 Into the While loop

50:46 Looking at an If statement

1:04:30 Testing on multiple blocks

1:08:30 Wrapping it up


Be sure to watch videos 1 and 2 in our ever evolving macro series... 

Macro B - 1

Macro B - 2

Want to learn more about Mastercam? Check out;

camInstructor for Teachers - Independent Learners - Students



Topics: CNC, Macro, Mill, gcode, live stream

camInstructor Mike

Written by camInstructor Mike

camInstructor Mike is Mike Wearne, an avid machinist, cnc programmer and overall connoisseur of all things machining. Mike is one of camInstructor's resident cad/cam/cnc experts and works part time at his local college teaching aspiring machinists how to program CNC Machines of all types.

Subscribe to Email Updates

New call-to-action

    Recent Posts