From 49f6da767a8d77e91de5540aefb42f9784fb105c Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Thu, 31 Dec 2020 11:59:41 +0000 Subject: [PATCH 1/2] Added size and slot convenience functions. Added non-rounded hole. --- vitamins/rocker.scad | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vitamins/rocker.scad b/vitamins/rocker.scad index e7b3c67..c117a27 100644 --- a/vitamins/rocker.scad +++ b/vitamins/rocker.scad @@ -36,6 +36,8 @@ function rocker_bezel(type) = type[10]; //! Bezel width function rocker_pivot(type) = type[11]; //! Pivot distance from the back of the flange function rocker_button(type) = type[12]; //! How far the button extends from the bezel function rocker_spades(type) = type[13]; //! Spade types and positions +function rocker_size(type) = [rocker_width(type), rocker_height(type), rocker_depth(type)]; //! Width, height, and depth in a vector +function rocker_slot(type) = [rocker_slot_w(type), rocker_slot_h(type)]; //! Rocker slot in a vector module rocker(type, colour) { //! Draw the specified rocker switch vitamin(str("rocker(", type[0], "): ", rocker_part(type))); @@ -87,6 +89,6 @@ module rocker(type, colour) { //! Draw the specified rocker switch } } -module rocker_hole(type, h = 0) //! Make a hole to accept a rocker switch, by default 2D, set h for 3D +module rocker_hole(type, h = 0, rounded = true) //! Make a hole to accept a rocker switch, by default 2D, set h for 3D extrude_if(h) - rounded_square([rocker_slot_w(type), rocker_slot_h(type)], 1, center = true); + rounded_square([rocker_slot_w(type), rocker_slot_h(type)], rounded ? 1 : 0, center = true); From 611772d96088b6568318171acb464e331c1c6a04 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Sat, 2 Jan 2021 10:12:54 +0000 Subject: [PATCH 2/2] Updated readme for rocker. --- readme.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 4e7d40e..7da7fe9 100644 --- a/readme.md +++ b/readme.md @@ -2785,11 +2785,17 @@ Rocker switch. Also used for neon indicator in the same form factor. | `rocker_spades(type)` | Spade types and positions | | `rocker_width(type)` | Body width | +### Functions +| Function | Description | +|:--- |:--- | +| `rocker_size(type)` | Width, height, and depth in a vector | +| `rocker_slot(type)` | Rocker slot in a vector | + ### Modules | Module | Description | |:--- |:--- | | `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 | +| `rocker_hole(type, h = 0, rounded = true)` | Make a hole to accept a rocker switch, by default 2D, set h for 3D | ![rockers](tests/png/rockers.png)