(2018 Feb 9 added hub support) |
(subroutine: draws one whole gear tooth with no gap) |
o621 sub (draw pie shape quadrants over the gear leaving "spokes" in between) (makes pointy pieces or round ended pieces) (compensation to be made by adjusting spokelength and/or thick) (the third parameter controls spoke length) (parms: xloc,yloc,baseradius,scutdiam,numspokes,spokethick,spoketaper,extrahub,ginc) #<xloc> = #1 #<yloc> = #2 #<sradius>=#3 #<scutdiam>=#4 #<numspokes> = #5 (2 < numspokes < 17 w thickness below, if you need more spokes,they'll have to be thinner) #<spokethick> = [#6 +#<scutdiam>/2] #<spoketaper>=#7 #<extrahub>=#8 (this one is +,-, or zero) #<sginc>=#9 #<spassesneeded>=#10 #<scuttingfeed>= #11 #<scuttingdepth>= #12 (#<spokethick> is half of the thickness passed in) #<innie> = 0 (fillet position???) o622 if [#<extrahub> lt 0] #<innie>= 1 #<extrahub> = [-#<extrahub>] o622 endif (this routine compensates spoke length, might need to change it) #<spokelength> =[SQRT[ [[#<sradius>-#<scutdiam>/2]-#<spokethick>]**2 +[#<spokethick>]**2]] (relative to gear center) #<quadrantsize> = [360/#<numspokes>] #<firstorigin> = [#<quadrantsize>/2] #<originlength> = [SQRT[[#<spokethick>+#<spoketaper>]**2+[[#<spokethick>+#<spoketaper>]/tan[#<firstorigin>]]**2]] (relative to gear center) #<currentquadrant> = #<quadrantsize> #<firstcut>= [atan[#<spokethick>]/[#<spokelength>]] o612 if [#<extrahub> ne 0] #<originlength> = [SQRT[[#<spokethick>+#<spoketaper>+#<extrahub>]**2+[#<spokethick>+#<extrahub>]**2]] (relative to gear center) #<spokelength> = [#<spokelength> - #<extrahub>] #<firstorigin> = [atan [#<spokethick>+#<spoketaper>]/[#<originlength>]] #<secondorigin> = [#<currentquadrant> - #<firstorigin>] #<hereiamx>= [#<xloc>+cos[#<firstorigin>]*[#<originlength>]] #<hereiamy>= [#<yloc>+sin[#<firstorigin>]*[#<originlength>]] #<hereiamchord>= [SQRT[[[#<xloc>+cos[#<secondorigin>]*[#<originlength>]]-#<hereiamx>]**2 +[[#<yloc>+sin[#<secondorigin>]*[#<originlength>]]-#<hereiamy>]**2]] #<hereiamangle>=[[+#<secondorigin>-#<firstorigin>]/2] #<ray>= [#<hereiamchord>/[2*tan[#<hereiamangle>]]] #<chordangle>= atan[#<yloc>+[sin[#<secondorigin>]]*#<originlength>-#<hereiamy>]/[#<xloc>+[cos[#<secondorigin>]]*#<originlength>-#<hereiamx>] #<sideangle>= atan[#<yloc>+[sin[#<firstcut>]]*#<spokelength>-#<hereiamy>]/[#<xloc>+[cos[#<firstcut>]]*#<spokelength>-#<hereiamx>] o613 if [#<sideangle> gt 360] #<sideangle> = [#<sideangle>- 360] o613 endif #<sideangle>= [#<sideangle> + 90] #<chordangle> = [[#<chordangle> - #<sideangle>]] #<ray>= [#<ray> + [#<hereiamchord>/2]*[tan[#<chordangle>]]] o612 else #<secondorigin> = #<firstorigin> o612 endif #<secondcut>= [#<currentquadrant>-#<firstcut>] (begin drawing pie pieces here) o610 while [#<currentquadrant> lt [360+#<quadrantsize>]] g0 f100 x[#<xloc>+cos[#<firstorigin>+#<sginc>]*[#<originlength>]] y[#<yloc>+sin[#<firstorigin>+#<sginc>]*[#<originlength>]] #302 = 0 o405 while [#302 lt #<spassesneeded>] #302 = [#302 + 1] g1 f#<scuttingfeed> z[0.0 - #302*#<scuttingdepth>] (plunge) g1 x[#<xloc>+cos[#<firstcut>+#<sginc>]*#<spokelength>] y[#<yloc>+sin[#<firstcut>+#<sginc>]*#<spokelength>] g3 x[#<xloc>+cos[#<secondcut>+#<sginc>]*#<spokelength>] y[#<yloc>+sin[#<secondcut>+#<sginc>]*#<spokelength>] i [#<xloc>] j [#<yloc>] g1 x[#<xloc>+cos[#<secondorigin>+#<sginc>]*[#<originlength>]] y[#<yloc>+sin[#<secondorigin>+#<sginc>]*[#<originlength>]] o611 if [#<extrahub> ne 0] #<hereiamx>= [#<xloc>+cos[#<firstorigin>+#<sginc>]*[#<originlength>]] #<hereiamy>= [#<yloc>+sin[#<firstorigin>+#<sginc>]*[#<originlength>]] o623 if [#<innie> eq 1] g3 x[#<hereiamx>] y[#<hereiamy>] i [#<xloc>+#<ray>*[cos[#<hereiamangle>+#<firstorigin>+#<sginc>]]] j [#<yloc>+#<ray>*[sin[#<hereiamangle>+#<firstorigin>+#<sginc>]]] o623 else g2 x[#<hereiamx>] y[#<hereiamy>] i [#<xloc>] j [#<yloc>] o623 endif o611 endif o405 endwhile g0 f100 z0.25 #<currentquadrant> = [#<currentquadrant> + #<quadrantsize>] #<firstorigin> = [#<firstorigin> + #<quadrantsize>] #<secondorigin> = [#<secondorigin> + #<quadrantsize>] #<firstcut>= [#<firstcut> + #<quadrantsize>] #<secondcut>= [#<secondcut> + #<quadrantsize>] o610 endwhile (end making pie shapes spokes) o621 endsub |
#10 = 0.018 (This should be zero, its an approximation) |
(this routine cuts teeth and the gully between teeth) #10 = [1*#<_precision>] (This should be zero, its an approximation) |
#<native> = #10 (native has the last value of inva before we flip) |
#<native> = [atan/] o511 if[#<native> gt [[360/[2.0*#6]]]] o512 if [#<_incangle> eq 0] (DEBUGprogram error,can't fit full teeth:bad pressure angle?) o512 endif o511 endif |
#10 = [#10 - #<_precision>] |
#<_endangle> = [[360.0/[2.0*#6]]+2.0*#<inva>+#<_fudgewccw>] |
o2003 while [#10 gt 0.018] (a small flat spot) |
o2003 while [#10 ge [1*#<_precision>]] (a small flat spot) |
#14 = [#3*cos[+#4+#<_incangle>] + #1] #15 = [#3*sin[+#4+#<_incangle>] + #2] g1 x#14 y#15 #<_endangle> = [#<_incangle>] |
;#14 = [#3*cos[+#4+#<_incangle>] + #1] ;#15 = [#3*sin[+#4+#<_incangle>] + #2] ;g1 x#14 y#15 |
;(DEBUG, base angle=#25degrees,pitch angle=#26degrees,base-thickness=#22",pitch-thick=#21",addendum=#<_raddendum>",tooth above baseradius=#23",diametral pitch=#24,#<_gsamples>samples ) |
(DEBUG, base angle=#25degrees,pitch angle=#26degrees,base-thickness=#22",pitch-thick=#21",addendum=#<_raddendum>",tooth above baseradius=#23",diametral pitch=#24,#<_gsamples>samples ) |
#<ginc> = +03.0 (degree of rotation of both gears, change this to ) o800 while [#<ginc> lt 4] |
#<ginc> = +6.0 (degree of rotation of both gears, change this to ) o800 while [#<ginc> lt +7] |
#<baseradius> = 1.10000 #<numberteeth> = 24 (this must be a even number, sorry) |
#<baseradius> = 1.10000 (3.50 works with 60t 5/64 cutter & .002 fudges) ;#<baseradius> = 2.45000 (2.45 works with 4/64 cutter with new fix & .002 fudges) ;#<baseradius> = 2.60000 (2.6 works with 4/64 cutter with new fix) ;#<baseradius> = 3.30000 (1.9 is smallest with 60 teeth and 14.5 and 5/64) (3.3 with fudgeh of .025 with 60 teeth and 5/64th mill precision .6) #<numberteeth> = 30 (this must be a even number, sorry) |
#<_fudgeh> = +0.000 (adjust top, must be less than addendum inches) |
#<_fudgeh> = -0.025 (adjust top, must be less than addendum inches) |
#<_precision> = 0.100 (adjust accuracy,.01 and .001 take long) |
#<_precision> = 0.1 (adjust accuracy,.01 and .001 take long) |
#<cuttingfeed> = 01.0 (5/64 endmills last much longer with this) |
;#<cuttingfeed> = 01.0 (5/64 endmills last much longer with this) |
(compensation to be made by adjusting spokelength and/or thick) #<numspokes> = 7 (2 < numspokes < 17 w thickness below, if you need more spokes,they'll have to be thinner) #<spokethick> = [[#<baseradius>+#<cutterdiam>/2] / 18] (half of the thichness) #<spokelength> =[SQRT[ [[#<baseradius>-#<cutterdiam>/2]-2*#<spokethick>]**2 +[#<spokethick>]**2]] (relative to gear center) #<quadrantsize> = [360/#<numspokes>] #<firstorigin> = [360/[2*#<numspokes>]] #<originlength> = [SQRT[[#<spokethick>]**2+[#<spokethick>/tan[#<firstorigin>]]**2]] (relative to gear center) #<currentquadrant> = #<quadrantsize> #<firstcut>= [atan[#<spokethick>]/[#<spokelength>]] #<secondcut>= [#<currentquadrant>-#<firstcut>] #<spoketaper> = [3.0*#<cutterdiam>] (adds thickness at the center) o610 while [#<currentquadrant> lt [360+#<quadrantsize>]] g0 f100 x[#<gearcenterx>+cos[#<firstorigin>+#<ginc>]*[#<originlength>+#<spoketaper>]] y[#<gearcentery>+sin[#<firstorigin>+#<ginc>]*[#<originlength>+#<spoketaper>]] #302 = 0 o405 while [#302 lt #<passesneeded>] #302 = [#302 + 1] g1 f#<cuttingfeed> z[0.0 - #302*#<cuttingdepth>] (plunge) g1 x[#<gearcenterx>+cos[#<firstcut>+#<ginc>]*#<spokelength>] y[#<gearcentery>+sin[#<firstcut>+#<ginc>]*#<spokelength>] g3 x[#<gearcenterx>+cos[#<secondcut>+#<ginc>]*#<spokelength>] y[#<gearcentery>+sin[#<secondcut>+#<ginc>]*#<spokelength>] i [#<gearcenterx>] j [#<gearcentery>] g1 x[#<gearcenterx>+cos[#<firstorigin>+#<ginc>]*[#<originlength>+#<spoketaper>]] y[#<gearcentery>+sin[#<firstorigin>+#<ginc>]*[#<originlength>+#<spoketaper>]] ;g3 x[#<gearcenterx>+cos[#<secondcut>+#<ginc>]*[#<originlength>+#<cutterdiam>]] y[#<gearcentery>+sin[#<secondcut>+#<ginc>]*[#<originlength>+#<cutterdiam>]] i [#<gearcenterx>] j [#<gearcentery>] o405 endwhile g0 f100 z0.25 #<currentquadrant> = [#<currentquadrant> + #<quadrantsize>] #<firstorigin> = [#<firstorigin> + #<quadrantsize>] #<firstcut>= [#<firstcut> + #<quadrantsize>] #<secondcut>= [#<secondcut> + #<quadrantsize>] o610 endwhile (end making pie shapes spokes) |
o621 call [#<gearcenterx>][#<gearcentery>][#<baseradius>+#<cutterdiam>][#<cutterdiam>][6][[#<baseradius>+#<cutterdiam>]/16][0.5*#<cutterdiam>][-1/6*#<baseradius>][#<ginc>][#<passesneeded>][#<cuttingfeed>][#<cuttingdepth>] |
o3001 while [#<compass_point> lt [360.0 +#<ginc>]] |
#<endturn> = [#<compass_point> + 360] o3001 while [#<compass_point> lt [360.0 +#<endturn>]] |
#<compass_point> = [#<compass_point>+360.0/#<numberteeth>] |
(DEBUG, 1st gullet radius is: #21) |
;(DEBUG, 1st gullet radius is: #21) |
g0 x0 y0 |
(DEBUG, naddendum is #<naddendum>) |
;(DEBUG, naddendum is #<naddendum>) |
;#<gearcenterx> = [#<gearcenterx>+[#<pitchradius>/#<ratio>]+#<pitchradius>+[#<_raddendum>-#<naddendum>]+ 0.0*#<cutterdiam>] (comp offset) #<gearcenterx> = [#<gearcenterx>+[#<pitchradius>/#<ratio>]+#<pitchradius>+[#<daddendum>]+ 0.0*#<cutterdiam>] (comp offset) |
#<gearcenterx> = [#<gearcenterx>+[#<pitchradius>/#<ratio>]+#<pitchradius>+[#<daddendum>/2]+ 0.0*#<cutterdiam>] (comp offset) |
#<_fudgewc> = [+atan[.001]/[#<baseradius>]] |
#<_fudgewc> = [+atan[.003]/[#<baseradius>]] |
#<_fudgeh> = #<cutterdiam> |
#<_fudgeh> = 0 |
(draw pie shape quadrants over the 2nd gear leaving "spokes" in between) o621 call [#<gearcenterx>][#<gearcentery>][#<baseradius>+#<cutterdiam>][#<cutterdiam>][3][[#<baseradius>+#<cutterdiam>]/6][0*#<cutterdiam>][+1/9*#<baseradius>][-#<ginc>][#<passesneeded>][#<cuttingfeed>][#<cuttingdepth>] |
#<endturn> = [#<compass_point> + 360] |
o4001 while [#<compass_point> lt [540.0-360/#<numberteeth>]] |
o4001 while [#<compass_point> lt #<endturn>] |
(DEBUG, 2nd gullet radius is: #21) |
;(DEBUG, 2nd gullet radius is: #21) |
|