Hi
No-one seems to be rising to the challenge
I have had to scale down the distances involved to get them to fit into a sim
The first punch is represented by the negative Z moves, the second punch is represented by the positive Z moves
Since there is only one tool origin on a sim, the moves are in the same plane but shown #<_between-punch-heads> apart
(ie offset from each other when in reality they would be operating on the same point on the workpiece)
This is not a polished piece, just an example of using a sub to activate the second head when the first is #<_between-punch-heads> ahead of a hole
There are many ways to do the same thing
Code:
;punch.ngc
;ArcEye 2013
o200 sub
o201 IF[#<_bottom-base-index> LT #<_base-holes>]
G0 X#<_bottom-x>
G1 Z10 F1000
G0 Z0
#<_bottom-x> = [#<_bottom-x> + #<_base-centres>]
#<_bottom-base-index> = [#<_bottom-base-index> + 1]
o203 IF[#<_bottom-base-index> GE #<_base-holes>]
#<_bottom-x> = [[#<_bottom-x> - #<_base-centres>] + #<_distance-to-main> ]
o203 ENDIF
o201 ELSE
o202 IF[#<_bottom-main-index> LT #<_main-holes>]
G0 X#<_bottom-x>
G1 Z10 F1000
G0 Z0
#<_bottom-x> = [#<_bottom-x> + #<_main-centres> ]
#<_bottom-main-index> = [#<_bottom-main-index> + 1]
o202 ENDIF
o201 ENDIF
o200 endsub
g17 g21 g40 g49 g54 g80 g90 g94
#<_base-holes> = 3
#<_base-centres> = 10
#<_first-hole> = 20
#<_distance-to-main> = 100
#<_main-centres> = 15
#<_main-holes> = 6
#<_between-punch-heads> = 30
#<_bottom-base-index> = 0
#<_bottom-main-index> = 0
G0 X0 Y0 Z0
G0 X#<_first-hole>
#<_top-x> = #<_first-hole>
#<_bottom-x> = [#<_first-hole> + #<_between-punch-heads>]
o103 repeat[#<_base-holes>]
G0 X#<_top-x>
G1 Z-10 F1000
G0 Z0
o105 IF[#<_top-x> GE #<_bottom-x> ]
o200 call
o105 ENDIF
#<_top-x> = [#<_top-x> + #<_base-centres>]
o103 endrepeat
#<_top-x> = [[#<_distance-to-main> - #<_base-centres>] + #<_top-x>]
o108 WHILE[#<_top-x> GT #<_bottom-x> ]
o200 call
o108 ENDWHILE
o104 repeat [#<_main-holes>]
G0 X#<_top-x>
G1 Z-10 F1000
G0 Z0
o106 IF[#<_top-x> GE #<_bottom-x> ]
o200 call
o106 ENDIF
#<_top-x> = [#<_top-x> + #<_main-centres>]
o104 endrepeat
o107 WHILE[#<_bottom-main-index> LT #<_main-holes>]
o200 call
o107 ENDWHILE
G0 X0 Y0
M2
Plot looks like this
regards