diff --git a/libtest.png b/libtest.png index 1cd6271..1841c94 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/readme.md b/readme.md index 530d91e..34a2521 100644 --- a/readme.md +++ b/readme.md @@ -3020,15 +3020,16 @@ NEMA stepper motor model. ### Vitamins | Qty | Module call | BOM entry | | ---:|:--- |:---| -| 24 | ```screw(M3_pan_screw, 8)``` | Screw M3 pan x 8mm | +| 4 | ```ring_terminal(M3_ringterm)``` | Ring terminal 3mm | +| 15 | ```screw(M3_pan_screw, 8)``` | Screw M3 pan x 8mm | | 1 | ```NEMA(NEMA14)``` | Stepper motor NEMA14 x 36mm | | 1 | ```NEMA(NEMA16)``` | Stepper motor NEMA16 x 19.2mm | | 1 | ```NEMA(NEMA17S)``` | Stepper motor NEMA17 x 34mm | | 1 | ```NEMA(NEMA17M)``` | Stepper motor NEMA17 x 40mm | | 1 | ```NEMA(NEMA17)``` | Stepper motor NEMA17 x 47mm | | 1 | ```NEMA(NEMA23)``` | Stepper motor NEMA22 x 51.2mm | -| 24 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm | -| 24 | ```star_washer(M3_washer)``` | Washer star M3 x 0.5mm | +| 11 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm | +| 15 | ```star_washer(M3_washer)``` | Washer star M3 x 0.5mm | Top diff --git a/tests/png/stepper_motors.png b/tests/png/stepper_motors.png index b69a506..a4a0da5 100644 Binary files a/tests/png/stepper_motors.png and b/tests/png/stepper_motors.png differ diff --git a/tests/stepper_motors.scad b/tests/stepper_motors.scad index ef13bc1..cd735bc 100644 --- a/tests/stepper_motors.scad +++ b/tests/stepper_motors.scad @@ -27,8 +27,10 @@ module stepper_motors() rotate(180) NEMA(stepper_motors[$i]); - NEMA_screws(stepper_motors[$i], M3_pan_screw); + translate_z(4) + NEMA_screws(stepper_motors[$i], M3_pan_screw, n = $i, earth = $i > 4 ? undef : 0); } if($preview) - stepper_motors(); + let($show_threads = 1) + stepper_motors(); diff --git a/vitamins/stepper_motor.scad b/vitamins/stepper_motor.scad index 83950e5..c3701bf 100644 --- a/vitamins/stepper_motor.scad +++ b/vitamins/stepper_motor.scad @@ -26,6 +26,7 @@ include use include use <../utils/tube.scad> +use <../utils/thread.scad> use function NEMA_width(type) = type[1]; //! Width of the square face @@ -60,6 +61,7 @@ module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor shaft_rad = NEMA_shaft_dia(type) / 2; cap = 8; vitamin(str("NEMA(", type[0], "): Stepper motor NEMA", round(NEMA_width(type) / 2.54), " x ", length, "mm")); + thread_d = 3; // Is this always the case? union() { color(stepper_body_colour) // black laminations @@ -75,7 +77,7 @@ module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor tube(or = boss_rad, ir = shaft_rad + 2, h = boss_height * 2); // raised boss for(end = [-1, 1]) - translate_z(-length / 2 + end * (length - cap) / 2) + translate_z(-length / 2 + end * (length - cap) / 2) { linear_extrude(height = cap, center = true) difference() { intersection() { @@ -85,9 +87,14 @@ module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor if(end > 0) for(x = NEMA_holes(type), y = NEMA_holes(type)) translate([x, y]) - circle(r = 3/2); + circle(d = thread_d); } + } } + if(show_threads) + for(x = NEMA_holes(type), y = NEMA_holes(type)) + translate([x, y, -cap / 2]) + female_metric_thread(thread_d, metric_coarse_pitch(thread_d), cap, colour = stepper_cap_colour); shaft = NEMA_shaft_length(type); translate_z(-5) @@ -112,7 +119,7 @@ module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor module NEMA_screw_positions(type, n = 4) { //! Positions children at the screw holes pitch = NEMA_hole_pitch(type); - for($i = [0 : n - 1]) + for($i = [0 : 1 : min(n - 1, 4)]) rotate($i * 90) translate([pitch / 2, pitch / 2]) rotate($i * -90)