1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-09-03 20:32:35 +02:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Chris Palmer
a3e51d2607 Added PSU shrouds. 2019-06-27 13:20:50 +01:00
Chris Palmer
8ea7d92997 Rounded up wire_hole_radius to nearest half mm. 2019-06-27 11:37:55 +01:00
Chris Palmer
e386ce7927 Added more imperial and metric units as requested. 2019-06-27 11:10:37 +01:00
Chris
fbc0b1d27d Merge pull request #2 from twoxe/patch-1
Change LED.scad to led.scad
2019-06-27 10:12:27 +01:00
Chris Palmer
5f287ef8ad Fixed ssr shroud mounting height. 2019-06-27 10:06:13 +01:00
twoxe
c155e95599 Change LED.scad to led.scad
The file LED.scad is not found if a case sensitive file system is used
2019-06-25 10:35:41 +02:00
15 changed files with 336 additions and 17 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 KiB

After

Width:  |  Height:  |  Size: 658 KiB

View File

@@ -87,6 +87,7 @@ use <tests/screw_knob.scad>
use <tests/socket_box.scad>
use <tests/strap_handle.scad>
use <tests/ssr_shroud.scad>
use <tests/psu_shroud.scad>
x5 = 800;
@@ -217,9 +218,11 @@ translate([x0, fans_y]) {
translate([x0, transformers_y])
variacs();
translate([x0, psus_y])
translate([x0, psus_y]) {
psus();
psu_shrouds();
}
x1 = x0 + 100;
zipties_y = 0;

View File

@@ -28,7 +28,6 @@ include <../vitamins/inserts.scad>
foot = [25, 12, 3, 2, M4_cap_screw, 10];
insert_foot = [20, 10, 0, 2, M3_cap_screw, 10];
function foot() = foot; //! Default foot used unless a list of parameters is passed
function insert_foot() = insert_foot; //! Default foot with insert
function foot_diameter(type = foot) = type[0]; //! Outside maximum diameter

210
printed/psu_shroud.scad Normal file
View File

@@ -0,0 +1,210 @@
//
// 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/>.
//
//
//! A cover to go over the mains end of a PSU terminal strip to make it safe.
//! The stl and assembly must be given a name and parameterless wrappers for the stl and assembly added to the project.
//
include <../core.scad>
include <../vitamins/screws.scad>
include <../vitamins/inserts.scad>
use <../vitamins/wire.scad>
use <../vitamins/psu.scad>
use <../utils/round.scad>
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);
counter_bore = 2;
boss_h2 = boss_h + counter_bore;
rad = 2;
clearance = layer_height;
overlap = 6;
cable_tie_inset = wall + 4;
function psu_shroud_extent(type) = 15 + wall; //! How far it extends beyond the PSU to clear the connections
function psu_shroud_depth(type) = //! Outside depth of the shroud
psu_left_bay(type) + overlap + psu_shroud_extent(type);
function psu_shroud_width(type) = //! Outside width of the shroud
let(terminals = psu_terminals(type))
terminals ?
let(y = terminals.y, tb = terminals.z)
wall + clearance / 2 + y + 3 * terminal_block_pitch(tb) + terminal_block_divider(tb) / 2 + wall / 2
: psu_width(type) + 2 * wall + clearance;
function psu_shroud_height(type) = psu_height(type) + top + clearance; //! Outside height
function psu_shroud_centre_y(type) = //! Shroud centre relative to PSU centre
psu_width(type) / 2 + clearance / 2 + wall - psu_shroud_width(type) / 2;
function psu_shroud_pitch(type) = psu_shroud_width(type) - 2 * boss_r - eps;
function psu_shroud_screw(type) = screw; //! Screw used to fasten
function psu_shroud_cable_pitch(cable_d) = cable_d + 5; //! Pitch between cable entries
module psu_shroud_hole_positions(type) //! Place children at the screw hole positions
for($side = [-1, 1])
translate([-psu_length(type) / 2 - boss_r - 1, psu_shroud_centre_y(type) + $side * psu_shroud_pitch(type) / 2])
children();
module psu_shroud_cable_positions(type, cable_d, cables = 1) //! Place children at the cable tie positions
for(i = [0 : 1 : cables - 1])
translate([-psu_length(type) / 2 - psu_shroud_extent(type) + cable_tie_inset,
psu_shroud_centre_y(type) + (i - cables / 2 + 0.5) * psu_shroud_cable_pitch(cable_d)])
children();
module psu_shroud_holes(type, cable_d, cables = 1) { //! Drill the screw and ziptie holes
psu_shroud_hole_positions(type)
drill(screw_clearance_radius(screw), 0);
psu_shroud_cable_positions(type, cable_d, cables)
cable_tie_holes(cable_d / 2, h = 0);
}
module psu_shroud(type, cable_d, name, cables = 1) { //! Generate the STL file for a specified ssr and cable
stl(str("psu_shroud_", name));
extent = psu_shroud_extent(type);
depth = psu_shroud_depth(type);
width = psu_shroud_width(type);
height = psu_shroud_height(type);
centre_x = -psu_length(type) / 2 - psu_shroud_extent(type) + psu_shroud_depth(type) / 2;
centre_y = psu_shroud_centre_y(type);
terminal_clearance = 0.5;
tb = psu_terminals(type).z;
module shape() {
difference() {
round(or = wall / 2 - eps, ir = 0) difference() {
rounded_square([depth, width], rad);
rounded_square([depth - 2 * wall, width - 2 * wall], rad - wall);
translate([depth / 2, 0])
square([2 * rad, width], center = true);
translate([depth / 2, width / 2 - 5])
square([2 * (overlap + terminal_clearance), 10], center = true);
}
for(i = [0 : 1 : cables - 1])
translate([0, (i - cables / 2 + 0.5) * psu_shroud_cable_pitch(cable_d)])
square([depth + 1, cable_d], center = true);
}
}
// base and sides
translate([centre_x, -centre_y]) {
rounded_rectangle([depth - eps, width - eps, top], rad, center = false);
linear_extrude(height = height)
difference() {
shape();
translate([depth / 2, width / 2 - 5])
square([2 * (depth - extent + terminal_clearance), 10], center = true);
}
linear_extrude(height = height - terminal_block_height(tb) - psu_terminal_block_z(type) - terminal_clearance)
shape();
}
// cable slots
for(i = [0 : 1 : cables - 1])
translate([centre_x - depth / 2 + wall / 2, -centre_y + (i - cables / 2 + 0.5) * psu_shroud_cable_pitch(cable_d), height / 2])
rotate([90, 0, 90])
linear_extrude(height = wall, center = true)
difference() {
square([cable_d + eps, height], center = true);
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);
}
}
}
module psu_shroud_assembly(type, cable_d, name, cables = 1) //! The printed parts with inserts fitted
assembly(str("psu_shroud_", name)) {
translate_z(psu_shroud_height(type))
vflip()
color(pp1_colour) psu_shroud(type, cable_d, name, cables);
psu_shroud_hole_positions(type)
vflip()
insert(insert);
}
module psu_shroud_fastened_assembly(type, cable_d, thickness, name, cables = 1) //! Assembly with screws in place
{
washer = screw_washer(screw);
screw_length = screw_shorter_than(2 * washer_thickness(washer) + thickness + insert_length(insert) + counter_bore);
psu_shroud_assembly(type, cable_d, name, cables);
translate_z(-thickness)
psu_shroud_hole_positions(type)
vflip()
screw_and_washer(screw, screw_length, true);
psu_shroud_cable_positions(type, cable_d, cables)
cable_tie(cable_d / 2, thickness);
}

View File

@@ -147,7 +147,7 @@ module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a spec
module ssr_shroud_assembly(type, cable_d, name) //! The printed parts with inserts fitted
assembly(str("ssr_shroud_", name)) {
translate_z(ssr_height(type) + top)
translate_z(ssr_shroud_height(type))
vflip()
color(pp1_colour) ssr_shroud(type, cable_d, name);

View File

@@ -29,12 +29,12 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
<tr><td> <a href = "#Displays">Displays</a> </td><td> <a href = "#Rockers">Rockers</a> </td><td> <a href = "#Fixing_block">Fixing_block</a> </td><td> <a href = "#Quadrant">Quadrant</a> </td><td></td></tr>
<tr><td> <a href = "#D_connectors">D_connectors</a> </td><td> <a href = "#Rod">Rod</a> </td><td> <a href = "#Foot">Foot</a> </td><td> <a href = "#Round">Round</a> </td><td></td></tr>
<tr><td> <a href = "#Fans">Fans</a> </td><td> <a href = "#Screws">Screws</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 = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#Sealing_strip">Sealing_strip</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#Rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
<tr><td> <a href = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Sheets">Sheets</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr>
<tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr>
<tr><td> <a href = "#Inserts">Inserts</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr>
<tr><td> <a href = "#Jack">Jack</a> </td><td> <a href = "#Springs">Springs</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 = "#Ssrs">Ssrs</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#Sealing_strip">Sealing_strip</a> </td><td> <a href = "#Psu_shroud">Psu_shroud</a> </td><td> <a href = "#Rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
<tr><td> <a href = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Sheets">Sheets</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr>
<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 = "#Sweep">Sweep</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> <a href = "#Tube">Tube</a> </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>
@@ -3410,7 +3410,6 @@ inserts don't grip well in rubber.
### Functions
| Function | Description |
|:--- |:--- |
| ```foot()``` | Default foot used unless a list of parameters is passed |
| ```insert_foot()``` | Default foot with insert |
### Modules
@@ -3497,6 +3496,64 @@ Printed handle that can be printed without needing support material due to its t
| 1 | handle_assembly |
<a href="#top">Top</a>
---
<a name="Psu_shroud"></a>
## Psu_shroud
A cover to go over the mains end of a PSU terminal strip to make it safe.
The stl and assembly must be given a name and parameterless wrappers for the stl and assembly added to the project.
[printed/psu_shroud.scad](printed/psu_shroud.scad) Implementation.
[tests/psu_shroud.scad](tests/psu_shroud.scad) Code for this example.
### Functions
| Function | Description |
|:--- |:--- |
| ```psu_shroud_cable_pitch(cable_d)``` | Pitch between cable entries |
| ```psu_shroud_centre_y(type)``` | Shroud centre relative to PSU centre |
| ```psu_shroud_depth(type)``` | Outside depth of the shroud |
| ```psu_shroud_extent(type)``` | How far it extends beyond the PSU to clear the connections |
| ```psu_shroud_height(type)``` | Outside height |
| ```psu_shroud_screw(type)``` | Screw used to fasten |
| ```psu_shroud_width(type)``` | Outside width of the shroud |
### Modules
| Module | Description |
|:--- |:--- |
| ```psu_shroud(type, cable_d, name, cables = 1)``` | Generate the STL file for a specified ssr and cable |
| ```psu_shroud_assembly(type, cable_d, name, cables = 1)``` | The printed parts with inserts fitted |
| ```psu_shroud_cable_positions(type, cable_d, cables = 1)``` | Place children at the cable tie positions |
| ```psu_shroud_fastened_assembly(type, cable_d, thickness, name, cables = 1)``` | Assembly with screws in place |
| ```psu_shroud_hole_positions(type)``` | Place children at the screw hole positions |
| ```psu_shroud_holes(type, cable_d, cables = 1)``` | Drill the screw and ziptie holes |
![psu_shroud](tests/png/psu_shroud.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 4 | ```insert(F1BM3)``` | Heatfit insert M3 |
| 4 | ```screw(M3_cap_screw, 10)``` | Screw M3 cap x 10mm |
| 4 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
| 4 | ```star_washer(M3_washer)``` | Washer star M3 x 0.5mm |
| 2 | ```ziptie(small_ziptie, 3)``` | Ziptie 100mm min length |
### Printed
| Qty | Filename |
| ---:|:--- |
| 1 | psu_shroud_PD_150_12.stl |
| 1 | psu_shroud_S_250_48.stl |
### Assemblies
| Qty | Name |
| ---:|:--- |
| 1 | psu_shroud_PD_150_12_assembly |
| 1 | psu_shroud_S_250_48_assembly |
<a href="#top">Top</a>
---
@@ -4220,12 +4277,17 @@ Global constants, functions and modules. This file is used directly or indirectl
| Function | Description |
|:--- |:--- |
| ```Len(x)``` | Returns the length of a list or 0 if ```x``` is not a list |
| ```cm(x)``` | cm to mm conversion |
| ```echoit(x)``` | Echo expression and return it, useful for debugging |
| ```foot(x)``` | Foot to mm conversion |
| ```in(list, x)``` | Returns true if ```x``` is an element in the ```list``` |
| ```inch(x)``` | Inch to mm conversion |
| ```inch(x)``` | Inch to mm conversion (For fractional inches, 'inch(1 + 7/8)' will work as expected.) |
| ```m(x)``` | m to mm conversion |
| ```mm(x)``` | Explicit mm specified |
| ```r2sides(r)``` | Replicates the OpenSCAD logic to calculate the number of sides from the radius |
| ```r2sides4n(r)``` | Round up the number of sides to a multiple of 4 to ensure points land on all axes |
| ```sqr(x)``` | Returns the square of ```x``` |
| ```yard(x)``` | Yard to mm conversion |
### Modules
| Module | Description |

BIN
tests/png/psu_shroud.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

38
tests/psu_shroud.scad Normal file
View File

@@ -0,0 +1,38 @@
//
// 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/screws.scad>
include <../vitamins/psus.scad>
use <../printed/psu_shroud.scad>
thickness = 3;
module psu_shrouds()
layout([for(p = psus) psu_width(p)], 10) let(psu = psus[$i])
if(psu_terminals(psu))
rotate(90) {
if($preview)
psu_shroud_fastened_assembly(psu, 6, thickness, psu[0]);
else
psu_shroud(psu, 6, psu[0]);
}
psu_shrouds();

View File

@@ -31,7 +31,7 @@ module ssr_shrouds()
if($preview)
ssr_shroud_fastened_assembly(ssr, 6, thickness, ssr[0]);
else
ssr_shroud(ssrs[$i], 6, ssr[0]);
ssr_shroud(ssr, 6, ssr[0]);
}
ssr_shrouds();

View File

@@ -22,8 +22,14 @@
//
include <../../global_defs.scad>
function inch(x) = x * 25.4; //! Inch to mm conversion (For fractional inches, 'inch(1 + 7/8)' will work as expected.)
function foot(x) = x * 25.4 * 12; //! Foot to mm conversion
function yard(x) = x * 25.4 * 12 * 3; //! Yard to mm conversion
function mm(x) = x; //! Explicit mm specified
function cm(x) = x * 10.0; //! cm to mm conversion
function m(x) = x * 1000.0; //! m to mm conversion
function sqr(x) = x * x; //! Returns the square of ```x```
function inch(x) = x * 25.4; //! Inch to mm conversion
function echoit(x) = echo(x) x; //! Echo expression and return it, useful for debugging
function in(list, x) = !!len([for(v = list) if(v == x) true]); //! Returns true if ```x``` is an element in the ```list```
function Len(x) = is_list(x) ? len(x) : 0; //! Returns the length of a list or 0 if ```x``` is not a list

View File

@@ -31,4 +31,4 @@ LED10mm = ["LED10mm", 10, 11.0, 2.0, 13.5, 2.54, 0.4];
LEDs = [LED3mm, LED5mm, LED10mm];
use <LED.scad>
use <led.scad>

View File

@@ -139,6 +139,8 @@ module psu_grill(width, height) {
}
}
function psu_terminal_block_z(type) = psu_face_cutouts(psu_faces(type)[f_left])[0][2].y + psu_height(type) / 2;
module psu(type) { //! Draw a power supply
vitamin(str("psu(", type[0], "): PSU ", psu_name(type)));
@@ -242,7 +244,7 @@ module psu(type) { //! Draw a power supply
rt = psu_face_thickness(faces[f_right]);
lt = psu_face_thickness(faces[f_left]);
cutout = psu_face_cutouts(faces[f_left])[0];
z = cutout[2].y + h / 2;
z = psu_terminal_block_z(type);
pw = w -ft - bt;
pl = l - right - rt;
pcb_thickness = 1.6;

View File

@@ -38,8 +38,7 @@ function cable_wire_size(cable) = cable[1]; //! Size of each wire in a bundle
// numbers from http://mathworld.wolfram.com/CirclePacking.html
function cable_radius(cable) = [0, 1, 2, 2.15, 2.41, 2.7, 3, 3, 3.3][cable_wires(cable)] * cable_wire_size(cable) / 2; //! Radius of a bundle of wires, see <http://mathworld.wolfram.com/CirclePacking.html>.
function wire_hole_radius(cable) = cable_radius(cable) + 0.5; //! Radius of a hole to accept a bundle of wires
function wire_hole_radius(cable) = ceil(2 * cable_radius(cable) +1) / 2; //! Radius of a hole to accept a bundle of wires
function cable_bundle(cable) = //! Arrangement of a bundle in a flat cable clip
[[0,0], [1,1], [2,1], [2, 0.5 + sin(60)], [2,2], [3, 0.5 + sin(60)], [3,2]][cable_wires(cable)];