// chainset.scad // (c) Simon Brooke 2025; CC-BY-SA // Derived from Hampus Andersson's Sprocket Generator include include include function sprocket_radius(teeth=52, roller=7.9, pitch=12.7) = let(roller_radius = roller/2, radius = pitch/(2*sin(180/teeth))) sqrt((radius*radius) - (pitch*(roller_radius+tolerance))+((roller_radius+tolerance)*(roller_radius+tolerance))); module chainring( teeth=52, roller=7.9, pitch=12.7) { radius = sprocket_radius(teeth=teeth, roller=roller, pitch=pitch); echo( "Radius=", radius, "mm"); difference() { color("grey") sprocket( teeth=teeth, roller=roller, pitch=pitch); translate([0, 0, -10]) cylinder(h=20, r=radius*.75); } } module spider(radius, arms) { for(i=[0:1:5]) rotate([0,90,i*(360/5)]) color("grey") prismoid(size1=[7, radius/5], size2=[5, radius/7], height=radius*.9); } module chainset(teeth=53, arms=5, crank=172, bbshell=68) { radius = sprocket_radius(teeth=teeth); chainring(teeth=teeth); spider(radius*.9, 5); // cranks rotate([0, 90, 0]) translate([6, 0, -10]) color("grey") prismoid(size1=[10, 25], size2=[7, 18], h=crank+20); rotate([0, 90, 180]) translate([0 - (12+bbshell), 0, -10]) color("grey") prismoid(size1=[10, 25], size2=[7, 18], h=crank +20); // pedals translate([0-crank, 0, 20 + bbshell]) pedal(); translate([crank, 0, 0-4]) mirror([0, 0, 1]) pedal(); translate([0, 0, 5]) color("black") cylinder(h=bbshell, r=17); translate([0, 0, -5]) color("black") cylinder(h= bbshell+20, r=6); } // chainring(); // spider(90, 1); chainset(teeth=82, crank=140);