O0525
G40G49G80G90G69G17G15 ---- Program initialization
M03S1000 ---- Spindle clockwise rotation at 1000 RPM
G54G00X0Y0Z200 ---- Move to programming origin, above the safety plane
G01G43H01Z50F1000 ---- Enable tool length compensation, move to the cutting plane
#1=1 ---- Process the first layer
WHILE[#1LE6]DO1 ---- While #1 is less than or equal to 6, enter loop 1
#2=1 ---- Process the first hole
N30 #6=[#2-1]*10 ---- Hole spacing
IF[[#1AND1]EQ0]GOTO20 ---- If #1 is even, jump to program segment N20
#3=10+#6 ---- X coordinate for odd layers
#4=10+[#1-1]*10 ---- Y coordinate for odd layers
#5=10 ---- Total number of holes for odd layers
GOTO10 ---- Jump to program segment N10
N20 #3=95-#6 ---- X coordinate for even layers
#4=10+[#1-1]*10 ---- Y coordinate for even layers
#5=9 ---- Total number of holes for even layers
N10 G00X#3Y#4 ---- Position above the hole
G98G90G81Z-50R1 ---- Peck drilling
#2=#2+1 ---- Increment the variable by 1
IF[#2LE#5]GOTO30 ---- If #2 is less than or equal to #5, jump to program segment N30
#1=#1+1 ---- Increment the variable by 1
END1 ---- End loop 1
M05
M30
What is provided here is the idea of programming, otherwise any system, it is the same way.