M97 Repeats, as a Loop

Model an M97 L-repeat with a WHILE loop that steps across a G154 offset.

M97 P1000 L4 is a Haas idiom: it calls line N1000 inside the same file four times, returning with M99 — a local subprogram, no separate O-number to lose. Our engine runs one program at a time, so here you'll build the same “do this block N times” behaviour with a WHILE loop. Same shape, one file.

Read firstHaas Programming & MacrosHaas NGC macro programming for Fanuc-fluent machinists: G154 work offsets, M97 local subprograms, Setting 33 coordinate compatibility, G65 macro calls with a complete bolt-circle example, G31 probing, and DPRNT output.

Your turn

Model M97 P1000 L#1 drilling a row of holes. Read the row's start X from the G154 P1 X origin (#14001) into #110. Then loop #1 times: for each pass compute this hole's X into #121 as start + index × pitch (#2), emit G01 X#121 F300, and step the index. Leave the pass count in #100 and the last hole's X in #121.

The machine gives you

4 passes at pitch 25, P1 at X-300:#14001 = -300#1 = 4#2 = 25
the same block with P1 at the origin:#14001 = 0#1 = 3#2 = 10

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.