( id-bore.ngc - test file for internal diameter boring subroutine )
( this routine roughs to a diameter and depth and then does a final )
( finishing pass using the requested finish depth of cut )
( written 3 Nov 2006 By Lawrence Glaister VE7IT )
( uses oword extentions in emc2 cnc program )
( USAGE: o100 call [#1=x center] [#2=y center] [#3=bore dia] [#4=final bore depth] )
( [#5=safety height] [#6=tool dia] [#7=finish doc] [#8=feedrate])
( assumes: surface of material is z0.000 )
( that a step over and step down increment based on cutter diameter/3 is reasonable )
o100 sub
( local variables used in routine )
#10 = [#6/2.0] ( tool radius )
#11 = [#3/2.0] ( bore radius )
(#12 not used )
#13 = 0.0 ( start cut at surface of material )
#14 = 0.0 ( start circle cut radius at 0.0 )
#15 = 0 ( error flag - hopefully zero )
#16 = [fix[[[#11-#7]-#10] / [#6/3]] + 1] ( number of loops needed to bore from center to rough dia )
#17 = [[[#11-#7]-#10] / #16] ( radial step size for roughing )
#18 = 0 ( loop counter for radial cuts )
#19 = [fix[ abs[#4 + #7] / [#6/3] ] + 1] ( number of loops required to cut to rough depth )
#20 = [abs[[#4 + #7] / #19]] ( depth increment )
#21 = 0 ( loop counter for depth layers )
( make sure input is sane )
o110 if [[#16 lt 1] or [#17 lt 0.000] ]
#15 = 1 ( set error flag )
(msg, "OOPS! cutter is too large cut the requested bore" )
o110 endif
o111 if [ [#4 + #7] ge 0.000 ]
#15 = 1 ( set error flag )
(msg, "OOPS! final bore depth must be negative and < finish doc" )
o111 endif
( the body of the subroutine only runs if the sanity checks above passed )
o140 if [ #15 eq 0 ]
g0 z#5 ( safe height for chip clearing )
( loop for as many cuts as we need to get to final depth )
#21 = #19
o150 while [#21 ge 0]
#21 = [#21 -1]
( next move retracts cutter to clear chips before starting next level )
g0 x#1 y#2 z#5 ( run to center of bore )
g0 z[#13+[#6/5]]
g1 f[#8/2]z#13 ( sneak up on uncut surface )
#13 = [#13-#20] ( compute depth for next round of cuts )
o160 if [ #21 eq -1 ]
#13 = #4 ( finish depth pass )
o160 endif
( spiral down to new depth )
#14 = #17
g1 x[#1-#14] y[#2] f[#8/2] ( move to new start point )
g2 f[#8/2] x[#1-#14] y[#2] i[#14] j0.0 z#13 ( cut a circle at current radius)
( cut increasing concentric circles until we reach final rough diameter )
#18 = #16
o200 while [#18 gt 0]
#18 = [#18 - 1]
g1 x[#1-#14] y[#2] f[#8/4] ( move to new start point )
o220 if [ #21 eq -1 ]
F[#8/3] ( finished pass runs at 1/3 feedrate )
o220 else
F#8 ( other passes run at requested feedrate )
o220 endif
g2 x[#1-#14] y[#2] i[#14] j0.0 z#13 ( cut a circle at current radius)
#14 = [#14 + #17] ( compute next radius to cut )
o200 endwhile
o150 endwhile ( loop to rough depth )
( we are now finished to final depth at rough radial size )
( do finishing pass to smooth sides of bore at 1/4 speed )
g1 x[#1-#11+#10] y[#2] f[#8/4] ( move to new start point )
g2 x[#1-#11+#10] y[#2] i[#11-#10] j0.0 ( cut a circle at current radius)
g0 x#1 y#2 z#5 ( run to center of bore at safe height )
o140 endif
o100 endsub
( example of use )
( start of program -- machine a pocket for a skate bearing in 1/4" material )
G20 G17 F10 G64 P0.010 M3 S3000
( bore a 0.866" hole to -.135" deep at 1,2 with a 0.1" cutter,10ipm, finish cut 0.005)
( this half embeds bearing in material with about 0.005" of interference when 2 bores matedt )
o100 call [0.000] [0.000] [ 0.866 ] [-0.135] [0.200] [0.1] [0.005] [10]
( bore a 0.600" hole to -.25" deep at 0,0 with a 0.25" cutter,10ipm, finish cut 0.005)
(o100 call [0.000] [0.000] [ 0.600 ] [-0.250] [0.200] [0.250] [0.005] [10])
m2