add worm_dist

This commit is contained in:
Adrian Mariano 2023-08-08 23:05:45 -04:00
parent 2b0ab111f1
commit ada1a2e3fc

View File

@ -2233,6 +2233,7 @@ module worm(
assert(is_finite(gear_spin)) assert(is_finite(gear_spin))
assert(is_finite(profile_shift) && abs(profile_shift)<1); assert(is_finite(profile_shift) && abs(profile_shift)<1);
helical = asin(starts * circ_pitch / PI / d); helical = asin(starts * circ_pitch / PI / d);
fda= echo(helical=helical);
trans_pitch = circ_pitch / cos(helical); trans_pitch = circ_pitch / cos(helical);
vnf = worm( vnf = worm(
circ_pitch=circ_pitch, circ_pitch=circ_pitch,
@ -2369,6 +2370,7 @@ function worm_gear(
pr = pitch_radius(circ_pitch, teeth,helical), pr = pitch_radius(circ_pitch, teeth,helical),
hob_rad = worm_diam / 2 + crowning, hob_rad = worm_diam / 2 + crowning,
thickness = worm_gear_thickness(circ_pitch=circ_pitch, teeth=teeth, worm_diam=worm_diam, worm_arc=worm_arc, crowning=crowning, clearance=clearance), thickness = worm_gear_thickness(circ_pitch=circ_pitch, teeth=teeth, worm_diam=worm_diam, worm_arc=worm_arc, crowning=crowning, clearance=clearance),
dfda=echo("------->"),
tooth_profile = _gear_tooth_profile( tooth_profile = _gear_tooth_profile(
circ_pitch=circ_pitch, circ_pitch=circ_pitch,
teeth=teeth, teeth=teeth,
@ -2379,6 +2381,7 @@ function worm_gear(
profile_shift=profile_shift, profile_shift=profile_shift,
center=true center=true
), ),
feeg=echo("<----------"),
tbot = min(column(tooth_profile,1)), tbot = min(column(tooth_profile,1)),
arcthick = hob_rad * sin(worm_arc/2) * 2, arcthick = hob_rad * sin(worm_arc/2) * 2,
twist = sin(helical)*arcthick / (2*PI*pr) * 360, twist = sin(helical)*arcthick / (2*PI*pr) * 360,
@ -2566,6 +2569,7 @@ function _gear_tooth_profile(
prad = pitch_radius(circ_pitch, teeth, helical=helical), prad = pitch_radius(circ_pitch, teeth, helical=helical),
brad = _base_radius(circ_pitch, teeth, pressure_angle, helical=helical), brad = _base_radius(circ_pitch, teeth, pressure_angle, helical=helical),
rrad = _root_radius(circ_pitch, teeth, clearance, helical=helical, profile_shift=profile_shift, internal=internal), rrad = _root_radius(circ_pitch, teeth, clearance, helical=helical, profile_shift=profile_shift, internal=internal),
fgdg= echo(pitchrad=prad,outerrad=arad,rootrad=rrad),
srad = max(rrad,brad), srad = max(rrad,brad),
tthick = circ_pitch/PI / cos(helical) * (PI/2 + 2*profile_shift * tan(pressure_angle)) + (internal?backlash:-backlash), tthick = circ_pitch/PI / cos(helical) * (PI/2 + 2*profile_shift * tan(pressure_angle)) + (internal?backlash:-backlash),
@ -3153,12 +3157,42 @@ function worm_gear_thickness(circ_pitch, teeth, worm_diam, worm_arc=60, crowning
) thickness; ) thickness;
// Function: worm_dist()
// Synopsis: Returns the distance between a worm and a worm gear
// Topics: Gears, Parts
// See Also: worm(), worm_gear(), pitch_radius(), outer_radius()
// Usage:
// dist = worm_dist(mod=|diam_pitch=|circ_pitch=, d, starts, teeth, [profile_shift], [pressure_angle=]);
// Description:
// Calculate the distance between the centers of a worm and its mating worm gear, taking account
// possible profile shifting of the worm gear.
// Arguments:
// d = diameter of worm
// starts = number of starts of worm
// teeth = number of teeth on worm gear
// profile_shift = profile shift of worm gear
// ---
// mod = The metric module/modulus of the gear, or mm of pitch diameter per tooth.
// diam_pitch = The diametral pitch, or number of teeth per inch of pitch diameter. Note that the diametral pitch is a completely different thing than the pitch diameter.
// circ_pitch = distance between teeth around the pitch circle.
// pressure_angle = The pressure angle of the gear.
function worm_dist(d,starts,teeth,mod,profile_shift=0,diam_pitch,circ_pitch,pressure_angle=20) =
let(
mod = module_value(mod=mod,diam_pitch=diam_pitch,circ_pitch=circ_pitch),
lead_angle = asin(mod*starts/d),
pitch_diam = mod*teeth/cos(lead_angle)
)
(d+pitch_diam)/2 + profile_shift*mod;
// Function: gear_dist() // Function: gear_dist()
// Synopsis: Returns the distance between two gear centers for spur gears or parallel axis helical gears. // Synopsis: Returns the distance between two gear centers for spur gears or parallel axis helical gears.
// Topics: Gears, Parts // Topics: Gears, Parts
// See Also: worm(), worm_gear(), pitch_radius(), outer_radius() // See Also: worm(), worm_gear(), pitch_radius(), outer_radius()
// Usage: // Usage:
// dist = gear_dist(mod=|diam_pitch=|circ_pitch=, teeth1, teeth2, [helical], [profile_shift1], [profile_shift2], [pressure_angle=]); // dist = gear_dist(mod=|diam_pitch=|circ_pitch=, teeth1, teeth2, [helical], [profile_shift1], [profile_shift2], [pressure_angle=], [backlash=]);
// Description: // Description:
// Calculate the distance between the centers of two spur gears gears or helical gears with parallel axes, // Calculate the distance between the centers of two spur gears gears or helical gears with parallel axes,
// taking into account profile shifting and helical angle. You can give the helical angle as either positive or negative. // taking into account profile shifting and helical angle. You can give the helical angle as either positive or negative.