Merge branch 'martinbudden-pulley_drawing_efficiency'

This commit is contained in:
Chris Palmer 2021-01-09 11:15:08 +00:00
commit f97070099e

View File

@ -64,6 +64,7 @@ module pulley(type) { //! Draw a pulley
hl = pulley_hub_length(type);
w = pulley_width(type);
r1 = pulley_bore(type) / 2;
screw_z = pulley_screw_z(type);
or = od / 2;
ir = pulley_ir(type);
@ -100,33 +101,42 @@ module pulley(type) { //! Draw a pulley
}
}
module screw_holes() {
if(pulley_screws(type))
translate_z(pulley_screw_z(type))
for(i = [0 : pulley_screws(type) - 1])
rotate([-90, 0, i * -90])
cylinder(r = screw_radius(pulley_screw(type)), h = 100);
}
module hub()
rotate_extrude() translate([r1, 0]) {
if(hl)
square([pulley_hub_dia(type) / 2 - r1, hl]);
color("silver") {
render() difference() {
rotate_extrude() translate([r1, 0]) {
if(hl)
square([pulley_hub_dia(type) / 2 - r1, hl]);
for(z = [pulley_hub_length(type), hl + ft + w])
translate([0, z])
square([pulley_flange_dia(type) / 2 - r1, ft]);
}
if(pulley_screw_z(type) < hl)
screw_holes();
for(z = [pulley_hub_length(type), hl + ft + w])
translate([0, z])
square([pulley_flange_dia(type) / 2 - r1, ft]);
}
render() difference() { // T5 pulleys have screw through the teeth
module screw_holes()
translate_z(screw_z)
for(i = [0 : pulley_screws(type) - 1])
rotate([-90, 0, i * -90])
cylinder(r = screw_radius(pulley_screw(type)), h = 100);
color(silver) {
if(screw_z && screw_z < hl)
render()
difference() {
hub();
screw_holes();
}
else
hub();
if(screw_z && screw_z > hl) // T5 pulleys have screw through the teeth
render()
difference() {
core();
screw_holes();
}
else
core();
if(pulley_screw_z(type) > hl)
screw_holes();
}
}
}