/* Pinion chain protection */ /* Gates rim parameter */ DiameterFront=152; /* mm */ DiameterBack=109; /* mm */ CenterDistanceFrontBack=475; /* mm */ GateRimWidth=13; /* mm */ rimSpace=3; /* mm */ /* Pinon parameter */ pinionTop=106; /* mm */ pinionBottom=38; /* mm */ pinonHeight=98; /* mm */ pinionRotation=45; /* degrees */ pinionWith=50; /* mm (dummy value, not used) */ $fn=180; /* Bike Parameter */ bikeRearHorizontal=48; bikeRearRotation=99; bikeRearOffset=70; module drawRim(dBack, dFront, width) { hull() { translate([CenterDistanceFrontBack/2, 0, 0]) cylinder(d=dFront, h = width, center = true); translate([-CenterDistanceFrontBack/2, 0, 0]) cylinder(d=dBack, h = width, center = true); } } difference() { drawRim(dBack=DiameterBack+rimSpace*2, dFront=DiameterFront+rimSpace*2, width=GateRimWidth+rimSpace*2); union() { translate([0,0, rimSpace/2]) drawRim(dBack=DiameterBack, dFront=DiameterFront, width=GateRimWidth+rimSpace*2); translate([CenterDistanceFrontBack/2, 0, 0]) rotate([0, 0, pinionRotation]) translate([pinionBottom, 0, 0]) cube([pinionTop+pinionBottom, pinonHeight, pinionWith], center=true); translate([bikeRearOffset, 0, 0]) rotate([0, bikeRearRotation, 0]) cylinder(d=bikeRearHorizontal, h=CenterDistanceFrontBack, center=true); } }