sprocketed_roller/sprocketed_roller_var.scad

202 lines
7.5 KiB
OpenSCAD

include <./common/common.scad>;
SprocketBaseD = 19.05; //8 frames
SprocketBaseH = 2.7;
FrameC = (SprocketBaseD * PI) / 8;
SprocketH = 10;
SprocketW = 1;
SprocketL = 1.5;
InnerH = 10.6;
TopBaseD = 18.47;
TopBaseC = (TopBaseD * PI) / 8;
TopBaseH = 2.96;
LipD = 18.84;
LipH = 0.33;
LipC = (LipD * PI) / 8;
TopD = 21.66;
TopC = (TopD * PI) / 8;
TopH = 1.4;
motorShaftD = 6;
motorShaftHobble = 0.8;
$fn = 100;
module sprocket (pos = [0, 0, 0], rot = [0, 0, 0], bevel = false) {
translate (pos) rotate(rot) {
difference () {
translate([0, 0, 0]) scale([1, 1, 2.25]) rotate([90, 0, 90]) cylinder(r = SprocketW/2, h = SprocketL, center = true);
translate([0, 0, -1]) cube([2, 2, 2], center = true);
if (bevel) {
translate([1.75, 0, 0]) rotate([0, -8, 0]) cube([2, 2, 3], center = true);
translate([-1.75, 0, 0]) rotate([0, 8, 0]) cube([2, 2, 3], center = true);
}
}
}
}
module gearbox_motor_shaft (H = 16, pad = 0) {
difference () {
cylinder(r = R(motorShaftD) + pad, h = H, center = true, $fn = 60);
translate([motorShaftD - motorShaftHobble + pad, 0, 0]) cube([motorShaftD, motorShaftD, H + 1], center = true);
}
}
module gearbox_motor_shaft_void (H = 16) {
pad = 0.2;
gearbox_motor_shaft(H, pad);
}
module bearing_laser_void (x, y, z, width= 8, hole = true) {
innerD = 8.05;
outerD = 22.1 - .4;
fuzz = 0.3;
translate ([x, y, z]) {
difference () {
cylinder(r = (outerD / 2) + fuzz, h = width, center = true);
if (hole) {
cylinder(r = innerD / 2 - fuzz, h = width, center = true);
}
}
}
}
module m3_nut_void (pos = [0, 0, 0], rot = [0, 0, 0], H = 20) {
translate(pos) rotate(rot) {
translate([0, 6, -5 + (2.75/2)]) cube([6, 12, 3], center = true);
cylinder(r = R(3.25), h = H, center = true, $fn = 30);
translate([0, 0, -3.75]) hex(6, 3);
translate([0, 0, (H/2) - 4.5]) cylinder(r = R(6), h = 5, center = true, $fn = 40);
}
}
module m3_bolt_void (pos = [0, 0, 0]) {
translate(pos) {
cylinder(r = R(3.25), h = 40, center = true, $fn = 30);
translate([0, 0, 14]) cylinder(r = R(6), h = 5, center = true, $fn = 40);
}
}
module sprocketed_wheel_m3_nut_void (pos = [0, 0, 0]) {
translate(pos) {
cylinder(r = R(3.25), h = 40, center = true, $fn = 30);
hex(6.3, 4);
}
}
module sprocketed_roller_sprocket_wheel (pos = [0, 0, 0], rot = [0, 0, 0], sprockets = 8, D, bevel = false, bolts = false) {
translate(pos) rotate(rot) {
cylinder(r = R(D), h = SprocketBaseH, center = true);
translate([0, 0, -0.15]) {
for (i = [0: sprockets]) {
rotate([0, 0, i * 360 / sprockets]) sprocket([(D / 2) - .01, 0, (SprocketBaseH / 2) - (SprocketL / 2)], [0, 90, 0], bevel);
}
}
}
}
module sprocketed_roller_body (pos = [0, 0, 0], rot = [0, 0, 0], sprockets = 8, bevel = false, reinforced = false, bolts = false, adjust_base = 0) {
D = (FrameC * sprockets) / PI;
LipD = (LipC * sprockets) / PI;
TopD = (TopC * sprockets) / PI;
TopBaseD = (TopBaseC * sprockets) / PI;
InnerD = D - 5.07;
ReinforcedRegistration = (InnerD - 5) / 2;
ReinforcedRegistrationCorner = sqrt(pow(2.5, 2) + pow(2.5, 2));
BoltsY = ReinforcedRegistration + 12.5;
echo("Sprocketed Roller D", D);
echo("Sprocketed Roller Lip D", LipD);
echo("Sprocketed Roller Inner D", InnerD);
translate(pos) rotate(rot) difference() {
//top
union () {
if (!reinforced) {
sprocketed_roller_sprocket_wheel(sprockets = sprockets, D = D, bevel = bevel);
} else {
cube([ReinforcedRegistration + 5, ReinforcedRegistration, SprocketBaseH], center = true);
cube([ReinforcedRegistration, ReinforcedRegistration + 5, SprocketBaseH], center = true);
translate([(ReinforcedRegistration/2), (ReinforcedRegistration/2), 0]) rotate([0, 0, 45]) cube([ReinforcedRegistrationCorner, ReinforcedRegistrationCorner, SprocketBaseH], center = true);
}
//center
translate([0, 0, (InnerH / 2) + (SprocketBaseH / 2)]) {
cylinder(r = R(InnerD), h = InnerH, center = true);
}
//top lip
translate([0, 0, (TopBaseH / 2) + InnerH + (SprocketBaseH / 2) - (TopBaseH / 2) + (LipH / 2)]) {
cylinder(r = R(LipD), h = LipH, center = true);
}
//bottom lip
translate([0, 0, (TopBaseH / 2) + InnerH + (SprocketBaseH / 2)]) {
cylinder(r = R(TopBaseD), h = TopBaseH, center = true);
}
//base
translate([0, 0, (TopH / 2) + (TopBaseH / 2) + InnerH + (SprocketBaseH / 2) + (TopBaseH / 2) - (LipH / 2)]) {
cylinder(r = R(TopD + adjust_base), h = TopH, center = true);
}
}
if (reinforced && bolts) {
m3_bolt_void([0, BoltsY/2, 0]);
m3_bolt_void([0, -BoltsY/2, 0]);
}
}
}
module sprocketed_roller (pos = [0, 0, 0], rot = [0, 0, 0], sprockets = 8, bevel = false, reinforced = false, bolts = false, model = "", set_screw_side = true, set_screw_top = false, adjust_base = 0) {
D = (FrameC * sprockets) / PI;
difference () {
union () {
sprocketed_roller_body(pos = pos, rot = rot, sprockets = sprockets, bevel = bevel, reinforced = reinforced, bolts = bolts, adjust_base = adjust_base);
}
if (model == "gearbox_motor") {
translate(pos) rotate(rot) translate([0, 0, 10]) gearbox_motor_shaft_void();
if (set_screw_top) {
translate(pos) rotate(rot) rotate([180, 0, 0]) m3_bolt_void([0, 0, -11]);
}
if (set_screw_side) {
translate(pos) rotate(rot) m3_nut_void(pos=[D/4, 0, 8.5], rot = [90, 0, 90], H = D/2);
}
}
}
}
module sprocketed_roller_reinforced (pos = [0, 0, 0], rot = [0, 0, 0], sprockets = 8, bevel = true, model = "", bolts = false, nuts = false) {
D = (FrameC * sprockets) / PI;
InnerD = D - 5.07;
ReinforcedRegistration = (InnerD - 5) / 2;
BoltsY = ReinforcedRegistration + 12;
difference () {
sprocketed_roller_sprocket_wheel (pos = pos, rot = rot, sprockets = sprockets, D = D, bevel = bevel);
scale([1.01, 1.01, 1]) sprocketed_roller (pos = pos, rot = rot, sprockets = sprockets, bevel = bevel, reinforced = true, model = model);
if (nuts) {
sprocketed_wheel_m3_nut_void([0, BoltsY/2, -2]);
sprocketed_wheel_m3_nut_void([0, -BoltsY/2, -2]);
} else if (bolts) {
translate([0, 0, 11.5]) {
rotate([180, 0, 0]) m3_bolt_void([0, BoltsY/2, 0]);
rotate([180, 0, 0]) m3_bolt_void([0, -BoltsY/2, 0]);
}
}
}
}
LIBRARY = false;
PART = "sprocketed_wheel";
if (!LIBRARY && PART == "sprocketed_roller_reinforced") {
rotate([180, 0, 0]) sprocketed_roller(sprockets = 18, bevel = false, model = "gearbox_motor", reinforced = true, bolts = true, set_screw_top = true, set_screw_side = true);
} else if (!LIBRARY && PART == "sprocketed_roller_reinforced_8") {
rotate([180, 0, 0]) sprocketed_roller(sprockets = 8, bevel = false, model = "x", reinforced = true, bolts = false, set_screw_top = true, set_screw_side = false);
} else if (!LIBRARY && PART == "sprocketed_wheel") {
rotate([180, 0, 0]) color("red") sprocketed_roller_reinforced(sprockets = 18, bevel = true, model = "gearbox_motor", bolts = true);
}