Q-Parameters & Assignment

Store a number in a Q-parameter and compute one value from another.

A Q-parameter is a numbered box you can put a number in. Q1 = 4 means “put 4 in Q1”. Klartext reaches for these boxes whenever a value has to be worked out rather than typed — and 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 Q2. Set Q1 to the hole count (4), then set Q3 to the circle’s diameter by doubling the radius — compute it from Q2 so it follows whatever radius the machine gives, don’t just type a number.

The machine gives you

radius 40:Q2 = 40
radius 25 (a hardcoded 80 fails here):Q2 = 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.