Variables & Assignment

Store a number in a variable and use it in another expression.

A macro variable is a numbered box you can put a number in. #100 = 4 means “put 4 in box 100”. Everything else in this track is built on that one idea.

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

The machine hands you the bolt-circle radius in #101. Set #100 to the hole count (4), then set #102 to the circle's diameter by doubling the radius — compute it from #101 so it follows whatever radius the machine gives, don't just type a number.

The machine gives you

radius 40:#101 = 40
radius 25 (a hardcoded 80 fails here):#101 = 25

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.