diff --git a/libtest.png b/libtest.png index 8df74f8..e7dac46 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/readme.md b/readme.md index 456acc2..9e49a1e 100644 --- a/readme.md +++ b/readme.md @@ -2155,13 +2155,19 @@ Rocket switch. Also used for neon indicator in the same form factor. --- ## Rod -Steel rods, with optional chamfer. +Steel rods and studding with chamfered ends. [vitamins/rod.scad](vitamins/rod.scad) Implementation. [tests/rod.scad](tests/rod.scad) Code for this example. +### Modules +| Module | Description | +|:--- |:--- | +| ```rod(d , l)``` | Draw a smooth rod with specified length and diameter | +| ```studding(d , l)``` | Draw a threaded rod with specified length and diameter | + ![rod](tests/png/rod.png) ### Vitamins @@ -2174,6 +2180,13 @@ Steel rods, with optional chamfer. | 1 | ```rod(5, 80)``` | Smooth rod 5mm x 80mm | | 1 | ```rod(6, 80)``` | Smooth rod 6mm x 80mm | | 1 | ```rod(8, 80)``` | Smooth rod 8mm x 80mm | +| 1 | ```studding(10, 80)``` | Threaded rod M10 x 80mm | +| 1 | ```studding(12, 80)``` | Threaded rod M12 x 80mm | +| 1 | ```studding(3, 80)``` | Threaded rod M3 x 80mm | +| 1 | ```studding(4, 80)``` | Threaded rod M4 x 80mm | +| 1 | ```studding(5, 80)``` | Threaded rod M5 x 80mm | +| 1 | ```studding(6, 80)``` | Threaded rod M6 x 80mm | +| 1 | ```studding(8, 80)``` | Threaded rod M8 x 80mm | Top diff --git a/tests/png/rod.png b/tests/png/rod.png index 2921e9e..8bfea67 100644 Binary files a/tests/png/rod.png and b/tests/png/rod.png differ diff --git a/tests/rod.scad b/tests/rod.scad index f83873a..0e25577 100644 --- a/tests/rod.scad +++ b/tests/rod.scad @@ -24,8 +24,13 @@ include <../vitamins/linear_bearings.scad> use <../vitamins/rod.scad> module rods() - layout([for(b = linear_bearings) 2 * bearing_radius(b)]) + layout([for(b = linear_bearings) 2 * bearing_radius(b)]) { + rod(bearing_rod_dia(linear_bearings[$i]), 80); + translate([0, 20]) + studding(bearing_rod_dia(linear_bearings[$i]), 80); + } + if($preview) rods(); diff --git a/vitamins/rod.scad b/vitamins/rod.scad index eb4fba5..ffaed1f 100644 --- a/vitamins/rod.scad +++ b/vitamins/rod.scad @@ -18,13 +18,14 @@ // // -//! Steel rods, with optional chamfer. +//! Steel rods and studding with chamfered ends. // include <../core.scad> rod_colour = grey80; +studding_colour = grey70; -module rod(d , l) { +module rod(d , l) { //! Draw a smooth rod with specified length and diameter vitamin(str("rod(", d, ", ", l, "): Smooth rod ", d, "mm x ", l, "mm")); chamfer = d / 10; @@ -35,3 +36,15 @@ module rod(d , l) { cylinder(d = d - 2 * chamfer, h = l, center = true); } } + +module studding(d , l) { //! Draw a threaded rod with specified length and diameter + vitamin(str("studding(", d, ", ", l,"): Threaded rod M", d, " x ", l, "mm")); + + chamfer = d / 20; + color(studding_colour) + hull() { + cylinder(d = d, h = l - 2 * chamfer, center = true); + + cylinder(d = d - 2 * chamfer, h = l, center = true); + } +}