diff --git a/libtest.png b/libtest.png index 4795fcd..b894a39 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/libtest.scad b/libtest.scad index 9739d86..73cbc4b 100644 --- a/libtest.scad +++ b/libtest.scad @@ -254,7 +254,7 @@ buttons_y = spades_y + 40; jacks_y = buttons_y + 40; microswitches_y = jacks_y + 40; rockers_y = microswitches_y + 40; -toggles_y = rockers_y + 40; +toggles_y = rockers_y + 60; components_y = toggles_y + 40; translate([x2, leds_y]) diff --git a/readme.md b/readme.md index b6f0093..a3138ae 100644 --- a/readme.md +++ b/readme.md @@ -2259,7 +2259,7 @@ Rocker switch. Also used for neon indicator in the same form factor. | ```rocker_height(type)``` | Body height | | ```rocker_part(type)``` | Part description | | ```rocker_pivot(type)``` | Pivot distance from the back of the flange | -| ```rocker_slot_h(type)``` | Panel slow height | +| ```rocker_slot_h(type)``` | Panel slot height | | ```rocker_slot_w(type)``` | Panel slot width | | ```rocker_spades(type)``` | Spade types and positions | | ```rocker_width(type)``` | Body width | @@ -2267,7 +2267,7 @@ Rocker switch. Also used for neon indicator in the same form factor. ### Modules | Module | Description | |:--- |:--- | -| ```rocker(type)``` | Draw the specified rocker switch | +| ```rocker(type, colour)``` | Draw the specified rocker switch | | ```rocker_hole(type, h = 0)``` | Make a hole to accept a rocker switch, by default 2D, set h for 3D | ![rockers](tests/png/rockers.png) @@ -2275,8 +2275,8 @@ Rocker switch. Also used for neon indicator in the same form factor. ### Vitamins | Qty | Module call | BOM entry | | ---:|:--- |:---| -| 1 | ```rocker(neon_indicator)``` | Neon Indicator H8630FBNAL | -| 1 | ```rocker(small_rocker)``` | Rocker Switch PRASA1-16F-BB0BW | +| 2 | ```rocker(neon_indicator)``` | Neon Indicator H8630FBNAL | +| 2 | ```rocker(small_rocker)``` | Rocker Switch PRASA1-16F-BB0BW | Top diff --git a/tests/png/rockers.png b/tests/png/rockers.png index 96f347c..e9b7324 100644 Binary files a/tests/png/rockers.png and b/tests/png/rockers.png differ diff --git a/tests/rockers.scad b/tests/rockers.scad index 5dd840d..6501747 100644 --- a/tests/rockers.scad +++ b/tests/rockers.scad @@ -21,9 +21,13 @@ use <../utils/layout.scad> include <../vitamins/rockers.scad> -module rockers() - layout([for(r = rockers) rocker_flange_w(r)], 5) +module rockers() { + layout([for(r = rockers) rocker_flange_w(r)], 5) { rocker(rockers[$i]); + translate([0, 25]) + rocker(rockers[$i], $i==0 ? "red" : "green"); + } +} if($preview) rockers(); diff --git a/vitamins/rocker.scad b/vitamins/rocker.scad index e8349ce..e0aabfa 100644 --- a/vitamins/rocker.scad +++ b/vitamins/rocker.scad @@ -25,7 +25,7 @@ use function rocker_part(type) = type[1]; //! Part description function rocker_slot_w(type) = type[2]; //! Panel slot width -function rocker_slot_h(type) = type[3]; //! Panel slow height +function rocker_slot_h(type) = type[3]; //! Panel slot height function rocker_flange_w(type) = type[4]; //! Flange width function rocker_flange_h(type) = type[5]; //! Flange height function rocker_flange_t(type) = type[6]; //! Flange thickness @@ -37,7 +37,7 @@ function rocker_pivot(type) = type[11]; //! Pivot distance from the back of function rocker_button(type) = type[12]; //! How far the button extends from the bezel function rocker_spades(type) = type[13]; //! Spade types and positions -module rocker(type) { //! Draw the specified rocker switch +module rocker(type, colour) { //! Draw the specified rocker switch vitamin(str("rocker(", type[0], "): ", rocker_part(type))); bezel = rocker_bezel(type); @@ -65,7 +65,7 @@ module rocker(type) { //! Draw the specified rocker switch rounded_rectangle([rocker_width(type), rocker_height(type), rocker_depth(type) + eps], 0.5, center = false); } if(rocker_pivot(type)) - color(grey30) + color(colour ? colour : grey30) translate_z(rocker_pivot(type)) rotate([90, 0, 90]) linear_extrude(height = rocker_w, center = true) @@ -78,7 +78,7 @@ module rocker(type) { //! Draw the specified rocker switch } else - color("red") cube([rocker_w, rocker_h, 2 * (rocker_flange_t(type) + rocker_button(type))], center = true); + color(colour ? colour : "red") cube([rocker_w, rocker_h, 2 * (rocker_flange_t(type) + rocker_button(type))], center = true); for(spade = rocker_spades(type)) translate([spade[2], spade[3], -rocker_depth(type)])