Improved pulley.scad speed.

This commit is contained in:
Chris Palmer 2021-01-09 11:13:14 +00:00
parent 4b533cffd2
commit 729891b675
1 changed files with 31 additions and 23 deletions

View File

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