%
o100 sub
(making a rectangular inner slot)
(use climb milling = G42 + counter clockwise cutter movement)
(center cut the material, stepover = 1.5 * tool radius)
(o200 call [x1] [y1] [x2] [y2] [tool number] [depth per cut] [depth] [safety height] [feedrate])
; # = [#1 + #]
; # = [#2 + #]
; # = [#3 - #]
; # = [#4 - #]
# = #1
# = #2
# = #3
# = #4
# = #5
# = #6
# = #7
# = #8
# = #9
; G42 X# Y[#] D#
; # = [# + 2 *#]
; # = [# + 2 *#]
; # = [# - 2 *#]
; # = [# - 2 *#]
# = [[#+#]/2]
# = [[#+#]/2]
# = [[#+#]/2]
# = [[#+#]/2]
# = [0]
; # = [0.0625]
; G00 X# Y#
; T# M6 G43 H#
G42 G01 X# F# D#
# = [[#5410]/2]
G40
o120 while [# LT #]
(increment depth by parametr #1 by 0.01)
o121 if [[#+#] GE #]
# = #
o121 else
# = [#+#]
o121 endif
o110 while [[# NE #] OR [# NE #]]
o111 if [[#-1.5*#] LT #]
# = #
o111 else
# = [#-1.5*#]
o111 endif
o112 if [[#+1.5*#] GT #]
# = #
o112 else
# = [#+1.5*#]
o112 endif
o113 if [[#-1.5*#] LT #]
# = #
o113 else
# = [#-1.5*#]
o113 endif
o114 if [[#+1.5*#] GT #]
# = #
o114 else
# = [#+1.5*#]
o114 endif
# = [[#+#]/2]
# = [[#+#]/2]
(rapid to the starting XY)
G00 X[#] Y[#]
(plunge and start working)
G01 Z[# - #] F#
(draw the rectangle)
(start cutting with diameter offset)
G42 G01 X# F# D#
G01 X# Y# F#
G01 X# Y# F#
G01 X# Y# F#
G01 X# Y# F#
G01 X# Y# F#
G40 (cancel diameter offset)
o110 endwhile
o120 endwhile
G0 Z#
o100 endsub
(program to make a 0.40 inch x 3 inch slotted rectangle)
G17 (XY plane select)
G20 (inch mode)
G40 (cancel diameter comp)
G49 (cancel length offset)
G54 (coordinate system 1)
G80 (cancel motion)
G90 (non-incremental motion)
G94 (feed/minute mode)
(home)
G53 G0 Z-0.5 (temporarily cancel offsets, retract quill)
M05 M09 (spindle and coolant off)
G53 X11.5 Y0.15 (move X and Y to home)
(set the coordinate system to workpiece offset)
(origin of the second coordinate system is set to X=11.5, Y=5 and Z=-0.5)
(second coordinate system is selected by G54)
G10 L2 P2 X9.5 Y0.15 Z-4.76
; G10 L2 P2 X9.5 Y0.15 Z-1.76
(set the tool parameters)
(diameter of dremel 561 cutter = 1/8 inch)
(radius of dremel 561 cutter = 1/16 inch)
(tool length offset = 1 inches and radius of cutter bit = 1/16 inches)
(P1 means the tool number 1, which can later be referenced by G41's D1)
G20 G10 L1 P1 Z0 R0.0625
G55 X0 Y0 Z0 (start using the second coordinate system)
G01 F4 (setting the feed rate to 4 inches per minute)
G0 X0.5 Y2 (rapid to the starting XY)
; o100 call [0.30] [1] [.7] [4] [1] [0.4] [.1] [0.02] [.0625]
; o100 call [x1] [y1] [x2] [y2] [tool] [depth_per_cut] [depth] [safety height] [tool dia]
o100 call [0.3] [1] [0.7] [4] [1] [0.1] [1] [0.02] [10]
( getting back to start position )
G0 Z0 (rapid to 0 above the part)
M05 M09 (spindle and coolant off)
G0 X0 Y0 (rapid to the starting XY)
G54 (coordinate system 1)
(back to home)
G53 G0 Z-0.5 (temporarily cancel offsets, retract quill)
M05 M09 (spindle and coolant off)
G53 X11.5 Y5 (move X and Y to home)
G49 (cancel length offset)
M2 (end program)
%