// subframe.scad: // (c) Simon Brooke 2025; CC-BY-SA include include include include module subframe_cycleparts(rim=451, chainring_teeth=82, crank=140) { // wheel translate([0, 382, 93]) rotate([0, 90, 0]) wheel(iso=rim); translate([-42, 382, 93]) rotate([0, 90, 0]) color("grey") sprocket(teeth=30, roller=7.9, pitch=12.7); rotate([90, 0, 90]) translate([660, 180, -40]) chainset( teeth=chainring_teeth, crank=crank); rotate([0,90,0]) translate([-60, 900, 24]) epicyclic(); rotate([0,90,0]) translate([-190, 900, -22]) motor(); } module aluminium_subframe (rim=451, chainring_teeth=82, crank=140) { // front leg (supports cross-shaft, epicyclic, motor translate([-25, 820, -50]) color("silver") cube([50, 25, 356]); // bottom bracket leg translate([-25, 680, -50]) color("silver") cube([50, 25, 413]); // wheel leg translate([-100, 345, -50]) rotate([0, 7, 0]) color("silver") cube([25, 75, 458]); // front upper translate([-25, 1100, 200]) rotate([70, 0, 0]) color("silver") cube([50, 25, 425]); // central upper translate([-25, 714, 343]) rotate([82, 0, 0]) color("silver") cube([50, 25, 529]); // rear leg translate([-25, 0, -50]) rotate([-20, 0, 0]) color("silver") cube([50, 25, 525]); // boltdown flange color("grey") translate([0, 0, -50]) linear_extrude(height=2.5) polygon([[-50, 0], [-100, 345], [-100, 415], [-50, 700], [-50, 850], [50, 850], [50, 625], [-40, 625], [-40, 150], [50, 150], [50, 1070], [50, 0]]); subframe_cycleparts(rim, chainring_teeth, crank); } /** * this is more or less right. The corners of the epicyclic/motor * bracket should be rounded, and there should be fillets along * every concave join between carbon parts */ module carbon_subframe(rim=451, chainring_teeth=82, crank=140) { translate([-25, 0, 0]) color("black", 0.9) difference() { rotate([90, 0, 90]) linear_extrude( height=50) polygon([[1020, 306], [680, 400], [150,408], [0, -50], [1020, -50]]); translate([-26, 382, 93]) rotate([90,0,90]) cylinder( h=100, r=rim * 0.61); translate([-26, 825, 25]) cube([150, 150, 200]); translate([-26, 625, 25]) cube([10, 200, 150]); } // wheel leg translate([-94, 345, -50]) rotate([0, 7, 0]) color("black") cube([25, 75, 458]); // epicyclic support color("black") translate([-47, 890, 25]) difference() { cube([140, 100, 200]); translate([2.5, -2.5, -2.5]) cube([135, 100, 205]); } // boltdown flange color("black") translate([0, 0, -50]) linear_extrude(height=2.5) polygon([[-50, 0], [-100, 345], [-100, 415], [-50, 700], [-50, 850], [50, 850], [50, 650], [-40, 650], [-40, 150], [50, 150], [50, 1070], [50, 0]]); subframe_cycleparts(rim, chainring_teeth, crank); } module subframe( structure="carbon", rim=451, chainring_teeth=82, crank=140) { if (structure == "carbon") { carbon_subframe(rim=rim, chainring_teeth=chainring_teeth, crank=crank); } else { aluminium_subframe(rim=rim, chainring_teeth=chainring_teeth, crank=crank); } } // subframe( structure="aluminium");