diff --git a/vitamins/shaft_coupling.scad b/vitamins/shaft_coupling.scad index 9e1a381..105ccf4 100644 --- a/vitamins/shaft_coupling.scad +++ b/vitamins/shaft_coupling.scad @@ -20,7 +20,7 @@ //! Shaft couplings // include <../core.scad> - +use <../utils/tube.scad> function sc_length(type) = type[1]; //! Coupling length function sc_diameter(type) = type[2]; //! Coupling outer diameter @@ -31,9 +31,9 @@ module shaft_coupling(type, colour = "silver") { //! Draw the shaft coupling vitamin(str("shaft_coupling(", type[0], "): Shaft coupling ", type[0])); length = sc_length(type); - diameter = sc_diameter(type); - d1 = sc_diameter1(type); - d2 = sc_diameter2(type); + radius = sc_diameter(type) / 2; + r1 = sc_diameter1(type) / 2; + r2 = sc_diameter2(type) / 2; grub_length = 3; module grub_screw_positions() { @@ -42,7 +42,7 @@ module shaft_coupling(type, colour = "silver") { //! Draw the shaft coupling translate_z(z) for(a = [0, 90]) rotate([-90, 0, a]) - translate_z(diameter / 2 + 1) + translate_z(radius + 1) children(); } @@ -50,16 +50,9 @@ module shaft_coupling(type, colour = "silver") { //! Draw the shaft coupling render(convexity=2) difference() { union() { translate_z(-length / 2) - linear_extrude(length / 2) - difference() { - circle(d = diameter); - circle(d = d1); - } - linear_extrude(length / 2) - difference() { - circle(d = diameter); - circle(d = d2); - } + tube(radius, r1, length / 2, false); + + tube(radius, r2, length / 2, false); } grub_screw_positions() rotate([180, 0, 0]) @@ -70,4 +63,3 @@ module shaft_coupling(type, colour = "silver") { //! Draw the shaft coupling grub_screw_positions() not_on_bom() screw(M3_grub_screw, grub_length); } -