Merge branch 'revarbat_dev' of github.com:BelfrySCAD/BOSL2 into revarbat_dev

This commit is contained in:
Revar Desmera 2023-09-02 20:33:39 -07:00
commit 8ed195013f

View file

@ -2521,7 +2521,7 @@ module enveloping_worm(
// teeth = Total number of teeth along the rack. Default: 30 // teeth = Total number of teeth along the rack. Default: 30
// worm_diam = The pitch diameter of the worm gear to match to. Default: 30 // worm_diam = The pitch diameter of the worm gear to match to. Default: 30
// worm_starts = The number of lead starts on the worm gear to match to. Default: 1 // worm_starts = The number of lead starts on the worm gear to match to. Default: 1
// 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: 45 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 fit 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 fit 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: 20 // pressure_angle = Controls how straight or bulged the tooth sides are. In degrees. Default: 20
@ -2580,7 +2580,7 @@ function worm_gear(
teeth, teeth,
worm_diam, worm_diam,
worm_starts=1, worm_starts=1,
worm_arc=60, worm_arc=45,
crowning=0.1, crowning=0.1,
left_handed=false, left_handed=false,
pressure_angle, pressure_angle,
@ -2592,6 +2592,7 @@ function worm_gear(
pitch, pitch,
diam_pitch, diam_pitch,
mod, mod,
get_thickness=false,
anchor=CTR, anchor=CTR,
spin=0, spin=0,
orient=UP orient=UP
@ -2654,20 +2655,29 @@ function worm_gear(
zs = column(flatten(rows),2), zs = column(flatten(rows),2),
minz = min(zs), minz = min(zs),
maxz = max(zs), maxz = max(zs),
zmax = max(abs(minz), abs(max(zs)))+0.1, zmax = max(abs(minz), abs(maxz))+0.1,
twang = modang(v_theta(rows[0][0]) - v_theta(last(rows[0]))) / (maxz-minz), twang = modang(v_theta(rows[0][0]) - v_theta(last(rows[0]))) / (maxz-minz),
tip_pt1 = rows[ftl/2][0], midrow = len(rows)/2,
tip_pt2 = rows[ftl/2+1][0] goodcols = [
) for (i = idx(rows[0]))
assert(tip_pt1.x < tip_pt2.x, "worm_arc is too large to make a viable worm gear tooth geometry.")
let( let(
p1 = rows[midrow-1][i],
p2 = rows[midrow][i]
)
if (p1.y > p2.y) i
],
dowarn = goodcols[0]==0? 0 : echo("Worm gear tooth arc reduced to fit."),
truncrows = [for (row = rows) [ for (i=goodcols) row[i] ] ],
tooth_rows = [ tooth_rows = [
for (row = rows) [ for (row = truncrows) [
zrot(twang*(zmax-row[0].z), p=[row[0].x, row[0].y, zmax]), zrot(twang*(zmax-row[0].z), p=[row[0].x, row[0].y, zmax]),
each row, each row,
zrot(twang*(-zmax-last(row).z), p=[last(row).x, last(row).y, -zmax]), zrot(twang*(-zmax-last(row).z), p=[last(row).x, last(row).y, -zmax]),
], ],
], ]
)
get_thickness? zmax*2 :
let(
gear_rows = [ gear_rows = [
for (i = [0:1:teeth-1]) for (i = [0:1:teeth-1])
let( let(
@ -3367,7 +3377,7 @@ function bevel_pitch_angle(teeth, mate_teeth, drive_angle=90) =
// teeth = Total number of teeth along the rack. Default: 30 // teeth = Total number of teeth along the rack. Default: 30
// worm_diam = The pitch diameter of the worm gear to match to. Default: 30 // worm_diam = The pitch diameter of the worm gear to match to. Default: 30
// --- // ---
// 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: 45 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 fit 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 fit the work easier. Default: 1
// clearance = Clearance gap at the bottom of the inter-tooth valleys. Default: module/4 // clearance = Clearance gap at the bottom of the inter-tooth valleys. Default: module/4
// mod = The metric module/modulus of the gear, or mm of pitch diameter per tooth. // mod = The metric module/modulus of the gear, or mm of pitch diameter per tooth.
@ -3376,13 +3386,23 @@ function bevel_pitch_angle(teeth, mate_teeth, drive_angle=90) =
// thick = worm_gear_thickness(circ_pitch=5, teeth=36, worm_diam=30); // thick = worm_gear_thickness(circ_pitch=5, teeth=36, worm_diam=30);
// thick = worm_gear_thickness(mod=2, teeth=28, worm_diam=25); // thick = worm_gear_thickness(mod=2, teeth=28, worm_diam=25);
// Example(2D): // Example(2D):
// circ_pitch = 5; teeth=17; // circ_pitch = 5;
// worm_diam = 30; starts=2; // teeth = 17;
// y = worm_gear_thickness(circ_pitch=circ_pitch, teeth=teeth, worm_diam=worm_diam); // worm_diam = 30;
// #worm_gear( // worm_starts = 2;
// circ_pitch=circ_pitch, teeth=teeth, // worm_arc = 40;
// y = worm_gear_thickness(
// circ_pitch=circ_pitch,
// teeth=teeth,
// worm_diam=worm_diam, // worm_diam=worm_diam,
// worm_starts=starts, // worm_arc=worm_arc
// );
// #worm_gear(
// circ_pitch=circ_pitch,
// teeth=teeth,
// worm_diam=worm_diam,
// worm_arc=worm_arc,
// worm_starts=worm_starts,
// orient=BACK // orient=BACK
// ); // );
// color("black") { // color("black") {
@ -3390,15 +3410,27 @@ function bevel_pitch_angle(teeth, mate_teeth, drive_angle=90) =
// stroke([[-20,-y/2],[-20,y/2]],width=0.5,endcaps="arrow"); // stroke([[-20,-y/2],[-20,y/2]],width=0.5,endcaps="arrow");
// } // }
function worm_gear_thickness(circ_pitch, teeth, worm_diam, worm_arc=60, crowning=1, clearance, diam_pitch, mod, pitch) = function worm_gear_thickness(
let( circ_pitch,
teeth,
worm_diam,
worm_arc=45,
crowning=0.1,
clearance,
diam_pitch,
mod,
pitch
) = let(
circ_pitch = circular_pitch(pitch, mod, circ_pitch, diam_pitch), circ_pitch = circular_pitch(pitch, mod, circ_pitch, diam_pitch),
r = worm_diam/2 + crowning, thickness = worm_gear(
pitch_thick = r * sin(worm_arc/2) * 2, circ_pitch=circ_pitch,
pr = pitch_radius(circ_pitch, teeth), teeth=teeth,
rr = _root_radius(circ_pitch, teeth, clearance, false), worm_diam=worm_diam,
pitchoff = (pr-rr) * sin(worm_arc/2), worm_arc=worm_arc,
thickness = pitch_thick + 2*pitchoff crowning=crowning,
clearance=clearance,
get_thickness=true
)
) thickness; ) thickness;