one thing i havent worked out what the base index variables are for
Quite simple, they keep track of the number of holes for the second punch, both the base-holes and the main-holes.
The top punch can be run in a repeat loop as you had previously, but the bottom punch is conditional on the distance the X axis has moved.
Therefore you need to know when all the holes have been punched by a different method.
I never actually use
repeat in G Code, using
while loops or
if logic, so I am using indexes all the time.
But that is probably because there is no repeat in C and I just use the constructs I am used to.
regards