Skip to content

Instantly share code, notes, and snippets.

@ednisley
Created December 3, 2025 22:00
Show Gist options
  • Select an option

  • Save ednisley/b958ed086f509a253f4d0bb0de4432d7 to your computer and use it in GitHub Desktop.

Select an option

Save ednisley/b958ed086f509a253f4d0bb0de4432d7 to your computer and use it in GitHub Desktop.
OpenSCAD source code: Stacked change gear generator for mini-lathe
// LMS Mini-Lathe
// Change gears with stacking
// Ed Nisley - KE4ZNU
// 2020-05 use Inkscape SVG gears
// 2025-12 use BOSL2 gear generator
include <BOSL2/std.scad>
include <BOSL2/gears.scad>
/* [Gears] */
TopGear = 0; // zero for single gear
BottomGear = 28;
/* [Hidden] */
ThreadThick = 0.20;
HoleWindage = 0.2;
Protrusion = 0.1; // make holes end cleanly
/* [Dimensions] */
ShaftOD = 12.0;
GearThick = 7.75;
Keyway = [3.5,3.0,3*GearThick]; // x on radius, y on perim
LegendEnable = (TopGear == 0 && BottomGear > 27) || (TopGear > 27);
LegendThick = 2*ThreadThick;
LegendZ = (TopGear ? 2*GearThick : GearThick) - LegendThick;
LegendSize = 5;
LegendRecess = [8,6,LegendThick];
LegendOffset = [0,LegendRecess.y/2 + ShaftOD/2 + HoleWindage,LegendZ + LegendRecess.z/2];
//-----------------------
// Build it!
union() {
difference() {
union() {
spur_gear(mod=1,teeth=BottomGear,thickness=GearThick,shaft_diam=ShaftOD + HoleWindage,anchor=BOTTOM);
if (TopGear)
spur_gear(mod=1,teeth=TopGear,thickness=2*GearThick,shaft_diam=ShaftOD + HoleWindage,anchor=BOTTOM);
}
right(ShaftOD/2)
down(Protrusion)
cube(Keyway,anchor=CENTER+BOTTOM);
if (LegendEnable) {
translate(LegendOffset)
cube(LegendRecess + [0,0,Protrusion],anchor=CENTER);
if (TopGear)
zrot(180)
translate(LegendOffset)
cube(LegendRecess + [0,0,Protrusion],anchor=CENTER);
}
}
if (LegendEnable)
translate([0,0,LegendZ - Protrusion])
linear_extrude(height=LegendThick + Protrusion,convexity=10) {
translate([LegendOffset.x,LegendOffset.y])
text(text=str(BottomGear),size=LegendSize,font="Arial:style:Bold",halign="center",valign="center");
if (TopGear)
zrot(180)
translate([LegendOffset.x,LegendOffset.y])
text(text=str(TopGear),size=LegendSize,font="Arial:style:Bold",halign="center",valign="center");
}
}
@ednisley
Copy link
Author

ednisley commented Dec 3, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment