1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-09-04 12:45:30 +02:00

Compare commits

...

15 Commits

Author SHA1 Message Date
Chris Palmer
13624eb9bd Added printed SSR shrouds 2019-06-22 12:36:07 +01:00
Chris Palmer
9ccdf3c075 IEC mains connector models more accurate. 2019-06-20 11:59:13 +01:00
Chris Palmer
bb6af0233d Removed debug code 2019-06-18 11:23:31 +01:00
Chris Palmer
774bdbe2cd Printed parts, dxfs and subassemblies now listed alphabetically.
JSON BOM now simplified and in required order.
2019-06-18 11:21:14 +01:00
Chris Palmer
8d49f2b564 Fixed assembly counts in json nexted BOM.
Fixed assembly counts in build instructions.
2019-06-17 19:34:46 +01:00
Chris Palmer
ad8d7ae311 Fixed adding subassemblies more than once to build instructions and BOM. 2019-06-17 17:36:28 +01:00
Chris Palmer
23e6925091 No excludes target.scad from dependencies. 2019-06-17 16:31:58 +01:00
Chris Palmer
ab6c529905 Added missing init() for coloured text. 2019-06-17 14:29:35 +01:00
Chris Palmer
757e88ed0c Fixed bugs in poly_ring() and insert_boss().
IEC screw length fixed at 10 if inserts used.
2019-06-16 17:07:02 +01:00
Chris Palmer
7eaace0194 Added degree symbols 2019-06-15 08:43:42 +01:00
Chris Palmer
7c9c6805f7 Typo 2019-06-15 08:18:33 +01:00
Chris Palmer
4a55e8eb6c Added hflip(). 2019-06-14 21:38:12 +01:00
Chris Palmer
bf4f64e7bc Removed Z-fighting on 3D hot end 2019-06-14 17:48:29 +01:00
Chris Palmer
a51e96ec43 Nuts now show their thickness on the BOM so half nuts have a different description. 2019-06-14 17:13:12 +01:00
Chris Palmer
b719601a64 Fixed cable strip parameters and BOM desciption 2019-06-14 16:54:51 +01:00
43 changed files with 569 additions and 254 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -1,64 +1,69 @@
{
"name": "main_assembly",
"count": 1,
"assemblies": [
{
"name": "mains_in_assembly",
"count": 1,
"assemblies": [
{
"name": "feet_assembly",
"count": 1,
"assemblies": [
{
"name": "base_assembly",
"count": 1,
"assemblies": [],
"vitamins": {
"insert(F1BM3): Heatfit insert M3": 2
},
"printed": {
"socket_box.stl": 1
},
"routed": {}
}
],
"vitamins": {
"washer(M3_washer): Washer M3 x 7mm x 0.5mm": 8,
"screw(M3_dome_screw, 10): Screw M3 dome x 10mm": 4,
"nut(M3_nut, nyloc = true): Nut M3 nyloc": 4
},
"printed": {
"foot.stl": 4
},
"routed": {}
}
],
"vitamins": {
": Wire green & yellow 30/0.25mm strands, length 150mm - not shown": 1,
": Wire blue 30/0.25mm strands, length 150mm - not shown": 1,
": Wire brown 30/0.25mm strands, length 150mm - not shown": 2,
"tubing(HSHRNK32): Heatshrink sleeving ID 3.2mm x 15mm - not shown": 3,
"iec(IEC_inlet_atx): IEC inlet for ATX": 1,
"screw(M3_cs_cap_screw, 12): Screw M3 cs cap x 12mm": 2,
"washer(M3_washer): Washer M3 x 7mm x 0.5mm": 2,
"nut(M3_nut, nyloc = true): Nut M3 nyloc": 2
},
"printed": {},
"routed": {}
}
],
"vitamins": {
": Wire green & yellow 30/0.25mm strands, length 150mm - not shown": 1,
": Wire blue 30/0.25mm strands, length 150mm - not shown": 1,
"tubing(HSHRNK32): Heatshrink sleeving ID 3.2mm x 15mm - not shown": 5,
": Ferrule for 1.5mm^2 wire - not shown": 3,
"mains_socket(Contactum): Mains socket 13A": 1,
"screw(M3_cs_cap_screw, 20): Screw M3 cs cap x 20mm": 2,
"jack_4mm_shielded(\"blue\", 3, \"royalblue\"): 4mm shielded jack socket blue": 2,
"jack_4mm_shielded(\"brown\", 3, \"sienna\"): 4mm shielded jack socket brown": 1,
"jack_4mm_shielded(\"green\", 3): 4mm shielded jack socket green": 2
[
{
"name": "base_assembly",
"count": 1,
"assemblies": {},
"vitamins": {
"insert(F1BM3): Heatfit insert M3": 2
},
"printed": {
"socket_box.stl": 1
},
"routed": {}
},
"printed": {},
"routed": {}
}
{
"name": "feet_assembly",
"count": 1,
"assemblies": {
"base_assembly": 1
},
"vitamins": {
"washer(M3_washer): Washer M3 x 7mm x 0.5mm": 8,
"screw(M3_dome_screw, 10): Screw M3 dome x 10mm": 4,
"nut(M3_nut, nyloc = true): Nut M3 x 2.4mm nyloc": 4
},
"printed": {
"foot.stl": 4
},
"routed": {}
},
{
"name": "mains_in_assembly",
"count": 1,
"assemblies": {
"feet_assembly": 1
},
"vitamins": {
": Wire green & yellow 30/0.25mm strands, length 150mm - not shown": 1,
": Wire blue 30/0.25mm strands, length 150mm - not shown": 1,
": Wire brown 30/0.25mm strands, length 150mm - not shown": 2,
"tubing(HSHRNK32): Heatshrink sleeving ID 3.2mm x 15mm - not shown": 3,
"iec(IEC_inlet_atx): IEC inlet for ATX": 1,
"screw(M3_cs_cap_screw, 12): Screw M3 cs cap x 12mm": 2,
"washer(M3_washer): Washer M3 x 7mm x 0.5mm": 2,
"nut(M3_nut, nyloc = true): Nut M3 x 2.4mm nyloc": 2
},
"printed": {},
"routed": {}
},
{
"name": "main_assembly",
"count": 1,
"assemblies": {
"mains_in_assembly": 1
},
"vitamins": {
": Wire green & yellow 30/0.25mm strands, length 150mm - not shown": 1,
": Wire blue 30/0.25mm strands, length 150mm - not shown": 1,
"tubing(HSHRNK32): Heatshrink sleeving ID 3.2mm x 15mm - not shown": 5,
": Ferrule for 1.5mm^2 wire - not shown": 3,
"mains_socket(Contactum): Mains socket 13A": 1,
"screw(M3_cs_cap_screw, 20): Screw M3 cs cap x 20mm": 2,
"jack_4mm_shielded(\"blue\", 3, \"royalblue\"): 4mm shielded jack socket blue": 2,
"jack_4mm_shielded(\"brown\", 3, \"sienna\"): 4mm shielded jack socket brown": 1,
"jack_4mm_shielded(\"green\", 3): 4mm shielded jack socket green": 2
},
"printed": {},
"routed": {}
}
]

View File

@@ -17,7 +17,7 @@ Vitamins:
| | 1| | 1 4mm shielded jack socket brown
| | 2| | 2 4mm shielded jack socket green
| | 1| | 1 Mains socket 13A
| 4| | 2| 6 Nut M3 nyloc
| 4| | 2| 6 Nut M3 x 2.4mm nyloc
| | | 2| 2 Screw M3 cs cap x 12mm
| | 2| | 2 Screw M3 cs cap x 20mm
| 4| | | 4 Screw M3 dome x 10mm

View File

@@ -1,6 +1,6 @@
feet_assembly:
Vitamins:
4 Nut M3 nyloc
4 Nut M3 x 2.4mm nyloc
4 Screw M3 dome x 10mm
8 Washer M3 x 7mm x 0.5mm

View File

@@ -4,7 +4,7 @@ Vitamins:
2 Wire brown 30/0.25mm strands, length 150mm - not shown
1 Wire green & yellow 30/0.25mm strands, length 150mm - not shown
1 IEC inlet for ATX
2 Nut M3 nyloc
2 Nut M3 x 2.4mm nyloc
2 Screw M3 cs cap x 12mm
3 Heatshrink sleeving ID 3.2mm x 15mm - not shown
2 Washer M3 x 7mm x 0.5mm

View File

@@ -39,7 +39,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|   .  |   .  |   3  |   5  |   8  |    Heatshrink sleeving ID 3.2mm x 15mm - not shown |
|   .  |   .  |   1  |   .  |   1  |    IEC inlet for ATX |
|   .  |   .  |   .  |   1  |   1  |    Mains socket 13A |
|   .  |   4  |   2  |   .  |   6  |    Nut M3 nyloc |
|   .  |   4  |   2  |   .  |   6  |    Nut M3 x 2.4mm nyloc |
|   .  |   .  |   2  |   .  |   2  |    Screw M3 cs cap x 12mm |
|   .  |   .  |   .  |   2  |   2  |    Screw M3 cs cap x 20mm |
|   .  |   4  |   .  |   .  |   4  |    Screw M3 dome x 10mm |
@@ -88,7 +88,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|--:|:----------|
|8| Washer M3 x 7mm x 0.5mm|
|4| Screw M3 dome x 10mm|
|4| Nut M3 nyloc|
|4| Nut M3 x 2.4mm nyloc|
### 3D Printed parts
@@ -129,7 +129,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|1| IEC inlet for ATX|
|2| Screw M3 cs cap x 12mm|
|2| Washer M3 x 7mm x 0.5mm|
|2| Nut M3 nyloc|
|2| Nut M3 x 2.4mm nyloc|
### Sub-assemblies

View File

@@ -60,7 +60,7 @@ insert_length = insert_length(insert);
insert_boss = mains_socket_insert_boss(socket);
screw_length = screw_longer_than(mains_socket_height(socket) + insert_length(insert));
iec_h = iec_slot_h(iec) + 1;
iec_h = iec_body_h(iec) + 1;
box_height = socket_depth + iec_h;
base_thickness = wall;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 657 KiB

After

Width:  |  Height:  |  Size: 660 KiB

View File

@@ -86,6 +86,7 @@ use <tests/ribbon_clamp.scad>
use <tests/screw_knob.scad>
use <tests/socket_box.scad>
use <tests/strap_handle.scad>
use <tests/ssr_shroud.scad>
x5 = 800;
@@ -300,9 +301,12 @@ translate([x3 + 15, modules_y])
translate([x3 + 40, modules_y])
modules();
translate([x3, ssrs_y])
translate([x3, ssrs_y]) {
ssrs();
ssr_shrouds();
}
translate([x3, blowers_y])
blowers();

154
printed/ssr_shroud.scad Normal file
View File

@@ -0,0 +1,154 @@
//
// 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 an SSR to make it safe to be touched.
//! 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/ssr.scad>
use <../utils/round.scad>
wall = 1.8;
top = 1.5;
screw = M3_cap_screw;
screw_length = 10;
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 = 3;
clearance = layer_height;
function ssr_shroud_pitch(type) = ssr_width(type) + 2 * wall - 2 * boss_r - eps;
function ssr_shroud_screw(type) = screw; //! Screw used to fasten
function ssr_shroud_extent(type, cable_d) = 2 * boss_r + 1 + cable_d + rad; //! How far it extends beyond the SSR
function ssr_shroud_width(type) = ssr_width(type) + 2 * wall + clearance; //! Outside width of shroud
function ssr_shroud_height(type) = ssr_height(type) + top + clearance; //! Outside height
module ssr_shroud_hole_positions(type) //! Place children at the screw hole positions
for($side = [-1, 1])
translate([-ssr_length(type) / 2 -boss_r, $side * ssr_shroud_pitch(type) / 2])
vflip()
children();
module ssr_shroud_holes(type) //: Drill the screw holes
ssr_shroud_hole_positions(type)
drill(screw_clearance_radius(screw), 0);
module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a specified ssr and cable
stl(str("ssr_shroud_", name));
width = ssr_shroud_width(type);
depth = ssr_length(type) / 3 + ssr_shroud_extent(type, cable_d);
height = ssr_shroud_height(type);
cable_x = -ssr_length(type) / 2 - 2 * boss_r - 1 - cable_d / 2;
center_x = -ssr_length(type) / 6 - depth / 2;
translate([center_x, 0]) {
rounded_rectangle([depth - eps, width - eps, top], rad, center = false);
linear_extrude(height = height) 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([cable_x - center_x, 0])
square([cable_d, width + 1], center = true);
}
}
for(side = [-1, 1])
translate([cable_x, side * (width / 2 - wall / 2), height / 2])
rotate([90, 0, 0])
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);
}
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));
}
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);
}
ssr_shroud_hole_positions(type)
hull() {
translate_z(-height + boss_h2) {
cylinder(h = eps, r = boss_r);
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);
}
}
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)
vflip()
color(pp1_colour) ssr_shroud(type, cable_d, name);
ssr_shroud_hole_positions(type)
insert(insert);
}
module ssr_shroud_fastened_assembly(type, cable_d, thickness, name) //! Assembly with screws in place
{
ssr_shroud_assembly(type, cable_d, name);
translate_z(-thickness)
ssr_shroud_hole_positions(type)
screw_and_washer(screw, screw_length, true);
}

165
readme.md
View File

@@ -32,8 +32,8 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
<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 = "#Strap_handle">Strap_handle</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></td><td></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 = "#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>
@@ -373,20 +373,16 @@ When the sides are constrained then a circular model is more accurate.
### Modules
| Module | Description |
|:--- |:--- |
| ```bezier_cable_strip(ways, depth, length, travel, pos, below, extra)``` | Draw a cable strip using a Bezier curve |
| ```cable_strip(ways, depth, travel, x, extra = 15)``` | Draw a cable stripe with a semi circular fold |
| ```bezier_cable_strip(ways, depth, length, below, extra, pos = 0)``` | Draw a cable strip using a Bezier curve |
| ```cable_strip(ways, depth, travel, extra = 15, pos = 0)``` | Draw a cable stripe with a semi circular fold |
![cable_strips](tests/png/cable_strips.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```bezier_cable_strip(20, 50, 150, 100, -100, 100, 10)``` | Polypropylene strip 170mm x 26mm x 0.8mm |
| 1 | ```bezier_cable_strip(20, 50, 150, 100, 0, 100, 10)``` | Polypropylene strip 170mm x 26mm x 0.8mm |
| 1 | ```bezier_cable_strip(20, 50, 150, 100, 100, 100, 10)``` | Polypropylene strip 170mm x 26mm x 0.8mm |
| 1 | ```cable_strip(20, 25, 100, -100, 30)``` | Polypropylene strip 189mm x 24mm x 0.8mm |
| 1 | ```cable_strip(20, 25, 100, 0, 30)``` | Polypropylene strip 189mm x 24mm x 0.8mm |
| 1 | ```cable_strip(20, 25, 100, 100, 30)``` | Polypropylene strip 189mm x 24mm x 0.8mm |
| 3 | ```bezier_cable_strip(20, 50, 150, 100, 10)``` | Polypropylene strip 170mm x 26mm x 0.8mm |
| 3 | ```cable_strip(20, 25, 100, 30)``` | Polypropylene strip 189mm x 24mm x 0.8mm |
<a href="#top">Top</a>
@@ -641,9 +637,9 @@ Can draw three styles: solid, open frame and open frame with screw bosses.
| 1 | ```fan(fan70x15)``` | Fan 70mm x 15mm |
| 1 | ```fan(fan80x25)``` | Fan 80mm x 25mm |
| 1 | ```fan(fan80x38)``` | Fan 80mm x 38mm |
| 4 | ```nut(M2p5_nut, nyloc = true)``` | Nut M2.5 nyloc |
| 8 | ```nut(M3_nut, nyloc = true)``` | Nut M3 nyloc |
| 28 | ```nut(M4_nut, nyloc = true)``` | Nut M4 nyloc |
| 4 | ```nut(M2p5_nut, nyloc = true)``` | Nut M2.5 x 2.2mm nyloc |
| 8 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 28 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 4 | ```screw(M2p5_pan_screw, 20)``` | Screw M2.5 pan x 20mm |
| 8 | ```screw(M3_dome_screw, 20)``` | Screw M3 dome x 20mm |
| 20 | ```screw(M4_dome_screw, 16)``` | Screw M4 dome x 16mm |
@@ -770,6 +766,10 @@ IEC mains inlets and outlet.
| ```iec_bezel_r(type)``` | Bezel corner radius |
| ```iec_bezel_t(type)``` | Bezel thickness |
| ```iec_bezel_w(type)``` | Bezel width |
| ```iec_body_h(type)``` | Body height |
| ```iec_body_r(type)``` | Body corner radius |
| ```iec_body_w(type)``` | Body width |
| ```iec_body_w2(type)``` | Body width at the narrow part |
| ```iec_depth(type)``` | Depth of the body below the flange |
| ```iec_flange_h(type)``` | Flange height |
| ```iec_flange_r(type)``` | Flange corner radius |
@@ -779,18 +779,21 @@ IEC mains inlets and outlet.
| ```iec_part(type)``` | Description |
| ```iec_pitch(type)``` | Screw hole pitch |
| ```iec_screw(type)``` | Screw type |
| ```iec_slot_h(type)``` | Body height |
| ```iec_slot_r(type)``` | Body corner radius |
| ```iec_slot_w(type)``` | Body width |
| ```iec_spades(type)``` | Spade type |
| ```iec_width(type)``` | Widest part including the lugs |
### Functions
| Function | Description |
|:--- |:--- |
| ```iec_insert_screw_length()``` | Screw length used for inserts |
### Modules
| Module | Description |
|:--- |:--- |
| ```iec(type)``` | Draw specified IEC connector |
| ```iec_assembly(type, thickness)``` | Assembly with fasteners given panel thickness |
| ```iec_holes(type, h = 100, poly = false, horizontal = false, insert = false)``` | Drill the required panel holes |
| ```iec_inserts(type)``` | Place the inserts |
| ```iec_screw_positions(type)``` | Position children at the screw holes |
![iecs](tests/png/iecs.png)
@@ -798,14 +801,15 @@ IEC mains inlets and outlet.
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```iec(IEC_fused_inlet)``` | IEC fused inlet |
| 1 | ```iec(IEC_fused_inlet)``` | IEC fused inlet JR-101-1F |
| 1 | ```iec(IEC_fused_inlet2)``` | IEC fused inlet old |
| 1 | ```iec(IEC_inlet)``` | IEC inlet |
| 1 | ```iec(IEC_inlet_atx)``` | IEC inlet for ATX |
| 1 | ```iec(IEC_outlet)``` | IEC outlet |
| 8 | ```nut(M3_nut, nyloc = true)``` | Nut M3 nyloc |
| 1 | ```iec(IEC_outlet)``` | IEC outlet RS 811-7193 |
| 10 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 4 | ```screw(M3_cs_cap_screw, 10)``` | Screw M3 cs cap x 10mm |
| 4 | ```screw(M3_cs_cap_screw, 12)``` | Screw M3 cs cap x 12mm |
| 8 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
| 6 | ```screw(M3_cs_cap_screw, 12)``` | Screw M3 cs cap x 12mm |
| 10 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
<a href="#top">Top</a>
@@ -1316,7 +1320,7 @@ Random screw down modules. Currently just DROK buck converters.
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```mod(drok_buck)``` | Drok buck converter |
| 2 | ```nut(M4_nut, nyloc = true)``` | Nut M4 nyloc |
| 2 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 2 | ```screw(M4_dome_screw, 12)``` | Screw M4 dome x 12mm |
| 4 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm |
@@ -1366,23 +1370,23 @@ If a nut is given a child then it gets placed on its top surface.
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```nut(M2_nut)``` | Nut M2 |
| 1 | ```nut(M2_nut, nyloc = true)``` | Nut M2 nyloc |
| 1 | ```nut(M2p5_nut)``` | Nut M2.5 |
| 1 | ```nut(M2p5_nut, nyloc = true)``` | Nut M2.5 nyloc |
| 1 | ```nut(M2p5_nut, nylon = true)``` | Nut M2.5 nylon |
| 1 | ```nut(M3_nut)``` | Nut M3 |
| 1 | ```nut(M3_nut, brass = true)``` | Nut M3 brass |
| 1 | ```nut(M3_nut, nyloc = true)``` | Nut M3 nyloc |
| 1 | ```nut(M4_nut)``` | Nut M4 |
| 1 | ```nut(M4_nut, nyloc = true)``` | Nut M4 nyloc |
| 1 | ```nut(M5_nut)``` | Nut M5 |
| 1 | ```nut(M5_nut, nyloc = true)``` | Nut M5 nyloc |
| 1 | ```nut(M6_nut)``` | Nut M6 |
| 1 | ```nut(M6_half_nut)``` | Nut M6 |
| 1 | ```nut(M6_nut, nyloc = true)``` | Nut M6 nyloc |
| 1 | ```nut(M8_nut)``` | Nut M8 |
| 1 | ```nut(M8_nut, nyloc = true)``` | Nut M8 nyloc |
| 1 | ```nut(M2_nut)``` | Nut M2 x 1.6mm |
| 1 | ```nut(M2_nut, nyloc = true)``` | Nut M2 x 1.6mm nyloc |
| 1 | ```nut(M2p5_nut)``` | Nut M2.5 x 2.2mm |
| 1 | ```nut(M2p5_nut, nyloc = true)``` | Nut M2.5 x 2.2mm nyloc |
| 1 | ```nut(M2p5_nut, nylon = true)``` | Nut M2.5 x 2.2mm nylon |
| 1 | ```nut(M3_nut)``` | Nut M3 x 2.4mm |
| 1 | ```nut(M3_nut, brass = true)``` | Nut M3 x 2.4mm brass |
| 1 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 1 | ```nut(M4_nut)``` | Nut M4 x 3.2mm |
| 1 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 1 | ```nut(M5_nut)``` | Nut M5 x 4mm |
| 1 | ```nut(M5_nut, nyloc = true)``` | Nut M5 x 4mm nyloc |
| 1 | ```nut(M6_half_nut)``` | Nut M6 x 3mm |
| 1 | ```nut(M6_nut)``` | Nut M6 x 5mm |
| 1 | ```nut(M6_nut, nyloc = true)``` | Nut M6 x 5mm nyloc |
| 1 | ```nut(M8_nut)``` | Nut M8 x 6.5mm |
| 1 | ```nut(M8_nut, nyloc = true)``` | Nut M8 x 6.5mm nyloc |
| 1 | ```washer(M6_washer)``` | Washer M6 x 12.5mm x 1.5mm |
| 1 | ```wingnut(M4_wingnut)``` | Wingnut M4 |
@@ -1540,10 +1544,10 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 2 | | Micro SD card |
| 1 | ```molex_254(2)``` | Molex KK header 2 way |
| 1 | ```molex_254(3)``` | Molex KK header 3 way |
| 16 | ```nut(M2_nut, nyloc = true)``` | Nut M2 nyloc |
| 12 | ```nut(M2p5_nut, nyloc = true)``` | Nut M2.5 nyloc |
| 12 | ```nut(M3_nut, nyloc = true)``` | Nut M3 nyloc |
| 4 | ```nut(M4_nut, nyloc = true)``` | Nut M4 nyloc |
| 16 | ```nut(M2_nut, nyloc = true)``` | Nut M2 x 1.6mm nyloc |
| 12 | ```nut(M2p5_nut, nyloc = true)``` | Nut M2.5 x 2.2mm nyloc |
| 12 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 4 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 1 | ```pcb(PI_IO)``` | PI_IO V2 |
| 1 | ```pcb(PSU12V1A)``` | PSU 12V 1A |
| 1 | ```pcb(PERF60x40)``` | Perfboard 60 x 40mm |
@@ -1841,9 +1845,9 @@ Linear rails with carriages.
| 1 | ```rail(MGN7, 200)``` | Linear rail MGN7 x 200mm |
| 1 | ```rail(MGN9, 200)``` | Linear rail MGN9 x 200mm |
| 1 | ```rail(SSR15, 200)``` | Linear rail SSR15 x 200mm |
| 26 | ```nut(M2_nut, nyloc = true)``` | Nut M2 nyloc |
| 17 | ```nut(M3_nut, nyloc = true)``` | Nut M3 nyloc |
| 4 | ```nut(M4_nut, nyloc = true)``` | Nut M4 nyloc |
| 26 | ```nut(M2_nut, nyloc = true)``` | Nut M2 x 1.6mm nyloc |
| 17 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 4 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 11 | ```screw(M2_cap_screw, 10)``` | Screw M2 cap x 10mm |
| 15 | ```screw(M2_cs_cap_screw, 10)``` | Screw M2 cs cap x 10mm |
| 8 | ```screw(M3_cap_screw, 10)``` | Screw M3 cap x 10mm |
@@ -1899,7 +1903,7 @@ Ring terminals and earth assemblies for DiBond panels.
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```nut(M3_nut, nyloc = true)``` | Nut M3 nyloc |
| 1 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 1 | ```ring_terminal(M3_ringterm)``` | Ring terminal 3mm |
| 1 | ```screw(M3_dome_screw, 10)``` | Screw M3 dome x 10mm |
| 2 | ```star_washer(M3_washer)``` | Washer star M3 x 0.5mm |
@@ -2307,7 +2311,7 @@ Solid state relays.
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 4 | ```nut(M4_nut, nyloc = true)``` | Nut M4 nyloc |
| 4 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 4 | ```screw(M4_cap_screw, 16)``` | Screw M4 cap x 16mm |
| 1 | ```ssr(SSR25DA)``` | Solid state relay Fotek 25A |
| 1 | ```ssr(SSR10DA)``` | Solid state relay Robodigg 10A |
@@ -2635,7 +2639,7 @@ Veroboard with mounting holes, track breaks, removed tracks, solder points and c
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 2 | ```idc_transition(2p54header, 10)``` | IDC transition header 10 x 2 |
| 4 | ```nut(M3_nut, nyloc = true)``` | Nut M3 nyloc |
| 4 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 4 | ```screw(M3_dome_screw, 25)``` | Screw M3 dome x 25mm |
| 2 | ```terminal_254(10)``` | Terminal block 10 way 0.1" |
| 2 | ```veroboard(z_vb)``` | Veroboard 5 holes x 22strips |
@@ -3155,7 +3159,7 @@ Rubber door [sealing strip](#sealing_strip) is used to make it airtight and a [d
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 4 | ```nut(M4_nut, nyloc = true)``` | Nut M4 nyloc |
| 4 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 2 | ```screw(M3_cap_screw, 35)``` | Screw M3 cap x 35mm |
| 4 | ```screw(M3_dome_screw, 10)``` | Screw M3 dome x 10mm |
| 4 | ```screw(M4_dome_screw, 16)``` | Screw M4 dome x 16mm |
@@ -3199,7 +3203,7 @@ Door latch for 6mm acrylic door for 3D printer. See [door_hinge](#door_hinge).
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```nut(M4_nut, nyloc = true)``` | Nut M4 nyloc |
| 1 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 1 | ```screw(M4_hex_screw, 20)``` | Screw M4 hex x 20mm |
| 2 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm |
@@ -3372,7 +3376,7 @@ inserts don't grip well in rubber.
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```insert(F1BM3)``` | Heatfit insert M3 |
| 1 | ```nut(M4_nut, nyloc = true)``` | Nut M4 nyloc |
| 1 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 1 | ```screw(M3_cap_screw, 8)``` | Screw M3 cap x 8mm |
| 1 | ```screw(M4_cap_screw, 16)``` | Screw M4 cap x 16mm |
| 1 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
@@ -3564,7 +3568,7 @@ UK 13A socket and printed backbox with earth terminal for the panel it is mounte
| 4 | ```insert(F1BM3)``` | Heatfit insert M3 |
| 1 | ```mains_socket(Contactum)``` | Mains socket 13A |
| 1 | ```mains_socket(MKLOGIC)``` | Mains socket 13A, switched |
| 2 | ```nut(M3_nut, nyloc = true)``` | Nut M3 nyloc |
| 2 | ```nut(M3_nut, nyloc = true)``` | Nut M3 x 2.4mm nyloc |
| 2 | ```ring_terminal(M3_ringterm)``` | Ring terminal 3mm |
| 4 | ```screw(M3_cs_cap_screw, 20)``` | Screw M3 cs cap x 20mm |
| 2 | ```screw(M3_dome_screw, 10)``` | Screw M3 dome x 10mm |
@@ -3583,6 +3587,58 @@ UK 13A socket and printed backbox with earth terminal for the panel it is mounte
| 1 | socket_box_MKLOGIC_assembly |
<a href="#top">Top</a>
---
<a name="Ssr_shroud"></a>
## Ssr_shroud
A cover to go over the mains end of an SSR to make it safe to be touched.
The stl and assembly must be given a name and parameterless wrappers for the stl and assembly added to the project.
[printed/ssr_shroud.scad](printed/ssr_shroud.scad) Implementation.
[tests/ssr_shroud.scad](tests/ssr_shroud.scad) Code for this example.
### Functions
| Function | Description |
|:--- |:--- |
| ```ssr_shroud_extent(type, cable_d)``` | How far it extends beyond the SSR |
| ```ssr_shroud_height(type)``` | Outside height |
| ```ssr_shroud_screw(type)``` | Screw used to fasten |
| ```ssr_shroud_width(type)``` | Outside width of shroud |
### Modules
| Module | Description |
|:--- |:--- |
| ```ssr_shroud(type, cable_d, name)``` | Generate the STL file for a specified ssr and cable |
| ```ssr_shroud_assembly(type, cable_d, name)``` | The printed parts with inserts fitted |
| ```ssr_shroud_fastened_assembly(type, cable_d, thickness, name)``` | Assembly with screws in place |
| ```ssr_shroud_hole_positions(type)``` | Place children at the screw hole positions |
![ssr_shroud](tests/png/ssr_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 |
### Printed
| Qty | Filename |
| ---:|:--- |
| 1 | ssr_shroud_SSR10DA.stl |
| 1 | ssr_shroud_SSR25DA.stl |
### Assemblies
| Qty | Name |
| ---:|:--- |
| 1 | ssr_shroud_SSR10DA_assembly |
| 1 | ssr_shroud_SSR25DA_assembly |
<a href="#top">Top</a>
---
@@ -4122,9 +4178,10 @@ Global constants, functions and modules. This file is used directly or indirectl
| ```circle4n(r, d = undef)``` | Circle with multiple of 4 vertices |
| ```ellipse(xr, yr)``` | Draw an ellipse |
| ```extrude_if(h, center = true)``` | Extrudes 2D object to 3D when ```h``` is nonzero, otherwise leaves it 2D |
| ```hflip()``` | Invert children by doing a 180&deg; flip around the Y axis |
| ```semi_circle(r, d = undef)``` | A semi circle in the positive Y domain |
| ```translate_z(z)``` | Shortcut for Z only translations |
| ```vflip()``` | Invert children by doing a 180 flip around the X axis |
| ```vflip()``` | Invert children by doing a 180&deg; flip around the X axis |
![global](tests/png/global.png)

View File

@@ -54,21 +54,13 @@ class BOM:
self.routed = {}
self.assemblies = {}
def data(self, main):
return {
"name" : self.name,
"count" : self.count,
"assemblies" : [main.assemblies[ass].data(main) for ass in self.assemblies],
"vitamins" : self.vitamins,
"printed" : self.printed,
"routed" : self.routed
}
def flat_data(self):
assemblies = {}
for ass in self.assemblies:
assemblies[ass] = self.assemblies[ass].count
return {
"name" : self.name,
"count" : self.count,
"assemblies" : assemblies,
"vitamins" : self.vitamins,
"printed" : self.printed,
@@ -167,6 +159,7 @@ class BOM:
def parse_bom(file = "openscad.log", name = None):
main = BOM(name)
main.ordered_assemblies = []
stack = []
for line in open(file):
@@ -179,6 +172,9 @@ def parse_bom(file = "openscad.log", name = None):
main.assemblies[stack[-1]].add_assembly(ass) #add to nested BOM
stack.append(ass)
main.add_assembly(ass) #add to flat BOM
if ass in main.ordered_assemblies:
main.ordered_assemblies.remove(ass)
main.ordered_assemblies.insert(0, ass)
else:
if s[0] == '}':
if s[1:] != stack[-1]:
@@ -227,14 +223,15 @@ def boms(target = None, assembly = None):
if assembly == "main_assembly":
main.print_bom(True, open(bom_dir + "/bom.txt","wt"))
for ass in sorted(main.assemblies):
for ass in main.assemblies:
with open(bom_dir + "/" + ass + ".txt", "wt") as f:
bom = main.assemblies[ass]
print(bom.make_name(ass) + ":", file=f)
bom.print_bom(False, f)
data = [main.assemblies[ass].flat_data() for ass in main.ordered_assemblies]
with open(bom_dir + "/bom.json", 'w') as outfile:
json.dump(main.assemblies[assembly].data(main), outfile, indent = 4)
json.dump(data, outfile, indent = 4)
print("done")

View File

@@ -33,7 +33,7 @@ def read_deps(dname):
for line in lines:
if line.startswith('\t'):
dep = line[1 : -1].rstrip(' \\')
if not dep in ['stl.scad', 'dxf.scad', 'svf.scad', 'png.scad']:
if not os.path.basename(dep) in ['stl.scad', 'dxf.scad', 'svf.scad', 'png.scad', 'target.scad']:
deps.append(dep)
return deps

View File

@@ -28,6 +28,7 @@ import os
import openscad
from tests import do_cmd, update_image, colour_scheme, background
from deps import mtime
from colorama import init
def render(target, type):
#
@@ -69,6 +70,7 @@ def render(target, type):
os.remove(png_maker_name)
if __name__ == '__main__':
init()
target = sys.argv[1] if len(sys.argv) > 1 else None
render(target, 'stl')
render(target, 'dxf')

View File

@@ -39,13 +39,25 @@ from colorama import Fore
def is_assembly(s):
return s[-9:] == '_assembly' or s[-11:] == '_assemblies'
def add_assembly(flat_bom, bom, bounds_map):
if not bom in flat_bom:
def bom_to_assemblies(bom_dir, bounds_map):
global flat_bom
#
# Make a list of all the parts in the BOM
#
bom_file = bom_dir + "/bom.json"
with open(bom_file) as json_file:
flat_bom = json.load(json_file)
#
# Decide if we need big or small assembly pictures
#
for bom in flat_bom:
big = False
for ass in bom["assemblies"]:
add_assembly(flat_bom, ass, bounds_map)
if ass["big"]:
big = True
for b in flat_bom:
if b["name"] == ass:
if b["big"]:
big = True
break
if not big:
for stl in bom["printed"]:
bounds = bounds_map[stl]
@@ -54,21 +66,10 @@ def add_assembly(flat_bom, bom, bounds_map):
if max(width, depth) > 80:
big = True
break
bom["big"] = big or bom["routed"]
flat_bom.append(bom)
def bom_to_assemblies(bom_dir, bounds_map):
global flat_bom
#
# Make a list of all the parts in the BOM
# Remove the main assembly if it is a shell
#
bom = {}
bom_file = bom_dir + "/bom.json"
with open(bom_file) as json_file:
bom = json.load(json_file)
flat_bom = []
add_assembly(flat_bom, bom, bounds_map)
ass = flat_bom[-1]
if len(ass["assemblies"]) < 2 and not ass["vitamins"] and not ass["printed"] and not ass["routed"]:
flat_bom = flat_bom[:-1]
@@ -273,49 +274,49 @@ def views(target, do_assemblies = None):
printed = ass["printed"]
if printed:
print('### 3D Printed parts', file = doc_file)
i = 0
for p in printed:
keys = sorted(list(printed.keys()))
for i in range(len(keys)):
p = keys[i]
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', printed[p], p), file = doc_file, end = '')
if (i % 3) == 2 or i == len(printed) - 1:
n = (i % 3) + 1
print('\n|%s' % ('--|' * n), file = doc_file)
for j in range(n):
part = list(printed.keys())[i - n + j + 1]
part = keys[i - n + j + 1]
print('| ![%s](stls/%s) %s' % (part, part.replace('.stl','.png'), '|\n' if j == j - 1 else ''), end = '', file = doc_file)
print('\n', file = doc_file)
i += 1
print('\n', file = doc_file)
routed = ass["routed"]
if routed:
print("### CNC Routed parts", file = doc_file)
i = 0
for r in routed:
keys = sorted(list(routed.keys()))
for i in range(len(keys)):
r = keys[i]
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', routed[r], r), file = doc_file, end = '')
if (i % 3) == 2 or i == len(routed) - 1:
n = (i % 3) + 1
print('\n|%s' % ('--|' * n), file = doc_file)
for j in range(n):
part = list(routed.keys())[i - n + j + 1]
part = keys[i - n + j + 1]
print('| ![%s](dxfs/%s) %s' % (part, part.replace('.dxf','.png'), '|\n' if j == j - 1 else ''), end = '', file = doc_file)
print('\n', file = doc_file)
i += 1
print('\n', file = doc_file)
sub_assemblies = ass["assemblies"]
if sub_assemblies:
print("### Sub-assemblies", file = doc_file)
i = 0
for a in sub_assemblies:
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', a["count"], a["name"]), file = doc_file, end = '')
if (i % 3) == 2 or i == len(sub_assemblies) - 1:
keys = sorted(list(sub_assemblies.keys()))
for i in range(len(keys)):
a = keys[i]
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', sub_assemblies[a], a), file = doc_file, end = '')
if (i % 3) == 2 or i == len(keys) - 1:
n = (i % 3) + 1
print('\n|%s' % ('--|' * n), file = doc_file)
for j in range(n):
a = sub_assemblies[i - n + j + 1]["name"].replace('_assembly', '_assembled')
a = keys[i - n + j + 1].replace('_assembly', '_assembled')
print('| ![%s](assemblies/%s) %s' % (a, a + '_tn.png', '|\n' if j == j - 1 else ''), end = '', file = doc_file)
print('\n', file = doc_file)
i += 1
print('\n', file = doc_file)
small = not ass["big"]

View File

@@ -24,11 +24,11 @@ module cable_strips() {
depth = 50;
rotate(-90)
for(pos = [-100, 0, 100]) {
bezier_cable_strip(ways = 20, depth = depth, length = 150, travel = 100, pos = pos, below = 100, extra = 10);
bezier_cable_strip(ways = 20, depth = depth, length = 150, below = 100, extra = 10, pos = pos);
translate([0, depth * 2])
rotate([0, -90, 0])
cable_strip(ways =20, depth = depth / 2, travel = 100, x = pos, extra = 30);
cable_strip(ways =20, depth = depth / 2, travel = 100, extra = 30, pos = pos);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

BIN
tests/png/ssr_shroud.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

37
tests/ssr_shroud.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/screws.scad>
include <../vitamins/ssrs.scad>
use <../printed/ssr_shroud.scad>
thickness = 3;
module ssr_shrouds()
layout([for(s = ssrs) ssr_width(s)], 15) let(ssr = ssrs[$i])
rotate(90) {
if($preview)
ssr_shroud_fastened_assembly(ssr, 6, thickness, ssr[0]);
else
ssr_shroud(ssrs[$i], 6, ssr[0]);
}
ssr_shrouds();

View File

@@ -23,8 +23,9 @@ include <../vitamins/screws.scad>
include <../vitamins/ssrs.scad>
module ssrs()
layout([for(s = ssrs) ssr_length(s)], 15)
ssr_assembly(ssrs[$i], M4_cap_screw, 3);
layout([for(s = ssrs) ssr_width(s)], 15)
rotate(90)
ssr_assembly(ssrs[$i], M4_cap_screw, 3);
if($preview)
ssrs();

View File

@@ -31,7 +31,8 @@ function r2sides(r) = $fn ? $fn : ceil(max(min(360/ $fa, r * 2 * PI / $fs), 5));
function r2sides4n(r) = floor((r2sides(r) + 3) / 4) * 4; //! Round up the number of sides to a multiple of 4 to ensure points land on all axes
module translate_z(z) translate([0, 0, z]) children(); //! Shortcut for Z only translations
module vflip() rotate([180, 0, 0]) children(); //! Invert children by doing a 180 flip around the X axis
module vflip() rotate([180, 0, 0]) children(); //! Invert children by doing a 180&deg; flip around the X axis
module hflip() rotate([0, 180, 0]) children(); //! Invert children by doing a 180&deg; flip around the Y axis
module ellipse(xr, yr) scale([1, yr / xr]) circle4n(xr); //! Draw an ellipse
module extrude_if(h, center = true) //! Extrudes 2D object to 3D when ```h``` is nonzero, otherwise leaves it 2D

View File

@@ -23,9 +23,9 @@
//!
//! The module provides `poly_circle()`, `poly_cylinder()` and `poly_ring()` that is useful for making printed washers and pillars.
//
function sides(r) = max(round(4 * r), 3); //! Optimium number of sides for specified radius
function corrected_radius(r, n = 0) = r / cos(180 / (n ? n : sides(r))); //! Adjusted radius to make flats lie on the circle
function corrected_diameter(d, n = 0) = d / cos(180 / (n ? n : sides(d / 2))); //! Adjusted diameter to make flats lie on the circle
function sides(r) = max(round(4 * r), 3); //! Optimium number of sides for specified radius
function corrected_radius(r, n = 0) = r / cos(180 / (n ? n : sides(r))); //! Adjusted radius to make flats lie on the circle
function corrected_diameter(d, n = 0) = d / cos(180 / (n ? n : sides(d / 2))); //! Adjusted diameter to make flats lie on the circle
module poly_circle(r, sides = 0) { //! Make a circle adjusted to print the correct size
n = sides ? sides : sides(r);
@@ -38,8 +38,8 @@ module poly_cylinder(r, h, center = false, sides = 0) //! Make a cylinder adjust
module poly_ring(or, ir) { //! Make a 2D ring adjusted to have the correct internal radius
cir = corrected_radius(ir);
filaments = floor((or - cir) / extrusion_width);
if(filaments > 3)
filaments = (or - cir) / extrusion_width;
if(filaments > 3 + eps)
difference() {
circle(or);

View File

@@ -44,14 +44,14 @@ function cable_strip_control_points(depth, min_z, pos) = let(z = min(min_z, min_
function bezier_cable_length(depth, min_z, pos) = //! Calculate a length that will achieve the desired minimum z
bezier_length(adjust_bezier_z(cable_strip_control_points(depth, min_z, pos), min_z));
module bezier_cable_strip(ways, depth, length, travel, pos, below, extra) { //! Draw a cable strip using a Bezier curve
module bezier_cable_strip(ways, depth, length, below, extra, pos = 0) { //! Draw a cable strip using a Bezier curve
width = ceil(ribbon_clamp_slot(ways) - 1);
thickness = cable_strip_thickness;
total = 2 * extra + length;
vitamin(str("bezier_cable_strip(", ways, ", ", depth, ", ", length, ", ", travel, ", ", pos, ", ", below, ", ", extra,
vitamin(str("bezier_cable_strip(", ways, ", ", depth, ", ", length, ", ", below, ", ", extra,
"): Polypropylene strip ", total, "mm x ", width, "mm x ", thickness, "mm"));
c = cable_strip_control_points(depth, -below + extra, pos);
@@ -71,7 +71,7 @@ module bezier_cable_strip(ways, depth, length, travel, pos, below, extra) { //!
function cable_strip_length(depth, travel, extra = 15) = ceil(travel / 2 + 2 * extra + PI * depth); //! Calculate circular cable strip length
module cable_strip(ways, depth, travel, x, extra = 15) { //! Draw a cable stripe with a semi circular fold
module cable_strip(ways, depth, travel, extra = 15, pos = 0) { //! Draw a cable stripe with a semi circular fold
width = ribbon_clamp_slot(ways);
@@ -79,15 +79,15 @@ module cable_strip(ways, depth, travel, x, extra = 15) { //! Draw a cable strip
radius = depth / 2;
top = travel / 4 + extra + x / 2;
bottom = travel / 4 + extra - x /2;
top = travel / 4 + extra + pos / 2;
bottom = travel / 4 + extra - pos /2;
length = max(top, bottom);
total = ceil(top + bottom + PI * depth);
w = floor(width - 2);
vitamin(str("cable_strip(", ways, ", ", depth, ", ", travel, ", ", x, arg(extra, 15), "): Polypropylene strip ", total, "mm x ", w, "mm x ", thickness, "mm"));
vitamin(str("cable_strip(", ways, ", ", depth, ", ", travel, arg(extra, 15), "): Polypropylene strip ", total, "mm x ", w, "mm x ", thickness, "mm"));
color(cable_strip_color) linear_extrude(height = w, center = true, convexity = 4)
difference() {
@@ -108,7 +108,7 @@ module cable_strip(ways, depth, travel, x, extra = 15) { //! Draw a cable strip
translate([0, -thickness / 2])
square([travel, thickness * 2]);
translate([x, depth - thickness - thickness / 2])
translate([pos, depth - thickness - thickness / 2])
square([travel, thickness * 2]);
}
}

View File

@@ -112,7 +112,7 @@ module e3d_fan_duct(type) {
module e3d_fan(type) {
e3d_fan_duct(type);
translate([fan_x_offset + 5, 0, 15])
translate([fan_x_offset + 5 + eps, 0, 15])
rotate([0, 90, 0])
not_on_bom()
fan(fan30x10);

View File

@@ -30,23 +30,25 @@ include <inserts.scad>
function iec_part(type) = type[1]; //! Description
function iec_screw(type) = type[2]; //! Screw type
function iec_pitch(type) = type[3]; //! Screw hole pitch
function iec_slot_w(type) = type[4]; //! Body width
function iec_slot_h(type) = type[5]; //! Body height
function iec_slot_r(type) = type[6]; //! Body corner radius
function iec_bezel_w(type) = type[7]; //! Bezel width
function iec_bezel_h(type) = type[8]; //! Bezel height
function iec_bezel_r(type) = type[9]; //! Bezel corner radius
function iec_bezel_t(type) = type[10]; //! Bezel thickness
function iec_flange_w(type) = type[11]; //! Flange width not including the lugs
function iec_flange_h(type) = type[12]; //! Flange height
function iec_flange_r(type) = type[13]; //! Flange corner radius
function iec_flange_t(type) = type[14]; //! Flange thickness
function iec_width(type) = type[15]; //! Widest part including the lugs
function iec_depth(type) = type[16]; //! Depth of the body below the flange
function iec_spades(type) = type[17]; //! Spade type
function iec_male(type) = type[18]; //! True for an outlet
function iec_body_w(type) = type[4]; //! Body width
function iec_body_w2(type) = type[5]; //! Body width at the narrow part
function iec_body_h(type) = type[6]; //! Body height
function iec_body_r(type) = type[7]; //! Body corner radius
function iec_bezel_w(type) = type[8]; //! Bezel width
function iec_bezel_h(type) = type[9]; //! Bezel height
function iec_bezel_r(type) = type[10]; //! Bezel corner radius
function iec_bezel_t(type) = type[11]; //! Bezel thickness
function iec_flange_w(type) = type[12]; //! Flange width not including the lugs
function iec_flange_h(type) = type[13]; //! Flange height
function iec_flange_r(type) = type[14]; //! Flange corner radius
function iec_flange_t(type) = type[15]; //! Flange thickness
function iec_width(type) = type[16]; //! Widest part including the lugs
function iec_depth(type) = type[17]; //! Depth of the body below the flange
function iec_spades(type) = type[18]; //! Spade type
function iec_male(type) = type[19]; //! True for an outlet
insert_overlap = 1.1; // chosen to make cap screws 10mm long.
insert_screw_length = 10;
function iec_insert_screw_length() = insert_screw_length; //! Screw length used for inserts
module iec(type) { //! Draw specified IEC connector
vitamin(str("iec(", type[0], "): ", iec_part(type)));
@@ -67,10 +69,10 @@ module iec(type) { //! Draw specified IEC connector
cube([pin_w, pin_d, h - pin_chamfer], center = true);
}
socket_w = 24;
socket_w = 24.5;
socket_w2 = 14;
socket_h = 16.5;
socket_h2 = 12;
socket_h = 16.34;
socket_h2 = socket_h - (socket_w - socket_w2);
socket_d = 17;
socket_r = 3;
socket_r2 = 0.5;
@@ -82,7 +84,7 @@ module iec(type) { //! Draw specified IEC connector
translate([side * (socket_w / 2 - socket_r), -socket_h / 2 + socket_r])
circle(socket_r);
translate([side * (socket_w / 2 - socket_r2), -socket_h / 2 + socket_h2 + socket_r2])
translate([side * (socket_w / 2 - socket_r2), socket_h2 / 2 - socket_r2])
circle(socket_r2);
translate([side * (socket_w2 / 2 - socket_r2), socket_h / 2 - socket_r2])
@@ -93,7 +95,7 @@ module iec(type) { //! Draw specified IEC connector
translate([0, socket_offset])
if(iec_male(type))
difference() {
offset(3)
offset(2)
socket_shape();
difference() {
@@ -110,6 +112,28 @@ module iec(type) { //! Draw specified IEC connector
else
socket_shape();
module body_shape() {
hull() {
bw = iec_body_w(type);
bh = iec_body_h(type);
br = iec_body_r(type);
bw2 = iec_body_w2(type);
bh2 = bh - (bw - bw2);
br2 = 1;
for(side = [-1, 1]) {
translate([side * (bw / 2 - br), -bh / 2 + br])
circle4n(br);
translate([side * (bw / 2 - br2), bh2 / 2 - br2])
circle4n(br2);
translate([side * (bw2 / 2 - br2), bh / 2 - br2])
circle4n(br2);
}
}
}
color(grey20) {
// Flange
flange_t = iec_flange_t(type);
@@ -152,12 +176,14 @@ module iec(type) { //! Draw specified IEC connector
translate_z(-h)
linear_extrude(height = h)
difference() {
rounded_square([iec_slot_w(type), iec_slot_h(type)], iec_slot_r(type));
body_shape();
oriffice_shape();
}
// Back
translate_z(-iec_depth(type))
rounded_rectangle([iec_slot_w(type), iec_slot_h(type), iec_depth(type) - h], iec_slot_r(type), center = false);
linear_extrude(height = iec_depth(type) - h)
body_shape();
}
if(!iec_male(type))
translate([0, socket_offset, iec_flange_t(type) + iec_bezel_t(type) - socket_d]) {
@@ -174,6 +200,8 @@ module iec(type) { //! Draw specified IEC connector
spade(spade[0], spade[1]);
}
function iec_spade_depth(type) = iec_depth(type) + max([for(spade = iec_spades(type)) spade[1]]);
module iec_screw_positions(type) //! Position children at the screw holes
for(side = [-1, 1])
translate([side * iec_pitch(type) / 2, 0])
@@ -181,36 +209,49 @@ module iec_screw_positions(type) //! Position children at the screw holes
module iec_holes(type, h = 100, poly = false, horizontal = false, insert = false) { //! Drill the required panel holes
clearance = 0.2;
screw = iec_screw(type);
insert_type = screw_insert(screw);
insert_overlap = max(0, insert_screw_length + clearance - iec_flange_t(type) - insert_hole_length(insert_type));
iec_screw_positions(type)
if(insert)
insert_hole(screw_insert(iec_screw(type)), insert_overlap, horizontal = horizontal);
if(h)
insert_hole(insert_type, insert_overlap, horizontal = horizontal);
else
poly_circle(insert_hole_radius(insert_type));
else
if(horizontal)
teardrop_plus(r = screw_clearance_radius(iec_screw(type)), h = h);
teardrop_plus(r = screw_clearance_radius(screw), h = h);
else
if(poly)
poly_cylinder(r = screw_clearance_radius(iec_screw(type)), h = h, center = true);
poly_cylinder(r = screw_clearance_radius(screw), h = h, center = true);
else
drill(screw_clearance_radius(iec_screw(type)), h);
drill(screw_clearance_radius(screw), h);
extrude_if(h)
hull()
for(x = [-1, 1], y = [-1, 1], sag = horizontal && y > 1 ? layer_height : 0)
translate([x * (iec_slot_w(type) / 2 - iec_slot_r(type)), y * (iec_slot_h(type) / 2 - iec_slot_r(type) + sag )])
translate([x * (iec_body_w(type) / 2 - iec_body_r(type)), y * (iec_body_h(type) / 2 - iec_body_r(type) + sag )])
if(horizontal)
teardrop(0, iec_slot_r(type) + clearance / 2 + layer_height / 4);
teardrop(0, iec_body_r(type) + clearance / 2 + layer_height / 4);
else
drill(iec_slot_r(type) + clearance / 2, 0);
drill(iec_body_r(type) + clearance / 2, 0);
}
module iec_assembly(type, thickness) { //! Assembly with fasteners given panel thickness
module iec_inserts(type) { //! Place the inserts
insert = screw_insert(iec_screw(type));
iec_screw_positions(type)
insert(insert);
}
module iec_assembly(type, thickness) { //! Assembly with fasteners given panel thickness
screw = iec_screw(type);
washer = screw_washer(screw);
nut = screw_nut(screw);
insert = screw_insert(screw);
screw_length = thickness ? screw_longer_than(iec_flange_t(type) + thickness + washer_thickness(washer) + nut_thickness(nut, true))
: screw_shorter_than(iec_flange_t(type) + insert_hole_length(insert) + insert_overlap);
: insert_screw_length;
iec(type);
@@ -222,7 +263,5 @@ module iec_assembly(type, thickness) { //! Assembly with fasteners given panel t
translate_z(-thickness)
vflip()
nut_and_washer(nut, true);
else
insert(insert);
}
}

View File

@@ -19,29 +19,43 @@
include <screws.scad>
include <spades.scad>
fused_spades = [[spade6p4, 14, -7, 0, 0],
[spade6p4, 14, 7, 0, 0],
[spade6p4, 14, 0, 11, 0],
fused_spades = [[spade4p8, 8.5, 7, 3, 90],
[spade4p8, 8.5, 0, 7, 90],
[spade4p8, 8.5, 5, -7, 90]];
fused_spades2 = [[spade6p4, 13, -7, 0, 0],
[spade6p4, 13, 7, 0, 0],
[spade6p4, 13, 0, 11, 0],
[spade4p8, 8.5, -7, -9, 90],
[spade4p8, 8.5, 7, -9, 90]];
inlet_spades = [[spade6p4, 9, -7, -5.5, 0],
[spade6p4, 9, 7, -5.5, 0],
[spade6p4, 9, 0, 5.5, 0]];
//
// p s p s s s b b b b f f f f w d s m
// a c i l l l e e e e l l l l i e p a
// r r t o o o z z z z a a a a d p a l
// t e c t t t e e e e n n n n t t d e
// w h l l l l g g g g h h e
// w h r e e e e s
// w h r t
// w h r t
//
IEC_fused_inlet = ["IEC_fused_inlet", "IEC fused inlet", M3_cs_cap_screw, 36, 27.3, 31.2, 3, 28, 31, 2, 2.5, 30, 33, 4, 2.5, 44, 21, fused_spades, false ];
IEC_inlet = ["IEC_inlet", "IEC inlet", M3_cs_cap_screw, 40, 28.2, 20.2, 3, 28, 20.5, 4, 2.5, 37, 23, 1, 2.5, 48, 14, inlet_spades, false ];
IEC_inlet_atx = ["IEC_inlet_atx", "IEC inlet for ATX", M3_cs_cap_screw, 40, 27.0, 19.0, 3, 30, 22, 2, 2.0, 30, 22, 2, 4.0, 50, 13, inlet_spades, false ];
IEC_outlet = ["IEC_outlet", "IEC outlet", M3_cs_cap_screw, 40, 32, 24, 3, 28, 20.5, 2, 0.0, 29, 29, 2, 2.9, 50, 23, inlet_spades, true ];
iecs = [IEC_inlet, IEC_inlet_atx, IEC_fused_inlet, IEC_outlet];
atx_spades = [[spade3p5, 8, -7, -3, 90],
[spade3p5, 8, 7, -3, 90],
[spade3p5, 8, 0, 3, 90]];
outlet_spades = [[spade4p8ll, 8, -7, -2, 90],
[spade4p8ll, 8, 7, -2, 90],
[spade4p8ll, 8, 0, 2, 90]];
//
// p s p b b b b b b b b f f f f w d s m
// a c i o o o o e e e e l l l l i e p a
// r r t d d d d z z z z a a a a d p a l
// t e c y y y y e e e e n n n n t t d e
// w h l l l l g g g g h h e
// w w h r e e e e s
// 2 w h r t
// w h r t
IEC_fused_inlet = ["IEC_fused_inlet", "IEC fused inlet JR-101-1F", M3_cs_cap_screw, 36, 27, 16, 31, 3, 28, 31, 2, 2.0, 30, 33, 4, 3.0, 44, 15, fused_spades, false ];
IEC_fused_inlet2= ["IEC_fused_inlet2","IEC fused inlet old", M3_cs_cap_screw, 36, 27, 14, 31, 3, 28, 31, 2, 2.5, 30, 33, 4, 2.5, 44, 18, fused_spades2, false ];
IEC_inlet = ["IEC_inlet", "IEC inlet", M3_cs_cap_screw, 40, 28, 18, 20, 3, 28, 20.5, 4, 2.5, 37, 23, 1, 2.5, 48, 14, inlet_spades, false ];
IEC_inlet_atx = ["IEC_inlet_atx", "IEC inlet for ATX", M3_cs_cap_screw, 40, 27, 18, 19, 3, 30.5, 22, 2, 2.0, 30.5, 22, 2, 4.0, 50, 15, atx_spades, false ];
IEC_outlet = ["IEC_outlet", "IEC outlet RS 811-7193", M3_cs_cap_screw, 40, 32, 18, 24, 3, 28, 20.5, 2, 0.0, 29, 29, 2, 2.8, 50, 23, outlet_spades, true ];
iecs = [IEC_inlet, IEC_inlet_atx, IEC_fused_inlet, IEC_fused_inlet2, IEC_outlet];
use <iec.scad>

View File

@@ -94,12 +94,14 @@ module insert_hole(type, counterbore = 0, horizontal = false) { //! Make a hole
}
module insert_boss(type, z, wall = 2 * extrusion_width) { //! Make a boss to take an insert
difference() {
ir = insert_hole_radius(type);
linear_extrude(height = z)
poly_ring(corrected_radius(ir) + wall, insert_screw_diameter(type) / 2 + 0.1);
render(convexity = 3)
difference() {
ir = insert_hole_radius(type);
linear_extrude(height = z)
hull()
poly_ring(corrected_radius(ir) + wall, ir);
translate_z(z)
insert_hole(type, max(0, z - insert_hole_length(type) - 2 * layer_height));
}
translate_z(z)
insert_hole(type, max(0, z - insert_hole_length(type) - 2 * layer_height));
}
}

View File

@@ -40,10 +40,10 @@ module nut(type, nyloc = false, brass = false, nylon = false) { //! Draw specifi
hole_rad = nut_size(type) / 2;
outer_rad = nut_radius(type);
thickness = nut_thickness(type);
nyloc_thickness = type[4];
nyloc_thickness = nut_thickness(type, true);
desc = nyloc ? "nyloc" : brass ? "brass" : nylon ? "nylon" : "";
vitamin(str("nut(", type[0], arg(nyloc, false, "nyloc"), arg(brass, false, "brass"), arg(nylon, false, "nylon"),
"): Nut M", nut_size(type), " ", desc));
"): Nut M", nut_size(type), " x ", thickness, "mm ", desc));
explode(nyloc ? 10 : 0)
color(brass ? brass_colour : nylon ? grey30: grey70) {

View File

@@ -17,12 +17,13 @@
// If not, see <https://www.gnu.org/licenses/>.
//
spade3 = [3.8, 3.0, 0.4, 1.0, 3.9];
spade6p4 = [8.3, 6.4, 0.8, 1.8, 8];
spade4p8 = [6.4, 4.8, 0.5, 1.8, 8];
spade4p8l = [7.0, 4.8, 0.5, 1.8, 8];
spade4p8ll = [8.0, 4.8, 0.5, 1.8, 4.8];
spade3 = [3.8, 3.0, 0.4, 1.0, 3.9];
spade3p5 = [7.0, 3.5, 0.8, 1.75, 6.8];
spade6p4 = [8.3, 6.4, 0.8, 1.8, 8];
spade4p8 = [6.4, 4.8, 0.5, 1.8, 8];
spade4p8l = [7.0, 4.8, 0.5, 1.8, 8];
spade4p8ll = [8.0, 4.8, 0.5, 1.8, 4.8];
spades = [spade3, spade6p4, spade4p8, spade4p8l, spade4p8ll];
spades = [spade3, spade3p5, spade6p4, spade4p8, spade4p8l, spade4p8ll];
use <spade.scad>