Added pulleys, bom item listing

This commit is contained in:
2022-02-24 16:31:18 +01:00
parent 64d38acfb1
commit 11116136f2
4 changed files with 129 additions and 24 deletions

View File

@@ -1,3 +1,6 @@
include <MCAD/math.scad>;
include <lib.scad>;
stock_color = "#aaa4";
bushing_od = 12;
@@ -15,6 +18,7 @@ module colorize(colorname) {
}
module bushing() {
bom_item(printable=false, label="Bushing");
colorize(stock_color) render() {
difference() {
cylinder(d = bushing_od, h = bushing_len);
@@ -26,6 +30,7 @@ module bushing() {
// located with the shaft in +z, face on the XY plane
module nema17(depth = 23.5) {
bom_item(printable=false, label="NEMA-17 stepper motor");
face = 42.3;
screw_pitch = 31 / 2;
color(stock_color)
@@ -51,3 +56,65 @@ module nema17(depth = 23.5) {
}
}
// belts and pulleys
belt_pitch = 2; // 2mm tooth width for GT2 = 2mm pitch
belt_width = 6;
belt_thickness = 3;
tooth_height = 2;
module pulley(teeth, lrim, urim, belt_width, shaft=5, toothed=true) {
bom_item(printable=false, label=str(
toothed ? "pulley(" : "idler(",
"teeth=", teeth, ", ",
"flange1=", min(lrim, urim), "mm, ",
"flange2=", max(lrim, urim), "mm, ",
"channel=", belt_width, "mm, ",
"shaft=", shaft, "mm",
")"
));
inner_rad = belt_pitch * teeth / TAU;
outer_rad = inner_rad + belt_thickness;
minor_rad = inner_rad - tooth_height;
mid_rad = inner_rad - tooth_height / 2;
dtheta = 180 / teeth;
tooth_points = [
for (i = [1:1:teeth])
let (theta = i * 360 / teeth)
each [
[sin(theta) * minor_rad, cos(theta) * minor_rad],
[sin(theta) * inner_rad, cos(theta) * inner_rad],
[sin(theta + dtheta) * inner_rad, cos(theta + dtheta) * inner_rad],
[sin(theta + dtheta) * minor_rad, cos(theta + dtheta) * minor_rad]
]
];
//echo([each [0:1:teeth]]);
//echo(tooth_points);
colorize(stock_color)
render()
difference() {
union() {
cylinder(r=outer_rad, h=lrim);
translate([0,0,lrim])
if (toothed) {
linear_extrude(belt_width)
polygon(tooth_points, convexity = teeth * 2 + 4);
} else {
cylinder(r = minor_rad, h = belt_width);
}
translate([0,0,lrim + belt_width])
cylinder(r=outer_rad, h=urim);
}
translate([0,0,-1])
cylinder(d=shaft, h=belt_width + lrim + urim + 2);
}
}
//!pulley(12, 6, 2, toothed=false);