Variables & Assignment

Store numbers in macro variables and compute one from the others.

A macro variable is a numbered box you can put a number in. #101 = 20 means “put 20 in box 101”. Haas keeps a big range of these — #100#199 for scratch work, the #10000s for retained storage on the NGC — but the idea is the same everywhere, and it's the foundation for the whole track.

Read firstWhat Is a CNC Macro? — Start HereA beginner's on-ramp to CNC macro programming for machinists who already write G-code: what macros are, why they matter, variables, math, loops, passing arguments with G65, and a complete first macro worked line by line.

Your turn

Each part takes #102 = 4.5 minutes of cycle time. The machine hands you the batch size in #101. Store the cycle time, then set #103 to the total minutes by computing it from #101 and #102 — so it follows whatever batch the machine gives, don't just type a number.

The machine gives you

batch 20:#101 = 20
batch 30 (a hardcoded 90 fails here):#101 = 30

Your program is run once for each set of conditions. It has to work for all of them.

Loading...

This is a learning simulation — always prove out a program on the actual control before you cut metal.