Merge branch 'martinbudden-rocker_color'

This commit is contained in:
Chris Palmer 2020-02-23 15:03:23 +00:00
commit 8ab7993148
6 changed files with 15 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 764 KiB

After

Width:  |  Height:  |  Size: 766 KiB

View File

@ -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])

View File

@ -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 |
<a href="#top">Top</a>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -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();

View File

@ -25,7 +25,7 @@ use <spade.scad>
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)])