I'm automating a machine we already have I've now got the drives and such working on a desk and while I wait for my Mesa cards to come wanted to nail this
Here's what I have now this will be in an ngcgui panel when done
#<base-holes> = 3
#<base-centres> = 50
#<first-hole> = 53
#<distance-to-main> = 509
#<main-centres> = 150
#<number-main-holes> = 26
G0 X#<first-hole>
#<current-x> = #<first-hole>
o103 repeat [#<base-holes>]
G4 p1
#<current-x> = #<current-x> + #<base-centres>
G0 X#<current-x>
o103 endrepeat
#<current-x> = #<distance-to-main> + #<current-x>
G0 x#<current-x>
o104 repeat [#<number-main-centres>]
G4 p1
#<current-x> = #<current-x> + #<main-centres>
G0 X#<current-x>
o104 endrepeat
Go xo
M2
( the g4 is in place of the punch command as I'm trying to get this code worked out in a sim )
Main issue is that this only takes into account for the one punch head on this machine and there's two at a 600mm offset so the program needs to start on that and then when the math works out ( and the machine is at x600 plus ) the second head needs to join the race