mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-09-04 20:56:07 +02:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4ff12b1d8b | ||
|
847dba544f | ||
|
13c654a10e | ||
|
49ee92db8e | ||
|
be14a52c21 | ||
|
af4c5e2b3e | ||
|
f85a7e85be | ||
|
c68f879d13 | ||
|
3d4653fc0f |
1
lib.scad
1
lib.scad
@@ -60,6 +60,7 @@ include <vitamins/ball_bearings.scad>
|
||||
include <vitamins/light_strips.scad>
|
||||
include <vitamins/spools.scad>
|
||||
include <vitamins/mains_sockets.scad>
|
||||
include <vitamins/ldrs.scad>
|
||||
|
||||
use <vitamins/jack.scad>
|
||||
use <vitamins/meter.scad>
|
||||
|
BIN
libtest.png
BIN
libtest.png
Binary file not shown.
Before Width: | Height: | Size: 703 KiB After Width: | Height: | Size: 703 KiB |
@@ -40,6 +40,7 @@ use <tests/inserts.scad>
|
||||
use <tests/jack.scad>
|
||||
use <tests/leadnuts.scad>
|
||||
use <tests/leds.scad>
|
||||
use <tests/ldrs.scad>
|
||||
use <tests/light_strips.scad>
|
||||
use <tests/linear_bearings.scad>
|
||||
use <tests/meter.scad>
|
||||
@@ -252,6 +253,9 @@ components_y = toggles_y + 40;
|
||||
translate([x2, leds_y])
|
||||
leds();
|
||||
|
||||
translate([x2 + 40, leds_y])
|
||||
ldrs();
|
||||
|
||||
translate([x2 + 8, carriers_y])
|
||||
carriers();
|
||||
|
||||
|
@@ -33,10 +33,8 @@ wall = 1.8;
|
||||
top = 1.5;
|
||||
screw = M3_cap_screw;
|
||||
insert = screw_insert(screw);
|
||||
boss_r = wall + corrected_radius(insert_hole_radius(insert));
|
||||
boss_h = insert_hole_length(insert);
|
||||
boss_r = insert_boss_radius(insert, wall);
|
||||
counter_bore = 2;
|
||||
boss_h2 = boss_h + counter_bore;
|
||||
rad = 2;
|
||||
clearance = layer_height;
|
||||
overlap = 6;
|
||||
@@ -137,49 +135,13 @@ module psu_shroud(type, cable_d, name, cables = 1) { //! Generate the STL file f
|
||||
translate([0, height / 2])
|
||||
vertical_tearslot(h = 0, r = cable_d / 2, l = cable_d);
|
||||
}
|
||||
|
||||
mirror([0, 1, 0]) {
|
||||
// insert boss
|
||||
translate_z(height - boss_h)
|
||||
linear_extrude(height = boss_h)
|
||||
psu_shroud_hole_positions(type)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([0, $side * (boss_r - 1)])
|
||||
square([2 * boss_r, eps], center = true);
|
||||
}
|
||||
poly_circle(insert_hole_radius(insert));
|
||||
}
|
||||
|
||||
// insert boss counter_bore
|
||||
translate_z(height - boss_h2)
|
||||
linear_extrude(height = counter_bore + eps)
|
||||
psu_shroud_hole_positions(type)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([0, $side * (boss_r - 1)])
|
||||
square([2 * boss_r, eps], center = true);
|
||||
}
|
||||
poly_circle(insert_screw_diameter(insert) / 2 + 0.1);
|
||||
}
|
||||
// support cones
|
||||
translate_z(height - boss_h2)
|
||||
psu_shroud_hole_positions(type)
|
||||
hull() {
|
||||
cylinder(h = eps, r = boss_r - eps);
|
||||
|
||||
translate([0, $side * (boss_r - 1)])
|
||||
cube([2 * boss_r, eps, eps], center = true);
|
||||
|
||||
translate([0, $side * (boss_r - wall), - (2 * boss_r - wall)])
|
||||
cube(eps);
|
||||
}
|
||||
}
|
||||
}
|
||||
// insert lugs
|
||||
mirror([0, 1, 0])
|
||||
psu_shroud_hole_positions(type)
|
||||
translate_z(height)
|
||||
rotate(90)
|
||||
insert_lug(insert, wall, $side, counter_bore);
|
||||
}
|
||||
|
||||
module psu_shroud_assembly(type, cable_d, name, cables = 1) //! The printed parts with inserts fitted
|
||||
assembly(str("psu_shroud_", name)) {
|
||||
|
@@ -33,10 +33,8 @@ wall = 1.8;
|
||||
top = 1.5;
|
||||
screw = M3_cap_screw;
|
||||
insert = screw_insert(screw);
|
||||
boss_r = wall + corrected_radius(insert_hole_radius(insert));
|
||||
boss_h = insert_hole_length(insert);
|
||||
boss_r = insert_boss_radius(insert, wall);
|
||||
counter_bore = 2;
|
||||
boss_h2 = boss_h + counter_bore;
|
||||
rad = 3;
|
||||
clearance = layer_height;
|
||||
|
||||
@@ -61,7 +59,6 @@ module ssr_shroud_holes(type, cable_d) { //! Drill the screw and ziptie holes
|
||||
translate([ssr_shroud_cable_x(type, cable_d), side * (ssr_width(type) / 2 - 2 * boss_r)])
|
||||
rotate(-90)
|
||||
cable_tie_holes(cable_d / 2, h = 0);
|
||||
|
||||
}
|
||||
|
||||
module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a specified ssr and cable
|
||||
@@ -103,45 +100,11 @@ module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a spec
|
||||
vertical_tearslot(h = 0, r = cable_d / 2, l = cable_d);
|
||||
}
|
||||
// insert boss
|
||||
translate_z(height - boss_h)
|
||||
linear_extrude(height = boss_h)
|
||||
ssr_shroud_hole_positions(type)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([0, -$side * (boss_r - 1)])
|
||||
square([2 * boss_r, eps], center = true);
|
||||
}
|
||||
poly_circle(insert_hole_radius(insert));
|
||||
}
|
||||
|
||||
// insert boss counter_bore
|
||||
translate_z(height - boss_h2)
|
||||
linear_extrude(height = counter_bore + eps)
|
||||
ssr_shroud_hole_positions(type)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([0, -$side * (boss_r - 1)])
|
||||
square([2 * boss_r, eps], center = true);
|
||||
}
|
||||
poly_circle(insert_screw_diameter(insert) / 2 + 0.1);
|
||||
}
|
||||
// support cones
|
||||
ssr_shroud_hole_positions(type)
|
||||
hull() {
|
||||
translate_z(-height + boss_h2) {
|
||||
cylinder(h = eps, r = boss_r - eps);
|
||||
|
||||
translate([0, -$side * (boss_r - 1)])
|
||||
cube([2 * boss_r, eps, eps], center = true);
|
||||
}
|
||||
translate([0, -$side * (boss_r - wall), -height + boss_h2 + (2 * boss_r - wall)])
|
||||
cube(eps);
|
||||
}
|
||||
|
||||
vflip()
|
||||
translate_z(height)
|
||||
rotate(90)
|
||||
insert_lug(insert, wall, $side, counter_bore);
|
||||
}
|
||||
|
||||
module ssr_shroud_assembly(type, cable_d, name) //! The printed parts with inserts fitted
|
||||
@@ -153,7 +116,6 @@ assembly(str("ssr_shroud_", name)) {
|
||||
|
||||
ssr_shroud_hole_positions(type)
|
||||
insert(insert);
|
||||
|
||||
}
|
||||
|
||||
module ssr_shroud_fastened_assembly(type, cable_d, thickness, name) //! Assembly with screws in place
|
||||
@@ -177,6 +139,4 @@ module ssr_shroud_fastened_assembly(type, cable_d, thickness, name) //! Assembly
|
||||
color(grey20)
|
||||
cylinder(d = cable_d, h = 20, center = true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
68
readme.md
68
readme.md
@@ -35,16 +35,17 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
|
||||
<tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Inserts">Inserts</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Jack">Jack</a> </td><td> <a href = "#Springs">Springs</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Leds">Leds</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Mains_sockets">Mains_sockets</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Meter">Meter</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microswitches">Microswitches</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microview">Microview</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Nuts">Nuts</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Ldrs">Ldrs</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Leds">Leds</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Mains_sockets">Mains_sockets</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Meter">Meter</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microswitches">Microswitches</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microview">Microview</a> </td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Nuts">Nuts</a> </td><td></td><td></td><td></td><td></td></tr>
|
||||
</table>
|
||||
|
||||
---
|
||||
@@ -889,12 +890,18 @@ Heatfit threaded inserts. Can be pushed into thermoplastics using a soldering ir
|
||||
| ```insert_ring3_d(type)``` | Diameter of the bottom ring |
|
||||
| ```insert_screw_diameter(type)``` | Screw size |
|
||||
|
||||
### Functions
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```insert_boss_radius(type, wall)``` | Compute the outer radius of an insert boss |
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```insert(type)``` | Draw specified insert |
|
||||
| ```insert_boss(type, z, wall = 2 * extrusion_width)``` | Make a boss to take an insert |
|
||||
| ```insert_hole(type, counterbore = 0, horizontal = false)``` | Make a hole to take an insert, ```counterbore``` is the extra length for the screw |
|
||||
| ```insert_lug(insert, wall, side, counter_bore = 0)``` | Make a flying insert lug, see [ssr_shroud](#Ssr_shroud) |
|
||||
|
||||

|
||||
|
||||
@@ -945,6 +952,47 @@ E.g. a "brown" socket for mains live needs to be displayed as "sienna" to look r
|
||||
| 1 | ```jack_4mm_shielded("brown", 3, "sienna")``` | 4mm shielded jack socket brown |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
<a name="Ldrs"></a>
|
||||
## Ldrs
|
||||
Light dependent resistors.
|
||||
|
||||
Larger ones seem to have both a higher dark resistance and a lower bright light resistance.
|
||||
|
||||
|
||||
[vitamins/ldrs.scad](vitamins/ldrs.scad) Object definitions.
|
||||
|
||||
[vitamins/ldr.scad](vitamins/ldr.scad) Implementation.
|
||||
|
||||
[tests/ldrs.scad](tests/ldrs.scad) Code for this example.
|
||||
|
||||
### Properties
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```ldr_active(type)``` | The active width |
|
||||
| ```ldr_description(type)``` | Description |
|
||||
| ```ldr_diameter(type)``` | The diameter of the round bit |
|
||||
| ```ldr_lead_d(type)``` | The lead diameter |
|
||||
| ```ldr_pitch(type)``` | Pitch between the leads |
|
||||
| ```ldr_thickness(type)``` | Thickness |
|
||||
| ```ldr_width(type)``` | Across the flats |
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```LDR(type, lead_length = 3)``` | Draw an LDR, can specify the lead length |
|
||||
|
||||

|
||||
|
||||
### Vitamins
|
||||
| Qty | Module call | BOM entry |
|
||||
| ---:|:--- |:---|
|
||||
| 1 | ```ldr(large_ldr)``` | Light dependent resistor - large |
|
||||
| 1 | ```ldr(small_ldr)``` | Light dependent resistor - small |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
|
@@ -20,7 +20,8 @@ include <../global_defs.scad>
|
||||
use <../utils/fillet.scad>
|
||||
|
||||
module fillets() {
|
||||
fillet(3, 25);
|
||||
rotate(180)
|
||||
fillet(3, 10);
|
||||
}
|
||||
|
||||
fillets();
|
||||
|
27
tests/ldrs.scad
Normal file
27
tests/ldrs.scad
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// 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 <../vitamins/ldrs.scad>
|
||||
|
||||
use <../utils/layout.scad>
|
||||
|
||||
module ldrs()
|
||||
layout([for(l = ldrs) ldr_diameter(l)], 5)
|
||||
LDR(ldrs[$i]);
|
||||
|
||||
ldrs();
|
Binary file not shown.
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 19 KiB |
BIN
tests/png/ldrs.png
Normal file
BIN
tests/png/ldrs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 KiB |
@@ -28,5 +28,6 @@ module fillet(r, h, center = false) //! Fillet with specified radius and height
|
||||
translate([-eps, -eps, 0])
|
||||
square(r + eps);
|
||||
|
||||
circle(r + eps);
|
||||
translate([r, r])
|
||||
circle(r + eps);
|
||||
}
|
||||
|
@@ -93,6 +93,8 @@ module insert_hole(type, counterbore = 0, horizontal = false) { //! Make a hole
|
||||
}
|
||||
}
|
||||
|
||||
function insert_boss_radius(type, wall) = corrected_radius(insert_hole_radius(type)) + wall; //! Compute the outer radius of an insert boss
|
||||
|
||||
module insert_boss(type, z, wall = 2 * extrusion_width) { //! Make a boss to take an insert
|
||||
render(convexity = 3)
|
||||
difference() {
|
||||
@@ -105,3 +107,45 @@ module insert_boss(type, z, wall = 2 * extrusion_width) { //! Make a boss to tak
|
||||
insert_hole(type, max(0, z - insert_hole_length(type) - 2 * layer_height));
|
||||
}
|
||||
}
|
||||
|
||||
module insert_lug(insert, wall, side, counter_bore = 0) { //! Make a flying insert lug, see [ssr_shroud](#Ssr_shroud)
|
||||
boss_r = insert_boss_radius(insert, wall);
|
||||
boss_h = insert_hole_length(insert);
|
||||
boss_h2 = boss_h + counter_bore;
|
||||
translate_z(-boss_h)
|
||||
linear_extrude(height = boss_h)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([side * (boss_r - 1), 0])
|
||||
square([eps, 2 * boss_r], center = true);
|
||||
}
|
||||
poly_circle(insert_hole_radius(insert));
|
||||
}
|
||||
|
||||
// insert boss counter_bore
|
||||
translate_z(-boss_h2) {
|
||||
linear_extrude(height = counter_bore + eps)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([side * (boss_r - 1), 0])
|
||||
square([eps, 2 * boss_r], center = true);
|
||||
}
|
||||
poly_circle(insert_screw_diameter(insert) / 2 + 0.1);
|
||||
}
|
||||
|
||||
// support cones
|
||||
hull() {
|
||||
cylinder(h = eps, r = boss_r - eps);
|
||||
|
||||
translate([side * (boss_r - 1), 0])
|
||||
cube([eps, 2 * boss_r, eps], center = true);
|
||||
|
||||
translate([side * (boss_r - wall + eps), 0, - (2 * boss_r - wall)])
|
||||
cube(eps, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
105
vitamins/ldr.scad
Normal file
105
vitamins/ldr.scad
Normal file
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
//! Light dependent resistors.
|
||||
//!
|
||||
//! Larger ones seem to have both a higher dark resistance and a lower bright light resistance.
|
||||
//
|
||||
include <../core.scad>
|
||||
|
||||
function ldr_description(type) = type[1]; //! Description
|
||||
function ldr_diameter(type) = type[2]; //! The diameter of the round bit
|
||||
function ldr_width(type) = type[3]; //! Across the flats
|
||||
function ldr_thickness(type) = type[4]; //! Thickness
|
||||
function ldr_pitch(type) = type[5]; //! Pitch between the leads
|
||||
function ldr_active(type) = type[6]; //! The active width
|
||||
function ldr_lead_d(type) = type[7]; //! The lead diameter
|
||||
|
||||
module LDR(type, lead_length = 3) { //! Draw an LDR, can specify the lead length
|
||||
vitamin(str("ldr(", type[0], "): Light dependent resistor - ", ldr_description(type)));
|
||||
|
||||
module shape()
|
||||
intersection() {
|
||||
circle(d = ldr_diameter(type));
|
||||
|
||||
square([100, ldr_width(type)], center = true);
|
||||
}
|
||||
|
||||
function serpentine_t() = let(w = ldr_width(type), n = floor(w / 0.5) + 0.5) w / (n * 2);
|
||||
|
||||
module serpentine() {
|
||||
w = ldr_width(type);
|
||||
|
||||
t = serpentine_t();
|
||||
pitch = 2 * t;
|
||||
l = ldr_active(type);
|
||||
lines = ceil(w / pitch);
|
||||
|
||||
for(i = [0 : lines - 1])
|
||||
translate([0, i * pitch - w / 2 + t / 2]) {
|
||||
square([l - 3 * t, t], center = true);
|
||||
|
||||
end = i % 2 ? 1 : -1;
|
||||
$fn = 16;
|
||||
translate([end * (l / 2 - 1.5 * t), t])
|
||||
rotate(-end * 90)
|
||||
difference() {
|
||||
semi_circle(1.5 * t);
|
||||
|
||||
semi_circle(t / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t = ldr_thickness(type);
|
||||
|
||||
color("white")
|
||||
linear_extrude(height = t - 0.4)
|
||||
shape();
|
||||
|
||||
color("orange")
|
||||
translate_z(t - 0.4)
|
||||
linear_extrude(height = 0.1)
|
||||
shape();
|
||||
|
||||
color([0.9, 0.9, 0.9])
|
||||
translate_z(t - 0.3)
|
||||
linear_extrude(height = 0.1)
|
||||
difference() {
|
||||
offset(-serpentine_t())
|
||||
shape();
|
||||
|
||||
serpentine();
|
||||
}
|
||||
|
||||
color("silver")
|
||||
for(side = [-1, 1])
|
||||
translate([side * ldr_pitch(type) / 2, 0]) {
|
||||
translate_z(-lead_length)
|
||||
cylinder(d = ldr_lead_d(type), h = lead_length, $fn = 16);
|
||||
|
||||
translate_z(t - 0.3)
|
||||
cylinder(d = 1.5 * ldr_lead_d(type), h = 0.2, $fn = 16);
|
||||
}
|
||||
color([1, 1, 1, 0.25])
|
||||
translate_z(t - 0.3 + eps)
|
||||
linear_extrude(height = 0.3)
|
||||
shape();
|
||||
}
|
28
vitamins/ldrs.scad
Normal file
28
vitamins/ldrs.scad
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
// Light dependent resistors.
|
||||
//
|
||||
small_ldr = ["small_ldr", "small", 5, 4.2, 2.0, 3.2, 2.5, 0.4];
|
||||
large_ldr = ["large_ldr", "large", 9.2, 7.9, 2.0, 6.8, 4.5, 0.5];
|
||||
|
||||
ldrs = [small_ldr, large_ldr];
|
||||
|
||||
use <ldr.scad>
|
@@ -58,7 +58,7 @@ module nut(type, nyloc = false, brass = false, nylon = false) { //! Draw specifi
|
||||
rounded_cylinder(r = outer_rad * cos(30) , h = nyloc_thickness, r2 = (nyloc_thickness - thickness) / 2, ir = hole_rad);
|
||||
}
|
||||
if($children)
|
||||
translate_z(thickness)
|
||||
translate_z(nut_thickness(type, nyloc))
|
||||
children();
|
||||
}
|
||||
|
||||
|
@@ -750,14 +750,19 @@ module pcb(type) { //! Draw specified PCB
|
||||
}
|
||||
}
|
||||
|
||||
module pcb_spacer(screw, height, wall = 1.8) { //! Generate STL for PCB spacer
|
||||
stl(str("pcb_spacer", round(screw_radius(screw) * 20), round(height * 10)));
|
||||
module pcb_spacer(screw, height, wall = 1.8, taper = 0) { //! Generate STL for PCB spacer
|
||||
stl(str("pcb_spacer", round(screw_radius(screw) * 20), round(height * 10), taper ? str("_", taper) : ""));
|
||||
|
||||
ir = screw_clearance_radius(screw);
|
||||
or = corrected_radius(ir) + wall;
|
||||
|
||||
linear_extrude(height = height)
|
||||
poly_ring(or, ir);
|
||||
if(height > taper)
|
||||
linear_extrude(height = height - taper)
|
||||
poly_ring(or, ir);
|
||||
|
||||
if(taper)
|
||||
linear_extrude(height = height)
|
||||
poly_ring(ir + 2 * extrusion_width, ir);
|
||||
}
|
||||
|
||||
module pcb_base(type, height, thickness, wall = 2) { //! Generate STL for a base with PCB spacers
|
||||
@@ -798,12 +803,8 @@ module pcb_assembly(type, height, thickness) { //! Draw PCB assembly with spaces
|
||||
screw(screw, screw_length);
|
||||
|
||||
color(pp1_colour)
|
||||
if(taper) {
|
||||
h2 = max(0, height - 2);
|
||||
if(h2)
|
||||
pcb_spacer(screw, h2);
|
||||
pcb_spacer(screw, height, 2 * extrusion_width); // Thin as can be at the top because there is no clearance around the holes.
|
||||
}
|
||||
if(taper)
|
||||
pcb_spacer(screw, height, taper = 2);
|
||||
else
|
||||
pcb_spacer(screw, height);
|
||||
|
||||
|
Reference in New Issue
Block a user