Merge pull request #1234 from adrianVmariano/master

ring gear reverse & doc fixes
This commit is contained in:
Revar Desmera 2023-07-31 20:07:07 -07:00 committed by GitHub
commit 22aaebb276
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -97,7 +97,7 @@ function _inherit_gear_thickness(thickness) =
// Figure(3D,Med,NoAxes,VPT=[4.62654,-1.10349,0.281802],VPR=[55,0,25],VPD=236.957): Involute Spur Gear
// spur_gear(mod=5,teeth=18,pressure_angle=20,thickness=25,shaft_diam=15);
// Continues:
// The term "involute" refers to the shape of the teeth: the curves of the teeth involutes of circles,
// The term "involute" refers to the shape of the teeth: the curves of the teeth are involutes of circles,
// which are curves that optimize gear performance.
// Figure(2D,Med,NoAxes,VPT=[8,74,0],VPR=[0,0,0],VPD=150): The three marked circles are key references on gear teeth. The pitch circle, which is roughly in the middle of the teeth, is the reference used to define the pitch of teeth on the gear. The pressure angle is the angle the tooth makes with the pitch circle. In this example, the pressure angle is 20 degrees as shown by the red lines.
// $fn=128;
@ -134,7 +134,7 @@ function _inherit_gear_thickness(thickness) =
// are specified basic OpenSCAD units, so if you work in millimeters and want to give circular pitch in inches, be
// sure to multiply by `INCH`. The diametral pitch is given based on inches under the assumption that OpenSCAD units are millimeters.
// .
// Basic gears as shown above will mesh when their profile circles are tangent.
// Basic gears as shown above will mesh when their pitch circles are tangent.
// The critical requirements for two gears to mesh are that
// - The teeth are the same size
// - The pressure angles are identical
@ -173,7 +173,8 @@ function _inherit_gear_thickness(thickness) =
// }
// Continues:
// Another clearance requirement can present a serious problem when the number of teeth is low. As the gear rotates, the
// teeth may interfere with each other. This may require undercutting the gear teeth to create space, which weakens the teeth.
// teeth may interfere with each other. This may require undercutting the gear teeth to create space, which weakens the teeth.
// Is is best to avoid gears with very small numbers of teeth when possible.
// Figure(2D,Med,NoAxes,VPT=[0.042845,6.5338,-0.0144912],VPR=[0,0,0],VPD=126): The green gear with only five teeth has a severe undercut, which weakens its teeth. This undercut is necessary to avoid interference with the teeth from the other gear during rotation. Note that the yellow rack tooth is deep into the undercut space.
// ang=16;
// rack2d(mod=5, teeth=3, bottom=15, pressure_angle=14.5, rounding=0);
@ -189,8 +190,8 @@ function _inherit_gear_thickness(thickness) =
// still allowing the gear to mesh with unmodified gears. Profile shifting
// changes the diameter at which the gear meshes so it no longer meshes at the pitch circle.
// A profile shift of `x`
// will increase the mesh distance by approximately `x*m` where `m` is the gear module. The exact adjustment
// which you compute with {{gear_dist()}} is a complex calculation that depends on the profile shifts of both meshing gears. This means that profile shifting
// will increase the mesh distance by approximately `x*m` where `m` is the gear module. The exact adjustment,
// which you compute with {{gear_dist()}}, is a complex calculation that depends on the profile shifts of both meshing gears. This means that profile shifting
// can also be used to fine tune the spacing between gears. When the gear has many teeth a negative profile shift may
// be able to bring the gears slightly closer together, while still avoiding undercutting.
// Profile shifting also changes the effective pressure angle of the gear engagement.
@ -223,14 +224,31 @@ function _inherit_gear_thickness(thickness) =
// and quietly. A disadvantage of helical gears is that they have thrust along the axis of the gear that must be
// accomodated. Helical gears also have more sliding friction between the meshing teeth compared to spur gears.
// Figure(3D,Med,NoAxes,VPT=[3.5641,-7.03148,4.86523],VPR=[62.7,0,29.2],VPD=263.285): A Helical Gear
// spur_gear(mod=5,teeth=18,pressure_angle=20,thickness=35,helical=-29,shaft_diam=15);
// spur_gear(mod=5,teeth=18,pressure_angle=20,thickness=35,helical=-29,shaft_diam=15,slices=15);
// Continues:
// Helical gears have the same compatibility requirements as spur gears, with the additional requirement that
// the helical angles must be opposite each other, so a gear with a helical angle of 25 must mesh with one
// that has an angle of 25. The pitch circle of a helical gear is larger compared to a spur gear
// the helical angles must be opposite each other, so a gear with a helical angle of 35 must mesh with one
// that has an angle of 35. The industry convention refers to these as left-handed and right handed. In
// this library, positive helical angles produce a left handed gear and negative angles produce a right handed gear.
// Figure(3D,Med,NoAxes,VPT=[73.6023,-29.9518,-12.535],VPR=[76,0,1.2],VPD=550.777): Left and right handed helical gears at 35 degrees.
// spur_gear(mod=5, teeth=20, helical=35, thickness=70,slices=15);
// right(150)
// spur_gear(mod=5, teeth=20, helical=-35, thickness=70,slices=15);
// down(22)
// left(60)
// fwd(220)
// rot($vpr)
// color("black")text3d("left handed right handed",size=18);
// down(52)
// left(55)
// fwd(220)
// rot($vpr)
// color("black")text3d("helical=35 helical=35",size=18);
// Continues:
// The pitch circle of a helical gear is larger compared to a spur gear
// by the cosine of the helical angle, so you cannot simply drop helical gears in to replace spur gears without
// making other adjustments. This dependence does allow you to make
// make much bigger spacing adjustments than are possible with profile shifting---without changing the tooth count.
// make much bigger spacing adjustments than are possible with profile shiftingwithout changing the tooth count.
// The {{gear_dist()}} function will also compute the appropriate gear spacing for helical gears.
// The effective pressure angle of helical gears is larger than the nominal pressure angle. This can make it possible
// to avoid undercutting without having to use profile shifting, so smaller tooth count gears can be more effective
@ -243,7 +261,7 @@ function _inherit_gear_thickness(thickness) =
// zrot(-$t*360/18)
// spur_gear(mod=5, teeth=18, pressure_angle=20, thickness=25, helical=29, shaft_diam=15);
// Continues:
// Helical gears can mesh in a second manner that is different from spur gears at skew, or crossed axis. These are also
// Helical gears can mesh in a second manner that is different from spur gears: they can turn on skew, or crossed axes. These are also
// sometimes called "screw gears". The general requirement for two non-profile-shifted helical gears to mesh is that the angle
// between the gears' axes must equal the sum of the helical angles of the two gears, thus for parallel axes, the helical
// angles must sum to zero. If helical gears are profile shifted, then in addition to adjusting the distance between the
@ -270,27 +288,16 @@ function _inherit_gear_thickness(thickness) =
// Subsection: Ring Gears (Internal Gears)
// A ring gear (or internal gear) is a gear where the teeth are on the inside of a circle. Such gears must be mated
// to a regular (external) gear, which rotates around the inside.
// Figure(2D,Med,NoAxes,VPT=[0.491171,1.07815,0.495977],VPD=292.705): A interior or ring gear (yellow) with a mating spur gear (blue)
// teeth1=18;
// teeth2=30;
// ps1=undef;
// ps2=auto_profile_shift(teeth=teeth1);
// mod=3;
// d = gear_dist(mod=mod, teeth1=teeth1, teeth2=teeth2,profile_shift1=ps1, profile_shift2=ps2,helical=0, internal2=true);
// ang = 0;
// ring_gear2d(mod=mod, teeth=teeth2,profile_shift=ps2,helical=0,backing=4);
// zrot(ang*360/teeth2)
// color("lightblue")
// fwd(d)
// spur_gear2d(mod=mod, teeth=teeth1, profile_shift=ps1,gear_spin=-ang*360/teeth1,helical=0);
// Figure(3D,Med,NoAxes,VPT=[10.3822,-19.892,16.1929],VPR=[55.7,0,30.6],VPD=401.516): A interior or ring gear
// ring_gear(mod=5, teeth=35,thickness=25,$fn=128);
// Continues:
// Ring gears are subject to all the usual mesh requirements: the teeth must be the same size, the pressure angles must
// match and they must have the same helical angle. The {{gear_dist()}} function can give the center separation of
// a ring gear and its mating spur gear. But they also have additional complications that tend to arise when the number of
// match and they must have opposite helical angles. The {{gear_dist()}} function can give the center separation of
// a ring gear and its mating spur gear. Ring gears have additional complications that tend to arise when the number of
// teeth is small or the teeth counts of the ring gear and spur gear are too close together. The mating spur gear must
// have few enough teeth so that the teeth don't interfere on the other side of the ring. Very small spur gears can interfere
// on the tips of the ring gear's teeth.
// Figure(2D,Med,NoAxes,VPT=[-1.16111,0.0525612,0.495977],VPD=213.382): The red regions show interference between the two gears: the 18 tooth spur gear does not fit inside the 20 tooth ring gear.
// Figure(2D,Med,NoAxes,VPR=[0,0,0],VPT=[-1.16111,0.0525612,0.495977],VPD=213.382): The red regions show interference between the two gears: the 18 tooth spur gear does not fit inside the 20 tooth ring gear.
// teeth1=18;
// teeth2=20;
// ps1=undef;
@ -355,7 +362,20 @@ function _inherit_gear_thickness(thickness) =
// fwd(d)
// spur_gear2d(mod=mod, teeth=teeth1, profile_shift=ps1,gear_spin=-ang*360/teeth1,helical=0);
// }
// Figure(3D,Med,NoAxes,VPT=[2.48983,2.10149,0.658081],VPR=[70.4,0,123],VPD=237.091): A helical ring gear (yellow) mating with the compatible spur gear (blue)
// $fn=128;
// teeth1=18;
// teeth2=30;
// ps1=undef;
// ps2=auto_profile_shift(teeth=teeth1);
// mod=3;
// d = gear_dist(mod=mod, teeth1=teeth1, teeth2=teeth2,profile_shift1=ps1, profile_shift2=ps2,helical=30, internal2=true);
// ang = 0;
// ring_gear(mod=mod, teeth=teeth2,profile_shift=ps2,backing=4,helical=30,thickness=15);
// zrot(ang*360/teeth2)
// color("lightblue")
// fwd(d)
// spur_gear(mod=mod, teeth=teeth1, profile_shift=ps1,gear_spin=-ang*360/teeth1,helical=-30,thickness=15);
// Section: Gears
@ -509,7 +529,7 @@ function _inherit_gear_thickness(thickness) =
// shaft_diam=5, helical=ang2, slices=12,
// gear_spin=90-180/n
// );
// Example(Anim,Med,NoAxes,Frames=36,VPT=[0,0,0],VPR=[55,0,25],VPD=375): Planetary Gear Assembly
// Example(Anim,Big,NoAxes,Frames=36,VPT=[0,0,0],VPR=[55,0,25],VPD=375): Planetary Gear Assembly
// rteeth=56; pteeth=16; cteeth=24;
// circ_pitch=5; thick=10; pa=20;
// gd = gear_dist(circ_pitch=circ_pitch, cteeth, pteeth);
@ -1001,7 +1021,7 @@ module ring_gear(
) {
circ_pitch = _inherit_gear_pitch("ring_gear()",pitch, circ_pitch, diam_pitch, mod);
PA = _inherit_gear_pa(pressure_angle);
helical = _inherit_gear_helical(helical);
helical = _inherit_gear_helical(helical); //Maybe broken???
thickness = _inherit_gear_thickness(thickness);
checks =
assert(is_finite(profile_shift), "Profile shift for ring gears must be numerical")
@ -1032,7 +1052,7 @@ module ring_gear(
ar+backing
: 2*ar - rr; // default case
circum = 2 * PI * pr;
twist = 360*thickness*tan(helical)/circum;
twist = 360*thickness*tan(-helical)/circum;
slices = default(slices, ceil(twist/360*segs(pr)+1));
attachable(anchor,spin,orient, h=thickness, r=pr) {
zrot(gear_spin)
@ -1115,7 +1135,7 @@ module ring_gear(
// ring_gear2d(circ_pitch=circ_pitch, teeth=teeth1);
// color("lightblue")back(dist)
// spur_gear2d(circ_pitch=circ_pitch, teeth=teeth2);
// Example(2D,Med,VPT=[-0.117844,-0.439102,-0.372203],VPD=192.044): Meshing a ring gear with an auto-profile-shifted spur gear:
// Example(2D,Med,VPT=[-0.117844,-0.439102,-0.372203],VPR=[0,0,0],VPD=192.044): Meshing a ring gear with an auto-profile-shifted spur gear:
// teeth1=7; teeth2=15;
// ps1=undef; // Allow auto profile shifting for first gear
// ps2=auto_profile_shift(teeth=teeth1);
@ -2715,6 +2735,7 @@ function _adendum(
mod * (1 + profile_shift);
/// Function: _dedendum()
/// Usage:
/// ddn = _dedendum(circ_pitch=, [clearance], [profile_shift]);
@ -2780,7 +2801,7 @@ function _dedendum(
// pr = pitch_radius(diam_pitch=10, teeth=11);
// pr = pitch_radius(mod=2, teeth=20);
// pr = pitch_radius(mod=2, teeth=20, helical=30);
// Example(2D,Med,NoScales):
// Example(2D,Med,NoScales,VPT=[-0.20531,0.133721,0.658081],VPR=[0,0,0],VPD=82.6686):
// $fn=144;
// teeth=17; circ_pitch = 5;
// pr = pitch_radius(circ_pitch, teeth);
@ -2834,7 +2855,7 @@ function pitch_radius(
// or = outer_radius(circ_pitch=5, teeth=20, helical=30);
// or = outer_radius(diam_pitch=10, teeth=17);
// or = outer_radius(mod=2, teeth=16);
// Example(2D,Med,NoScales):
// Example(2D,Med,NoScales,VPT=[-0.20531,0.133721,0.658081],VPR=[0,0,0],VPD=82.6686):
// $fn=144;
// teeth=17; circ_pitch = 5;
// or = outer_radius(circ_pitch, teeth);
@ -3042,32 +3063,32 @@ function worm_gear_thickness(circ_pitch, teeth, worm_diam, worm_arc=60, crowning
// internal2 = second gear is an internal (ring) gear. Default: false
// circ_pitch = distance between teeth around the pitch circle.
// pressure_angle = The pressure angle of the gear.
// Example(2D): Spur gears (with automatic profile shifting on both)
// Example(2D,NoAxes): Spur gears (with automatic profile shifting on both)
// circ_pitch=5; teeth1=7; teeth2=24;
// d = gear_dist(circ_pitch=circ_pitch, teeth1, teeth2);
// spur_gear2d(circ_pitch, teeth1, gear_spin=-90);
// right(d) spur_gear2d(circ_pitch, teeth2, gear_spin=90-180/teeth2);
// Example: Helical gears (with auto profile shifting on one of the gears)
// Example(3D,NoAxes,Med,VPT=[23.9049,5.42594,-4.68026],VPR=[64.8,0,353.5],VPD=126): Helical gears (with auto profile shifting on one of the gears)
// circ_pitch=5; teeth1=7; teeth2=24; helical=37;
// d = gear_dist(circ_pitch=circ_pitch, teeth1, teeth2, helical);
// spur_gear(circ_pitch, teeth1, helical=helical, gear_spin=-90);
// right(d) spur_gear(circ_pitch, teeth2, helical=-helical, gear_spin=-90-180/teeth2);
// Example(2D): Disable Auto Profile Shifting on the smaller gear
// spur_gear(circ_pitch, teeth1, helical=helical, gear_spin=-90,slices=15);
// right(d) spur_gear(circ_pitch, teeth2, helical=-helical, gear_spin=-90-180/teeth2,slices=9);
// Example(2D,NoAxes): Disable Auto Profile Shifting on the smaller gear
// circ_pitch=5; teeth1=7; teeth2=24;
// d = gear_dist(circ_pitch=circ_pitch, teeth1, teeth2, profile_shift1=0);
// spur_gear2d(circ_pitch, teeth1, profile_shift=0, gear_spin=-90);
// right(d) spur_gear2d(circ_pitch, teeth2, gear_spin=90-180/teeth2);
// Example(2D): Manual Profile Shifting
// Example(2D,NoAxes): Manual Profile Shifting
// circ_pitch=5; teeth1=7; teeth2=24; ps1 = 0.5; ps2 = -0.2;
// d = gear_dist(circ_pitch=circ_pitch, teeth1, teeth2, profile_shift1=ps1, profile_shift2=ps2);
// spur_gear2d(circ_pitch, teeth1, profile_shift=ps1, gear_spin=-90);
// right(d) spur_gear2d(circ_pitch, teeth2, profile_shift=ps2, gear_spin=90-180/teeth2);
// Example(2D): Profile shifted gear and a rack
// Example(2D,NoAxes): Profile shifted gear and a rack
// mod=3; teeth=8;
// d = gear_dist(mod=mod, teeth, 0);
// rack2d(mod=mod, teeth=5, bottom=9);
// back(d) spur_gear2d(mod=mod, teeth=teeth, gear_spin=180/teeth);
// Example(VPT=[-0.0608489,1.3772,-3.68839],VPR=[63.4,0,29.7],VPD=113.336): Profile shifted helical gear and rack
// Example(3D,Med,NoAxes,VPT=[-0.0608489,1.3772,-3.68839],VPR=[63.4,0,29.7],VPD=113.336): Profile shifted helical gear and rack
// mod=3; teeth=8; helical=29;
// d = gear_dist(mod=mod, teeth, 0, helical);
// rack(mod=mod, teeth=5, helical=helical, orient=FWD);
@ -3167,7 +3188,7 @@ function _working_pressure_angle(teeth1,profile_shift1, teeth2, profile_shift2,
// mod = The metric module/modulus of the gear, or mm of pitch diameter per tooth.
// circ_pitch = distance between teeth around the pitch circle.
// pressure_angle = The pressure angle of the gear.
// Example(3D): Non-parallel Helical Gears (without any profile shifting)
// Example(3D,Med,NoAxes,VPT=[-0.302111,3.7924,-9.252],VPR=[55,0,25],VPD=155.556): Non-parallel Helical Gears (without any profile shifting)
// circ_pitch=5; teeth1=15; teeth2=24; ha1=45; ha2=30; thick=10;
// d = gear_dist_skew(circ_pitch=circ_pitch, teeth1, teeth2, helical1=ha1, helical2=ha2);
// left(d/2) spur_gear(circ_pitch, teeth1, helical=ha1, thickness=thick, gear_spin=-90);