OpenSCAD source code: Mini-lathe change gear generator with optional stacking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LMS Mini-Lathe | |
// Change gears with stacking | |
// Generate SVG outlines with Inkscape's Gear extension | |
// Ed Nisley - KE4ZNU | |
// 2020-05 | |
/* [Gears] */ | |
TopGear = 0; // zero for single gear | |
BottomGear = 42; | |
/* [Hidden] */ | |
ThreadThick = 0.25; | |
ThreadWidth = 0.40; | |
HoleWindage = 0.2; | |
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit); | |
Protrusion = 0.1; // make holes end cleanly | |
Dir = ""; // empty string for current directory | |
/* [Dimensions] */ | |
ShaftOD = 12.0; | |
ShaftSides = 4*3; | |
GearThick = 7.75; | |
Keyway = [3.5 + HoleWindage,3.0 + HoleWindage,3*GearThick]; // x on radius, y on perim, z on axis | |
LegendThick = 2*ThreadThick; | |
LegendZ = (TopGear ? 2*GearThick : GearThick) - LegendThick; | |
LegendRecess = [10,7,LegendThick]; | |
LegendEnable = (TopGear == 0 && BottomGear > 41) || (TopGear > 41); | |
//---------------------- | |
// Useful routines | |
// Enlarge holes to prevent geometric shrinkage | |
// based on nophead's polyholes | |
// http://hydraraptor.blogspot.com/2011/02/polyholes.html | |
// http://www.thingiverse.com/thing:6118 | |
module PolyCyl(Dia,Height,ForceSides=0) { | |
Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2); | |
FixDia = Dia / cos(180/Sides); | |
cylinder(r=(FixDia + HoleWindage)/2, | |
h=Height, | |
$fn=Sides); | |
} | |
//----------------------- | |
// Build it! | |
union() { | |
difference() { | |
union() { | |
linear_extrude(GearThick,center=false,convexity=5) | |
import(file=str(Dir,"Change Gear - ",BottomGear," teeth.svg"), | |
center=true); | |
if (TopGear) | |
translate([0,0,GearThick]) | |
linear_extrude(GearThick,center=false,convexity=5) | |
import(file=str(Dir,"Change Gear - ",TopGear," teeth.svg"), | |
center=true); | |
} | |
rotate(180/ShaftSides) | |
translate([0,0,-Protrusion]) | |
PolyCyl(ShaftOD,3*GearThick); | |
translate([ShaftOD/2,0,Keyway.z/2 - Protrusion]) | |
cube(Keyway,center=true); | |
if (LegendEnable) { | |
translate([0,1.1*ShaftOD,LegendZ + LegendRecess.z/2]) | |
cube(LegendRecess + [0,0,Protrusion],center=true); | |
if (TopGear) { | |
translate([0,-1.1*ShaftOD,LegendZ + LegendRecess.z/2]) | |
cube(LegendRecess + [0,0,Protrusion],center=true); | |
} | |
} | |
} | |
if (LegendEnable) | |
translate([0,0,LegendZ - Protrusion]) | |
linear_extrude(height=LegendThick + Protrusion,convexity=10) { | |
translate([-0*2.5,1.1*ShaftOD]) | |
rotate(-0*90) | |
text(text=str(BottomGear),size=5,font="Arial:style:Bold",halign="center",valign="center"); | |
if (TopGear) | |
translate([-0*2.5,-1.1*ShaftOD]) | |
rotate(-0*90) | |
text(text=str(TopGear),size=5,font="Arial:style:Bold",halign="center",valign="center"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More details on my blog at https://wp.me/poZKh-93z