120 lines
2.7 KiB
OpenSCAD
120 lines
2.7 KiB
OpenSCAD
include <MCAD/math.scad>;
|
|
include <lib.scad>;
|
|
|
|
stock_color = "#aaa4";
|
|
|
|
bushing_od = 12;
|
|
bushing_id = 8;
|
|
bushing_len = 8;
|
|
|
|
nema17_face = 42.3;
|
|
|
|
module colorize(colorname) {
|
|
if (use_colors) {
|
|
color(colorname) union() { children(); }
|
|
} else {
|
|
children();
|
|
}
|
|
}
|
|
|
|
module bushing() {
|
|
bom_item(printable=false, label="Bushing");
|
|
colorize(stock_color) render() {
|
|
difference() {
|
|
cylinder(d = bushing_od, h = bushing_len);
|
|
translate([0,0,-1])
|
|
cylinder(d = bushing_id, h = bushing_len + 2);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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)
|
|
render()
|
|
difference() {
|
|
union() {
|
|
translate([-face/2, -face/2, -depth])
|
|
cube([face, face, depth]);
|
|
translate([0,0,-1]) {
|
|
cylinder(d=22, h=2+1);
|
|
cylinder(d=5, h=22+1);
|
|
}
|
|
}
|
|
translate([1.25, -5, 4])
|
|
cube([10, 10, 20]);
|
|
|
|
// screw holes
|
|
for (x = [-screw_pitch, screw_pitch],
|
|
y = [-screw_pitch, screw_pitch]) {
|
|
translate([x,y,-10])
|
|
cylinder(d=5,h=20);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// 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); |