Reading a Setting & Branching
Read a setting from the #20000 mirror and take a different path based on it.
The NGC mirrors the entire Settings page into read-only variables: #20000 + n is Setting n. #20009 is Setting 9, DIMENSIONING — the machine's unit mode. A macro can read it and adapt. Treat 0 as INCH and 1 as MM for this lesson (confirm the encoding on a real machine before you rely on it).
Your turn
A clearance height of 1.0 inch is baked into your macro. Read Setting 9 from #20009 and leave the clearance in #101 in the machine's current units: keep it 1.0 in inch mode (#20009 = 0), or convert it to millimetres (× 25.4) in mm mode (#20009 = 1). Use an IF branch.
The machine gives you
#20009 = 0#20009 = 1Your program is run once for each set of conditions. It has to work for all of them.
This is a learning simulation — always prove out a program on the actual control before you cut metal.