Skip to content
drill.ngc 1.42 KiB
Newer Older
electrolab's avatar
electrolab committed
;drill
O<drill> sub

#<ccomp> = #<_ccomp>
#<metric> = #<_metric>
#<absolute> = #<_absolute>
#<feed> = #<_feed>
#<coord_system> = #<_coord_system>
#<lathe_diameter_mode> = #<_lathe_diameter_mode>
#<ijk_absolute_mode> = #<_ijk_absolute_mode>

G7  ; diameter mode
G90 ; Absolute Distance

; #1 drill diameter
; #2 ydepth
; #3 speed
; #4 feed/rpm
; #5 tool number
; #6 peck amount
; #7 retract amount
; #8 coolant

        O10 if [#8 EQ 1]
                M8
        O10 endif

#9 = #<_y> (starting Y)

;M6 T#5 G43
        O100 if [#5 NE #<_current_tool>]
                (MSG, ERROR : Set tool before use macro)
                 O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]
        O100 return [-2] ; indicate failure to epilog
        O100 endif

#7 = [[1000 * #3] / [3.1415 * #1]]	; metric mode RPM

G97 S#7 ; Constant RPM mode
M3 ;Start Spindle
G95 F#4 ; Feed-Per-Rev Mode
G4 P1 ; Wait to reach speed

(debug, Drilling dia #1 depth #2 asked-speed #3 feed/rpm #4 tool #5 peck dist #6 calculated-rpm #7 start-Y #9)
(MSG, ERROR : TODO must retract the X axis to home position)
;	G0 X0 ; TODO must retract the X axis to home position
;G0 Y#9
G98
G83 Y#2 R#9 Q#6
G80
;G0 Y#9

M5   
M9

; restore g20/21, g90/g91, feed
	O<restore> call [#<metric>] [#<absolute>] [#<feed>] [#<ccomp>] [#<coord_system>] [#<lathe_diameter_mode>] [#<ijk_absolute_mode>]

O<drill> endsub

M2
%