1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-01-29 11:19:00 +01:00

Added printed LED bezels.

This commit is contained in:
Chris 2023-01-07 10:49:45 +00:00
parent 848dcb86b9
commit cec8c3a107
10 changed files with 206 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 996 KiB

After

Width:  |  Height:  |  Size: 998 KiB

View File

@ -74,6 +74,7 @@ use <tests/LDRs.scad>
use <tests/LEDs.scad>
use <tests/light_strips.scad>
use <tests/linear_bearings.scad>
use <tests/LED_bezel.scad>
use <tests/LED_meters.scad>
use <tests/magnets.scad>
use <tests/microswitches.scad>
@ -149,6 +150,9 @@ cable_grommets_y = 0;
translate([x5, cable_grommets_y])
cable_grommets();
translate([x5, cable_grommets_y + 30])
led_bezels();
translate([x5 + 50, cable_grommets_y])
ribbon_clamps();

85
printed/led_bezel.scad Normal file
View File

@ -0,0 +1,85 @@
//
// NopSCADlib Copyright Chris Palmer 2022
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
//
//! Printed LED bezels for panel mounting
//
include <../core.scad>
use <../vitamins/led.scad>
function led_bezel(led, flange = 1, flange_h = 1, wall = 1, height = 8) = [led, flange, flange_h, wall, height]; //! Constructor
function led_bezel_led(type) = type[0]; //! The LED
function led_bezel_flange(type) = type[1]; //! Flange width
function led_bezel_flange_t(type) = type[2]; //! Flange thickness
function led_bezel_wall(type) = type[3]; //! Wall thickness
function led_bezel_height(type) = type[4]; //! Total height
function led_bezel_r(type) = //! Radius of the tube
corrected_radius(led_rim_dia(led_bezel_led(type)) / 2) + led_bezel_wall(type);
function led_bezel_hole_r(type) = //! Panel hole radius
led_bezel_r(type) + 0.1;
module led_bezel(type) { //! Makes the STL for the bezel
led = led_bezel_led(type);
stl(str(led[0],"_bezel")) {
rl = led_diameter(led) / 2;
rr = led_rim_dia(led) / 2;
wall = led_bezel_wall(type);
poly_tube(or = rr + wall + led_bezel_flange(type), ir = rl, h = led_bezel_flange_t(type)); // Flange
poly_tube(or = rl + wall, ir = rl, h = led_height(led) - rl - led_rim_t(led)); // Tube up to LED flange
poly_tube(or = corrected_radius(rr) + wall, ir = rr, h = led_bezel_height(type)); // Tube beyond the flange
}
}
module led_bezel_retainer(type) { //! Makes the STL for the retaining ring
led = led_bezel_led(type);
stl(str(led[0],"_bezel_retainer")) {
ir = led_bezel_r(type);
poly_tube(or = ir + led_bezel_wall(type), ir = ir, h = 4);
}
}
module led_bezel_assembly(type, colour = "red") {//! Led bezel with LED
led = led_bezel_led(type);
assembly(str(led[0], "_", colour, "_bezel")) {
translate_z(led_bezel_flange_t(type)) {
vflip()
stl_colour(pp1_colour)
led_bezel(type);
translate_z(-led_height(led) + led_diameter(led) / 2)
explode(-20)
led(led, colour);
}
}
}
module led_bezel_fastened_assembly(type, t, colour = "red") //! Led bezel fitted to panel with and retaining ring
{
explode(20)
led_bezel_assembly(type, colour);
translate_z(-t)
vflip()
stl_colour(pp2_colour)
explode(60)
led_bezel_retainer(type);
}

View File

@ -37,16 +37,17 @@ A list of changes classified as breaking, additions or fixes is maintained in [C
<tr><td> <a href = "#Circlips">Circlips</a> </td><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#Foot">Foot</a> </td><td> <a href = "#Round">Round</a> </td><td></td></tr>
<tr><td> <a href = "#Components">Components</a> </td><td> <a href = "#Nuts">Nuts</a> </td><td> <a href = "#Springs">Springs</a> </td><td> <a href = "#Handle">Handle</a> </td><td> <a href = "#Rounded_cylinder">Rounded_cylinder</a> </td><td></td></tr>
<tr><td> <a href = "#DIP">DIP</a> </td><td> <a href = "#O_ring">O_ring</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td> <a href = "#Knob">Knob</a> </td><td> <a href = "#Rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
<tr><td> <a href = "#D_connectors">D_connectors</a> </td><td> <a href = "#Opengrab">Opengrab</a> </td><td> <a href = "#Swiss_clips">Swiss_clips</a> </td><td> <a href = "#PCB_mount">PCB_mount</a> </td><td> <a href = "#Rounded_triangle">Rounded_triangle</a> </td><td></td></tr>
<tr><td> <a href = "#Displays">Displays</a> </td><td> <a href = "#PCB">PCB</a> </td><td> <a href = "#Terminals">Terminals</a> </td><td> <a href = "#PSU_shroud">PSU_shroud</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr>
<tr><td> <a href = "#Extrusion_brackets">Extrusion_brackets</a> </td><td> <a href = "#PCBs">PCBs</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td> <a href = "#Pocket_handle">Pocket_handle</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr>
<tr><td> <a href = "#Extrusions">Extrusions</a> </td><td> <a href = "#PSUs">PSUs</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td> <a href = "#Press_fit">Press_fit</a> </td><td> <a href = "#Thread">Thread</a> </td><td></td></tr>
<tr><td> <a href = "#Fans">Fans</a> </td><td> <a href = "#Panel_meters">Panel_meters</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td> <a href = "#Printed_box">Printed_box</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr>
<tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#Pillars">Pillars</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td> <a href = "#Printed_pulleys">Printed_pulleys</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Geared_steppers">Geared_steppers</a> </td><td> <a href = "#Pillow_blocks">Pillow_blocks</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Green_terminals">Green_terminals</a> </td><td> <a href = "#Pin_headers">Pin_headers</a> </td><td> <a href = "#Washers">Washers</a> </td><td> <a href = "#SSR_shroud">SSR_shroud</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Potentiometers">Potentiometers</a> </td><td> <a href = "#Wire">Wire</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Hygrometer">Hygrometer</a> </td><td> <a href = "#Pulleys">Pulleys</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#D_connectors">D_connectors</a> </td><td> <a href = "#Opengrab">Opengrab</a> </td><td> <a href = "#Swiss_clips">Swiss_clips</a> </td><td> <a href = "#LED_bezel">LED_bezel</a> </td><td> <a href = "#Rounded_triangle">Rounded_triangle</a> </td><td></td></tr>
<tr><td> <a href = "#Displays">Displays</a> </td><td> <a href = "#PCB">PCB</a> </td><td> <a href = "#Terminals">Terminals</a> </td><td> <a href = "#PCB_mount">PCB_mount</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr>
<tr><td> <a href = "#Extrusion_brackets">Extrusion_brackets</a> </td><td> <a href = "#PCBs">PCBs</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td> <a href = "#PSU_shroud">PSU_shroud</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr>
<tr><td> <a href = "#Extrusions">Extrusions</a> </td><td> <a href = "#PSUs">PSUs</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td> <a href = "#Pocket_handle">Pocket_handle</a> </td><td> <a href = "#Thread">Thread</a> </td><td></td></tr>
<tr><td> <a href = "#Fans">Fans</a> </td><td> <a href = "#Panel_meters">Panel_meters</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td> <a href = "#Press_fit">Press_fit</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr>
<tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#Pillars">Pillars</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td> <a href = "#Printed_box">Printed_box</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Geared_steppers">Geared_steppers</a> </td><td> <a href = "#Pillow_blocks">Pillow_blocks</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td> <a href = "#Printed_pulleys">Printed_pulleys</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Green_terminals">Green_terminals</a> </td><td> <a href = "#Pin_headers">Pin_headers</a> </td><td> <a href = "#Washers">Washers</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Potentiometers">Potentiometers</a> </td><td> <a href = "#Wire">Wire</a> </td><td> <a href = "#SSR_shroud">SSR_shroud</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Hygrometer">Hygrometer</a> </td><td> <a href = "#Pulleys">Pulleys</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td> <a href = "#Socket_box">Socket_box</a> </td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
</table>
@ -1788,7 +1789,7 @@ Standard domed through hole LEDs. Can specify colour and lead length.
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | `led(LED10mm, "green")` | LED 10 mm green |
| 1 | `led(LED10mm, "orange")` | LED 10 mm orange |
| 1 | `led(LED3mm, "green")` | LED 3 mm green |
| 1 | `led(LED5mm, "blue")` | LED 5 mm blue |
| 1 | `led(LED8mm)` | LED 8 mm red |
@ -5565,6 +5566,72 @@ The STL includes a support membrane that needs to be cut out and a thread needs
| 1 | metric_pot_knob.stl |
<a href="#top">Top</a>
---
<a name="LED_bezel"></a>
## LED_bezel
Printed LED bezels for panel mounting
[printed/led_bezel.scad](printed/led_bezel.scad) Implementation.
[tests/LED_bezel.scad](tests/LED_bezel.scad) Code for this example.
### Properties
| Function | Description |
|:--- |:--- |
| `led_bezel_flange(type)` | Flange width |
| `led_bezel_flange_t(type)` | Flange thickness |
| `led_bezel_height(type)` | Total height |
| `led_bezel_led(type)` | The LED |
| `led_bezel_wall(type)` | Wall thickness |
### Functions
| Function | Description |
|:--- |:--- |
| `led_bezel(led, flange = 1, flange_h = 1, wall = 1, height = 8)` | Constructor |
| `led_bezel_hole_r(type)` | Panel hole radius |
| `led_bezel_r(type)` | Radius of the tube |
### Modules
| Module | Description |
|:--- |:--- |
| `led_bezel(type)` | Makes the STL for the bezel |
| `led_bezel_assembly(type, colour = "red")` | Led bezel with LED |
| `led_bezel_fastened_assembly(type, t, colour = "red")` | Led bezel fitted to panel with and retaining ring |
| `led_bezel_retainer(type)` | Makes the STL for the retaining ring |
![led_bezel](tests/png/led_bezel.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | `led(LED10mm, "orange")` | LED 10 mm orange |
| 1 | `led(LED3mm, "yellow")` | LED 3 mm yellow |
| 1 | `led(LED5mm, "blue")` | LED 5 mm blue |
| 1 | `led(LED8mm)` | LED 8 mm red |
### Printed
| Qty | Filename |
| ---:|:--- |
| 1 | LED10mm_bezel.stl |
| 1 | LED10mm_bezel_retainer.stl |
| 1 | LED3mm_bezel.stl |
| 1 | LED3mm_bezel_retainer.stl |
| 1 | LED5mm_bezel.stl |
| 1 | LED5mm_bezel_retainer.stl |
| 1 | LED8mm_bezel.stl |
| 1 | LED8mm_bezel_retainer.stl |
### Assemblies
| Qty | Name |
| ---:|:--- |
| 1 | LED10mm_orange_bezel_assembly |
| 1 | LED3mm_yellow_bezel_assembly |
| 1 | LED5mm_blue_bezel_assembly |
| 1 | LED8mm_red_bezel_assembly |
<a href="#top">Top</a>
---

37
tests/LED_bezel.scad Normal file
View File

@ -0,0 +1,37 @@
//
// NopSCADlib Copyright Chris Palmer 2018
// nop.head@gmail.com
// hydraraptor.blogspot.com
//
// This file is part of NopSCADlib.
//
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
// GNU General Public License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>.
//
include <../core.scad>
use <../utils/layout.scad>
include <../vitamins/leds.scad>
use <../printed/led_bezel.scad>
module led_bezels()
layout([for(l = LEDs) led_diameter(l)], 6) let(l = LEDs[$i], b = led_bezel(l))
if($preview)
led_bezel_fastened_assembly(b, 3, ["yellow", "blue", "red", "orange"][$i % 4]);
else {
led_bezel(b);
translate([0, -20])
led_bezel_retainer(b);
}
led_bezels();

View File

@ -23,7 +23,7 @@ include <../vitamins/leds.scad>
module leds()
layout([for(l = LEDs) led_diameter(l)], 5)
led(LEDs[$i], ["green", "blue", "red"][$i % 3]);
led(LEDs[$i], ["green", "blue", "red", "orange"][$i % 4]);
if($preview)
leds();

BIN
tests/png/led_bezel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 184 KiB

View File

@ -76,7 +76,7 @@ module render_if(render = true, convexity = 2) //! Renders an object if `re
module extrude_if(h, center = true) //! Extrudes 2D object to 3D when `h` is nonzero, otherwise leaves it 2D
if(h)
linear_extrude(h, center = center, convexity = 2) // 3D
linear_extrude(h, center = center, convexity = 5) // 3D
children();
else
children(); // 2D