Moved all the mechanical stuff into a subdirectory
This commit is contained in:
129
mechanical/stock_parts.scad
Normal file
129
mechanical/stock_parts.scad
Normal file
@@ -0,0 +1,129 @@
|
||||
include <lib.scad>
|
||||
|
||||
stock_color = "#aaa";
|
||||
|
||||
bushing_od = 15;
|
||||
bushing_id = 8;
|
||||
bushing_len = 24;
|
||||
|
||||
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 = 1.38;
|
||||
belt_pld =
|
||||
0.254; // distance between pitch line and tips of gear teeth
|
||||
belt_backing = 0.63 - belt_pld; // distance between pitch line and backing
|
||||
tooth_height = 0.75; // distance from tips of belt teeth to tip of gear teeth
|
||||
|
||||
pulley_od = 13;
|
||||
pulley_clearance_rad = pulley_od / 2 + 1.5;
|
||||
|
||||
function pulley_radius(nteeth) = belt_pitch * nteeth / (PI * 2);
|
||||
module pulley(teeth, lrim, urim, belt_width, shaft = 5, toothed = true,
|
||||
od = 0) {
|
||||
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", ")"));
|
||||
nominal_rad = pulley_radius(teeth);
|
||||
inner_rad = nominal_rad - belt_pld;
|
||||
outer_rad = (od > 0) ? od / 2 : nominal_rad + belt_backing;
|
||||
minor_rad = inner_rad - tooth_height;
|
||||
mid_rad = inner_rad - tooth_height / 2;
|
||||
idler_rad = nominal_rad - belt_backing;
|
||||
|
||||
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 = idler_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);
|
||||
}
|
||||
}
|
||||
|
||||
idler_zmargin = [ 6.4 / 2 + 1.05, 6.4 / 2 + 1.05 ];
|
||||
|
||||
idler_nteeth = 16;
|
||||
module idler(height = 0, toothed = false) {
|
||||
// pulley(20, 1.05, 1.05, 6.4, toothed=toothed, od=18);
|
||||
translate([ 0, 0, height - idler_zmargin[0] ])
|
||||
pulley(16, 1.05, 1.05, 6.4, shaft = 3, toothed = toothed, od = 13);
|
||||
}
|
||||
|
||||
active_pulley_zmargin = [ 9.5, 4.5 ];
|
||||
|
||||
module active_pulley(height = 0) {
|
||||
translate([ 0, 0, -active_pulley_zmargin[0] + height ])
|
||||
pulley(16, 6, 1, 7, od = 13);
|
||||
}
|
||||
|
||||
// required distance between centers of pulley and idler for an S-bend with
|
||||
// right angles.
|
||||
pulley_sbend_offset = (9.5 + 9.7) / 2 + 0.63;
|
||||
|
||||
//! pulley(12, 6, 2, toothed=false);
|
||||
Reference in New Issue
Block a user