Fixed worm gear helical angle.

This commit is contained in:
Garth Minette 2020-10-21 20:13:37 -07:00
parent 82c87e4bd4
commit 538c68767b
2 changed files with 15 additions and 13 deletions

View file

@ -958,7 +958,7 @@ function rack(
// l = The length of the worm. Default: 100 // l = The length of the worm. Default: 100
// starts = The number of lead starts. Default: 1 // starts = The number of lead starts. Default: 1
// left_handed = If true, the gear returned will have a left-handed spiral. Default: false // left_handed = If true, the gear returned will have a left-handed spiral. Default: false
// pressure_angle = Controls how straight or bulged the tooth sides are. In degrees. Default: 28 // pressure_angle = Controls how straight or bulged the tooth sides are. In degrees. Default: 20
// backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle. Default: 0 // backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle. Default: 0
// clearance = Clearance gap at the bottom of the inter-tooth valleys. // clearance = Clearance gap at the bottom of the inter-tooth valleys.
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER`
@ -978,7 +978,7 @@ function worm(
d=30, l=100, d=30, l=100,
starts=1, starts=1,
left_handed=false, left_handed=false,
pressure_angle=28, pressure_angle=20,
backlash=0, backlash=0,
clearance, clearance,
anchor=CENTER, anchor=CENTER,
@ -1017,7 +1017,7 @@ function worm(
profiles = [ profiles = [
for (i=[0:1:zsteps]) let( for (i=[0:1:zsteps]) let(
z = i*zstep - l/2, z = i*zstep - l/2,
a = i*astep a = i*astep - 360*revs/2
) )
apply(zrot(a)*up(z), path3d(cross_sect)) apply(zrot(a)*up(z), path3d(cross_sect))
], ],
@ -1031,7 +1031,7 @@ module worm(
d=15, l=100, d=15, l=100,
starts=1, starts=1,
left_handed=false, left_handed=false,
pressure_angle=28, pressure_angle=20,
backlash=0, backlash=0,
clearance, clearance,
anchor=CENTER, anchor=CENTER,
@ -1069,7 +1069,7 @@ module worm(
// worm_arc = The arc of the worm to mate with, in degrees. Default: 60 degrees // worm_arc = The arc of the worm to mate with, in degrees. Default: 60 degrees
// crowning = The amount to oversize the virtual hobbing cutter used to make the teeth, to add a slight crowning to the teeth to make them fir the work easier. Default: 1 // crowning = The amount to oversize the virtual hobbing cutter used to make the teeth, to add a slight crowning to the teeth to make them fir the work easier. Default: 1
// left_handed = If true, the gear returned will have a left-handed spiral. Default: false // left_handed = If true, the gear returned will have a left-handed spiral. Default: false
// pressure_angle = Controls how straight or bulged the tooth sides are. In degrees. Default: 28 // pressure_angle = Controls how straight or bulged the tooth sides are. In degrees. Default: 20
// backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle. Default: 0 // backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle. Default: 0
// clearance = Clearance gap at the bottom of the inter-tooth valleys. // clearance = Clearance gap at the bottom of the inter-tooth valleys.
// slices = The number of vertical slices to refine the curve of the worm throat. Default: 10 // slices = The number of vertical slices to refine the curve of the worm throat. Default: 10
@ -1093,7 +1093,7 @@ function worm_gear(
worm_arc = 60, worm_arc = 60,
crowning = 1, crowning = 1,
left_handed = false, left_handed = false,
pressure_angle = 28, pressure_angle = 20,
backlash = 0, backlash = 0,
clearance, clearance,
slices = 10, slices = 10,
@ -1101,12 +1101,14 @@ function worm_gear(
spin = 0, spin = 0,
orient = UP orient = UP
) = ) =
assert(worm_arc >= 10 && worm_arc <= 60)
let( let(
p = pitch_radius(pitch, teeth), p = pitch_radius(pitch, teeth),
circ = 2 * PI * p, circ = 2 * PI * p,
r1 = p + worm_diam/2 + crowning, r1 = p + worm_diam/2 + crowning,
r2 = worm_diam/2 + crowning, r2 = worm_diam/2 + crowning,
lead_ang = atan2(pitch * worm_starts, PI * worm_diam), thickness = worm_gear_thickness(pitch=pitch, teeth=teeth, worm_diam=worm_diam, worm_arc=worm_arc, crowning=crowning, clearance=clearance),
helical = pitch * worm_starts * worm_arc / 360 * 360 / circ,
tooth_profile = reverse(gear_tooth_profile( tooth_profile = reverse(gear_tooth_profile(
pitch = pitch, pitch = pitch,
teeth = teeth, teeth = teeth,
@ -1121,20 +1123,20 @@ function worm_gear(
u = slice/slices - 0.5, u = slice/slices - 0.5,
zang = u * worm_arc, zang = u * worm_arc,
tp = [0,r1,0] - spherical_to_xyz(r2, 90, 90+zang), tp = [0,r1,0] - spherical_to_xyz(r2, 90, 90+zang),
zang2 = 360 * tp.z * tan(lead_ang) / circ zang2 = u * helical
) [ ) [
for (i = [0:1:teeth]) each for (i = [0:1:teeth]) each
apply( apply(
zrot(-i*360/teeth+zang2) * zrot(-i*360/teeth+zang2) *
move(tp) * move(tp) *
xrot(-zang), xrot(-zang) *
scale(cos(zang)),
path3d(tooth_profile) path3d(tooth_profile)
) )
] ]
], ],
top_verts = select(profiles,-1), top_verts = select(profiles,-1),
bot_verts = select(profiles,0), bot_verts = select(profiles,0),
thickness = top_verts[0].z - bot_verts[0].z,
face_pts = len(tooth_profile), face_pts = len(tooth_profile),
gear_pts = face_pts * teeth, gear_pts = face_pts * teeth,
top_faces =[ top_faces =[
@ -1147,7 +1149,7 @@ function worm_gear(
[gear_pts, ((i+1)%teeth)*face_pts, (i+1)*face_pts-1] [gear_pts, ((i+1)%teeth)*face_pts, (i+1)*face_pts-1]
] ]
], ],
sides_vnf = vnf_vertex_array(profiles, caps=false, col_wrap=true, style="alt"), sides_vnf = vnf_vertex_array(profiles, caps=false, col_wrap=true, style="quincunx"),
vnf1 = vnf_merge([ vnf1 = vnf_merge([
[ [
[each top_verts, [0,0,top_verts[0].z]], [each top_verts, [0,0,top_verts[0].z]],
@ -1171,7 +1173,7 @@ module worm_gear(
worm_arc = 60, worm_arc = 60,
crowning = 1, crowning = 1,
left_handed = false, left_handed = false,
pressure_angle = 28, pressure_angle = 20,
backlash = 0, backlash = 0,
slices = 10, slices = 10,
clearance, clearance,

View file

@ -8,7 +8,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,456]; BOSL_VERSION = [2,0,457];
// Section: BOSL Library Version Functions // Section: BOSL Library Version Functions