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

Compare commits

...

11 Commits

Author SHA1 Message Date
Chris Palmer
82baed4c8f Updated images and readme. 2020-02-29 09:00:20 +00:00
Chris Palmer
acb2cb2a48 Changed PSU list order to get all the shrouds together. 2020-02-29 08:55:40 +00:00
Chris Palmer
cf94972b18 Merge branch 'psu_vents' of https://github.com/martinbudden/NopSCADlib into martinbudden-psu_vents 2020-02-29 08:48:33 +00:00
Chris Palmer
7c0a48d0c1 Added parametric printed box 2020-02-29 01:27:17 +00:00
Martin Budden
a5a640e273 Added facility to add vents to PSU. Added vents to S_300_12. 2020-02-28 21:21:11 +00:00
Chris Palmer
95c4359421 Better test coverage of stepper earth tag position. 2020-02-28 14:27:35 +00:00
Chris Palmer
bcff26a27b Added threads to stepper motors and made the test show them. 2020-02-28 12:02:24 +00:00
Chris Palmer
07b00fabe0 Added a guard against and empty BOM in views.py. 2020-02-28 09:22:50 +00:00
Chris Palmer
8ed0f3c1af Updated readme and images. 2020-02-28 09:05:59 +00:00
Martin Budden
0e8e387d35 Improved S_300_12 PSU. 2020-02-28 03:05:45 +00:00
Chris Palmer
0c17620adb Removed echo from extrusion_bracket.scad 2020-02-28 01:59:00 +00:00
15 changed files with 639 additions and 49 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 KiB

After

Width:  |  Height:  |  Size: 784 KiB

View File

@@ -87,16 +87,17 @@ use <tests/door_hinge.scad>
use <tests/door_latch.scad>
use <tests/fan_guard.scad>
use <tests/fixing_block.scad>
use <tests/flat_hinge.scad>
use <tests/foot.scad>
use <tests/handle.scad>
use <tests/pcb_mount.scad>
use <tests/printed_box.scad>
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>
use <tests/psu_shroud.scad>
use <tests/flat_hinge.scad>
use <tests/pcb_mount.scad>
x0 = 0;
x1 = x0 + 100;
@@ -146,9 +147,14 @@ translate([x5, cable_grommets_y + 250])
translate([950, 600])
box_test();
translate([890, 730])
printed_boxes();
translate([850, 1260])
bbox_test();
inserts_y = 0;
nuts_y = inserts_y + 20;
washers_y = nuts_y + 100;

230
printed/printed_box.scad Normal file
View File

@@ -0,0 +1,230 @@
//
// NopSCADlib Copyright Chris Palmer 2020
// 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 fully parametric 3D printed case that can be customised with cutouts and additions specified by children.
//!
//! The walls can be made wavy, which possibly reduces warping when printing and looks nice, however if holes need to be made
//! in the sides you can't print a wavy bridge. Any holes need to be surrounded by a 45&deg; chamfer to make the bridges straight.
//! See the mounting points for the feet in the first example.
//!
//! It can also have printed feet on the base with the screws doubling up to hold the base on.
//
include <../core.scad>
include <../vitamins/screws.scad>
use <../vitamins/insert.scad>
use <foot.scad>
function pbox_name(type) = type[0]; //! Name to allow more than one box in a project
function pbox_wall(type) = type[1]; //! Wall thickness
function pbox_top(type) = type[2]; //! Top thickness
function pbox_base(type) = type[3]; //! Base thickness, can be zero for no base
function pbox_foot(type) = type[4]; //! Printed foot, can be false to suppress feet
function pbox_base_screw(type) = type[5]; //! Screw type if no feet
function pbox_radius(type) = type[6]; //! Internal corner radius
function pbox_ridges(type) = type[7]; //! Ridge wavelength and amplitude
function pbox_width(type) = type[8]; //! Internal width
function pbox_depth(type) = type[9]; //! Internal depth
function pbox_height(type) = type[10]; //! Internal height
base_outset = 1; // How much the base overlaps the inner dimensions
base_overlap = 2; // The width of ledge the base sits on
height_overlap = 1; // How far the edges sit below the base
function pbox_inclusion(type) = pbox_base(type) ? base_overlap - base_outset : 0; //! How far the ledge for the base extends inwards
function pbox_total_height(type) = //! Total height including base overlap
let(base = pbox_base(type),
foot = pbox_foot(type),
washer = pbox_washer(type),
screw = pbox_screw(type))
pbox_height(type) + pbox_top(type) + base + (base ? height_overlap : 0) + (foot || !base ? 0 : washer_thickness(washer) + screw_head_height(screw));
function pbox_screw(type) = //! Foot screw if got feet else base_screw
let(foot = pbox_foot(type)) foot ? foot_screw(foot) : pbox_base_screw(type);
function pbox_insert(type) = screw_insert(pbox_screw(type)); //! The insert for the base screws
function pbox_washer(type) = screw_washer(pbox_screw(type)); //! The washer for the base screws
function pbox_screw_length(type, panel_thickness = 0) = //! Length of the base screw
let(foot = pbox_foot(type))
screw_shorter_than(pbox_base(type) + washer_thickness(pbox_washer(type))
+ insert_length(pbox_insert(type))
+ (foot ? foot_thickness(foot) : panel_thickness));
function pbox_mid_offset(type) = pbox_ridges(type).y + pbox_wall(type) / 2; // Offset to wall midpoint
function pbox_screw_inset(type) = //! How far the base screws are inset
let(foot = pbox_foot(type),
r = foot ? foot_diameter(foot) / 2 : washer_radius(pbox_washer(type)),
R = pbox_radius(type)
) max(r, R - (R - r) / sqrt(2));
module pbox_screw_positions(type) {
foot = pbox_foot(type);
inset = pbox_screw_inset(type);
for(x = [-1, 1], y = [-1, 1])
translate([x * (pbox_width(type) / 2 - inset), y * (pbox_depth(type) / 2 - inset)])
rotate((y > 0 ? -x * 45 : -x * 135) + 90)
children();
}
module pbox_mid_shape(type) {
ridges = pbox_ridges(type);
offset = ridges.y + pbox_wall(type) / 2;
rad = pbox_radius(type) + offset;
w = pbox_width(type) + 2 * offset;
d = pbox_depth(type) + 2 * offset;
module waves(length) {
l = length - 2 * rad;
waves = round(l / ridges.x);
points = 16;
translate([-l / 2, ridges.y / 2])
polygon(concat([[0, -10]], [for(i = [0 : waves * points], a = 360 * i / points) [i * l / waves / points, -cos(a) * ridges.y / 2] ], [[l, -10]]));
}
difference() {
rounded_square([w, d], rad, center = true);
if(ridges.y)
for(side = [-1, 1]) {
translate([0, side * d / 2])
rotate(90 + side * 90)
waves(w);
translate([side * w / 2, 0])
rotate(side * 90)
waves(d);
}
}
}
module pbox_inner_shape(type) {
rad = pbox_radius(type);
w = pbox_width(type);
d = pbox_depth(type);
rounded_square([w, d], rad, center = true);
}
module pbox_base(type) { //! Generate the STL for the base
stl(str(pbox_name(type),"_base"));
t = pbox_base(type);
difference() {
union() {
linear_extrude(height = t)
offset(base_outset - 0.2)
pbox_inner_shape(type);
if($children > 0)
children(0);
}
pbox_screw_positions(type)
poly_cylinder(r = screw_clearance_radius(pbox_screw(type)), h = 2 * t + eps, center = true);
if($children > 1)
children(1);
}
}
module pbox(type) { //! Generate the STL for the main case
stl(pbox_name(type));
height = pbox_height(type);
total_height = pbox_total_height(type);
top_thickness = pbox_top(type);
wall = pbox_wall(type);
ledge_outset = pbox_ridges(type).y;
ledge_inset = base_outset - base_overlap;
ledge_h = pbox_base(type) ? (ledge_outset - ledge_inset) * 2 : 0;
difference() {
union() {
linear_extrude(height = total_height)
offset(wall / 2) pbox_mid_shape(type);
if($children > 2)
children(2);
}
difference() {
translate_z(top_thickness)
union() {
linear_extrude(height = height + eps)
offset(-wall / 2) pbox_mid_shape(type);
translate_z(height) // Recess for the base
linear_extrude(height = total_height - height)
offset(base_outset)
pbox_inner_shape(type);
}
// Ledge to support the lid
if(ledge_h)
translate_z(top_thickness + height - ledge_h)
difference() {
rounded_rectangle([pbox_width(type) + 2 * outset, pbox_depth(type) + 2 * outset, ledge_h], 1, center = false);
hull() {
linear_extrude(height = ledge_h + eps)
offset(ledge_inset)
pbox_inner_shape(type);
linear_extrude(height = eps)
offset(ledge_outset)
pbox_inner_shape(type);
}
pbox_screw_positions(type)
insert_hole(pbox_insert(type));
}
// Corner lugs for inserts
outset = wall + pbox_ridges(type).y;
or = pbox_radius(type) + outset;
inset = pbox_screw_inset(type) + outset;
br = insert_boss_radius(pbox_insert(type), wall);
ext = sqrt(2) * inset - or * (sqrt(2) - 1) - br;
translate_z(height + top_thickness)
pbox_screw_positions(type)
insert_lug(pbox_insert(type), wall, counter_bore = 0, extension = ext, corner_r = or);
if($children > 0)
children(0);
}
if($children > 1)
children(1);
}
}
module pbox_inserts(type) //! Place the inserts for the base screws
translate_z(pbox_height(type) + pbox_top(type))
pbox_screw_positions(type)
insert(pbox_insert(type));
module pbox_base_screws(type, thickness = 0) //! Place the screws and feet
translate_z(pbox_height(type) + pbox_top(type) + pbox_base(type))
pbox_screw_positions(type) {
foot = pbox_foot(type);
if(foot)
color(pp4_colour)
foot(foot);
translate_z(foot ? foot_thickness(foot) : thickness)
screw_and_washer(pbox_screw(type), pbox_screw_length(type, thickness));
}

115
readme.md
View File

@@ -31,13 +31,13 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
<tr><td> <a href = "#Extrusion_brackets">Extrusion_brackets</a> </td><td> <a href = "#Ring_terminals">Ring_terminals</a> </td><td> <a href = "#Foot">Foot</a> </td><td> <a href = "#Rounded_cylinder">Rounded_cylinder</a> </td><td></td></tr>
<tr><td> <a href = "#Extrusions">Extrusions</a> </td><td> <a href = "#Rockers">Rockers</a> </td><td> <a href = "#Handle">Handle</a> </td><td> <a href = "#Rounded_polygon">Rounded_polygon</a> </td><td></td></tr>
<tr><td> <a href = "#Fans">Fans</a> </td><td> <a href = "#Rod">Rod</a> </td><td> <a href = "#Pcb_mount">Pcb_mount</a> </td><td> <a href = "#Sector">Sector</a> </td><td></td></tr>
<tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#Screws">Screws</a> </td><td> <a href = "#Psu_shroud">Psu_shroud</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr>
<tr><td> <a href = "#Geared_steppers">Geared_steppers</a> </td><td> <a href = "#Scs_bearing_blocks">Scs_bearing_blocks</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#Thread">Thread</a> </td><td></td></tr>
<tr><td> <a href = "#Green_terminals">Green_terminals</a> </td><td> <a href = "#Sealing_strip">Sealing_strip</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 = "#Hot_ends">Hot_ends</a> </td><td> <a href = "#Sheets">Sheets</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Hygrometer">Hygrometer</a> </td><td> <a href = "#Sk_brackets">Sk_brackets</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Inserts">Inserts</a> </td><td> <a href = "#Spools">Spools</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Fuseholder">Fuseholder</a> </td><td> <a href = "#Screws">Screws</a> </td><td> <a href = "#Printed_box">Printed_box</a> </td><td> <a href = "#Sweep">Sweep</a> </td><td></td></tr>
<tr><td> <a href = "#Geared_steppers">Geared_steppers</a> </td><td> <a href = "#Scs_bearing_blocks">Scs_bearing_blocks</a> </td><td> <a href = "#Psu_shroud">Psu_shroud</a> </td><td> <a href = "#Thread">Thread</a> </td><td></td></tr>
<tr><td> <a href = "#Green_terminals">Green_terminals</a> </td><td> <a href = "#Sealing_strip">Sealing_strip</a> </td><td> <a href = "#Ribbon_clamp">Ribbon_clamp</a> </td><td> <a href = "#Tube">Tube</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></td><td></td></tr>
<tr><td> <a href = "#Hygrometer">Hygrometer</a> </td><td> <a href = "#Sk_brackets">Sk_brackets</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td></td><td></td></tr>
<tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td></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></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 = "#Kp_pillow_blocks">Kp_pillow_blocks</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td></td><td></td><td></td></tr>
<tr><td> <a href = "#Ldrs">Ldrs</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr>
@@ -2171,6 +2171,7 @@ Face order is bottom, top, left, right, front, back.
| ```psu_face_iec(type)``` | IEC connector x,y, rotation and type |
| ```psu_face_switch(type)``` | Rocker switch x,y, rotation and type |
| ```psu_face_thickness(type)``` | The thickness |
| ```psu_face_vents(type)``` | Vents array position x,y, rotation, size and corner radius |
| ```psu_faces(type)``` | List of face descriptions |
| ```psu_height(type)``` | Height |
| ```psu_left_bay(type)``` | Bay for terminals |
@@ -3020,15 +3021,16 @@ NEMA stepper motor model.
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 24 | ```screw(M3_pan_screw, 8)``` | Screw M3 pan x 8mm |
| 4 | ```ring_terminal(M3_ringterm)``` | Ring terminal 3mm |
| 15 | ```screw(M3_pan_screw, 8)``` | Screw M3 pan x 8mm |
| 1 | ```NEMA(NEMA14)``` | Stepper motor NEMA14 x 36mm |
| 1 | ```NEMA(NEMA16)``` | Stepper motor NEMA16 x 19.2mm |
| 1 | ```NEMA(NEMA17S)``` | Stepper motor NEMA17 x 34mm |
| 1 | ```NEMA(NEMA17M)``` | Stepper motor NEMA17 x 40mm |
| 1 | ```NEMA(NEMA17)``` | Stepper motor NEMA17 x 47mm |
| 1 | ```NEMA(NEMA23)``` | Stepper motor NEMA22 x 51.2mm |
| 24 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
| 24 | ```star_washer(M3_washer)``` | Washer star M3 x 0.5mm |
| 11 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
| 15 | ```star_washer(M3_washer)``` | Washer star M3 x 0.5mm |
<a href="#top">Top</a>
@@ -4294,6 +4296,87 @@ The stl must be given a parameterless wrapper in the project that uses it.
| 1 | pcb_mount_PI_IO_5.stl |
<a href="#top">Top</a>
---
<a name="Printed_box"></a>
## Printed_box
A fully parametric 3D printed case that can be customised with cutouts and additions specified by children.
The walls can be made wavy, which possibly reduces warping when printing and looks nice, however if holes need to be made
in the sides you can't print a wavy bridge. Any holes need to be surrounded by a 45&deg; chamfer to make the bridges straight.
See the mounting points for the feet in the first example.
It can also have printed feet on the base with the screws doubling up to hold the base on.
[printed/printed_box.scad](printed/printed_box.scad) Implementation.
[tests/printed_box.scad](tests/printed_box.scad) Code for this example.
### Properties
| Function | Description |
|:--- |:--- |
| ```pbox_base(type)``` | Base thickness, can be zero for no base |
| ```pbox_base_screw(type)``` | Screw type if no feet |
| ```pbox_depth(type)``` | Internal depth |
| ```pbox_foot(type)``` | Printed foot, can be false to suppress feet |
| ```pbox_height(type)``` | Internal height |
| ```pbox_name(type)``` | Name to allow more than one box in a project |
| ```pbox_radius(type)``` | Internal corner radius |
| ```pbox_ridges(type)``` | Ridge wavelength and amplitude |
| ```pbox_top(type)``` | Top thickness |
| ```pbox_wall(type)``` | Wall thickness |
| ```pbox_width(type)``` | Internal width |
### Functions
| Function | Description |
|:--- |:--- |
| ```pbox_inclusion(type)``` | How far the ledge for the base extends inwards |
| ```pbox_insert(type)``` | The insert for the base screws |
| ```pbox_screw(type)``` | Foot screw if got feet else base_screw |
| ```pbox_screw_inset(type)``` | How far the base screws are inset |
| ```pbox_screw_length(type, panel_thickness = 0)``` | Length of the base screw |
| ```pbox_total_height(type)``` | Total height including base overlap |
| ```pbox_washer(type)``` | The washer for the base screws |
### Modules
| Module | Description |
|:--- |:--- |
| ```pbox(type)``` | Generate the STL for the main case |
| ```pbox_base(type)``` | Generate the STL for the base |
| ```pbox_base_screws(type, thickness = 0)``` | Place the screws and feet |
| ```pbox_inserts(type)``` | Place the inserts for the base screws |
![printed_box](tests/png/printed_box.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 4 | ```insert(F1BM)``` | Heatfit insert M2 |
| 4 | ```insert(F1BM3)``` | Heatfit insert M3 |
| 4 | ```screw(M2_cap_screw, 6)``` | Screw M2 cap x 6mm |
| 3 | ```screw(M3_pan_screw, 6)``` | Screw M3 pan x 6mm |
| 4 | ```screw(M3_pan_screw, 10)``` | Screw M3 pan x 10mm |
| 4 | ```washer(M2_washer)``` | Washer M2 x 5mm x 0.3mm |
| 7 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
### Printed
| Qty | Filename |
| ---:|:--- |
| 1 | box1.stl |
| 1 | box1_base.stl |
| 7 | foot.stl |
| 1 | smooth_box.stl |
| 1 | smooth_box_base.stl |
### Assemblies
| Qty | Name |
| ---:|:--- |
| 1 | box1_assembly |
| 1 | box2_assembly |
<a href="#top">Top</a>
---
@@ -4333,23 +4416,25 @@ The stl and assembly must be given a name and parameterless wrappers for the stl
### 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 2.5mm x 100mm min length |
| 6 | ```insert(F1BM3)``` | Heatfit insert M3 |
| 6 | ```screw(M3_cap_screw, 10)``` | Screw M3 cap x 10mm |
| 6 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
| 6 | ```star_washer(M3_washer)``` | Washer star M3 x 0.5mm |
| 3 | ```ziptie(small_ziptie, 3)``` | Ziptie 2.5mm x 100mm min length |
### Printed
| Qty | Filename |
| ---:|:--- |
| 1 | psu_shroud_PD_150_12.stl |
| 1 | psu_shroud_S_250_48.stl |
| 1 | psu_shroud_S_300_12.stl |
### Assemblies
| Qty | Name |
| ---:|:--- |
| 1 | psu_shroud_PD_150_12_assembly |
| 1 | psu_shroud_S_250_48_assembly |
| 1 | psu_shroud_S_300_12_assembly |
<a href="#top">Top</a>

View File

@@ -71,9 +71,10 @@ def bom_to_assemblies(bom_dir, bounds_map):
#
# Remove the main assembly if it is a shell
#
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]
if flat_bom:
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]
return [assembly["name"] for assembly in flat_bom]
def eop(print_mode, doc_file, last = False, first = False):

BIN
tests/png/printed_box.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 84 KiB

167
tests/printed_box.scad Normal file
View File

@@ -0,0 +1,167 @@
//
// NopSCADlib Copyright Chris Palmer 2020
// 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>
include <../vitamins/screws.scad>
use <../printed/foot.scad>
use <../printed/printed_box.scad>
foot = [13, 5, 2, 1, M3_pan_screw, 10];
module foot_stl() foot(foot);
wall = 2;
top_thickness = 2;
base_thickness = 2;
case_inner_rad = 8;
width = 80;
depth = 45;
height = 40;
box1 = ["box1", wall, top_thickness, base_thickness, false, M2_cap_screw, case_inner_rad, [8, 1], width, depth, height];
box2 = ["smooth_box", wall, top_thickness, base_thickness, foot, false, case_inner_rad, [0, 0], width, depth, height];
module box1_feet_positions() {
clearance = 2;
foot_r = foot_diameter(foot) / 2;
x_inset = case_inner_rad + foot_r - pbox_ridges(box1).y;
z_inset = foot_r + clearance;
h = height + base_thickness;
for(p = [[-1, -1], [1, -1], [0, 1]])
translate([p.x * (width / 2 - x_inset), depth / 2 + wall + pbox_ridges(box1).y, top_thickness + h / 2 + p.y * (h / 2 - z_inset)])
rotate([90, 0, 0])
children();
}
module box1_internal_additions() {
d = washer_diameter(screw_washer(foot_screw(foot))) + 1;
h = pbox_ridges(box1).y;
box1_feet_positions()
translate_z(wall - eps)
cylinder(d2 = d, d1 = d + 2 * h, h = h);
}
module box1_external_additions() {
amp = pbox_ridges(box1).y + eps;
d = foot_diameter(foot) + 1;
box1_feet_positions()
cylinder(d1 = d, d2 = d + 2 * amp, h = amp);
}
module box1_holes() {
box1_feet_positions()
teardrop(r = screw_pilot_hole(foot_screw(foot)), h = 10, center = true);
}
module box1_case_stl() {
pbox(box1) {
box1_internal_additions();
box1_holes();
box1_external_additions();
}
}
module box1_base_additions() {
}
module box1_base_holes() {
}
module box1_base_stl()
pbox_base(box1) {
box1_base_additions();
box1_base_holes();
}
module box1_assembly()
assembly("box1") {
color(pp1_colour) render() box1_case_stl();
pbox_inserts(box1);
pbox_base_screws(box1);
box1_feet_positions() {
foot_assembly(0, foot);
vflip()
translate_z(foot_thickness(foot))
screw_and_washer(foot_screw(foot), 6);
}
translate_z(height + top_thickness + base_thickness + eps) vflip()
%render() box1_base_stl();
}
module box2_internal_additions() {
}
module box2_holes() {
}
module box2_external_additions() {
}
module box2_case_stl() {
pbox(box2) {
box2_internal_additions();
box2_holes();
box2_external_additions();
}
}
module box2_base_additions() {
}
module box2_base_holes() {
}
module box2_base_stl()
pbox_base(box2) {
box2_base_additions();
box2_base_holes();
}
module box2_assembly()
assembly("box2") {
color(pp1_colour) render() box2_case_stl();
pbox_inserts(box2);
pbox_base_screws(box2);
translate_z(height + top_thickness + base_thickness + eps) vflip()
%render() box2_base_stl();
}
module printed_boxes() {
rotate(180)
box1_assembly();
translate([100, 0])
box2_assembly();
}
if($preview)
printed_boxes();

View File

@@ -27,8 +27,10 @@ module stepper_motors()
rotate(180)
NEMA(stepper_motors[$i]);
NEMA_screws(stepper_motors[$i], M3_pan_screw);
translate_z(4)
NEMA_screws(stepper_motors[$i], M3_pan_screw, n = $i, earth = $i > 4 ? undef : $i - 1);
}
if($preview)
stepper_motors();
let($show_threads = 1)
stepper_motors();

View File

@@ -70,7 +70,6 @@ function extrusion_corner_bracket_side_thickness(type) = type[3]; //! Thicknes
function extrusion_corner_bracket_hole_offset(type) = type[4]; //! Hole offset from corner
module extrusion_corner_bracket(type) { //! Corner bracket for extrusion
echo(type=type);
vitamin(str("extrusion_corner_bracket(", type[0], "): Extrusion corner bracket ", type[1].z));
eSize = extrusion_corner_bracket_size(type).z;

View File

@@ -39,6 +39,7 @@ function psu_face_grill(type) = type[3]; //! Is this face a grill
function psu_face_fan(type) = type[4]; //! Fan x,y position and type
function psu_face_iec(type) = type[5]; //! IEC connector x,y, rotation and type
function psu_face_switch(type) = type[6]; //! Rocker switch x,y, rotation and type
function psu_face_vents(type) = type[7]; //! Vents array position x,y, rotation, size and corner radius
function psu_name(type) = type[1]; //! The part name
function psu_length(type) = type[2]; //! Length
@@ -166,6 +167,7 @@ module psu(type) { //! Draw a power supply
fan = psu_face_fan(f);
iec = psu_face_iec(f);
switch = psu_face_switch(f);
vents = psu_face_vents(f);
multmatrix(psu_face_transform(type, i))
translate([xo, 0, -t]) {
@@ -208,6 +210,14 @@ module psu(type) { //! Draw a power supply
translate([switch.x, switch.y])
rotate(switch.z)
rocker_hole(switch[3], 0);
if(vents)
for(i = [0 : len(vents) - 1]) {
// vent is of form: [ [pos.x, pos.y, angle], [size.x, size.y], corner radius ]
vent = vents[i];
translate([vent[0].x, vent[0].y])
rotate(vent[0].z)
rounded_square(vent[1], vent[2]-eps, center = true);
}
}
}
@@ -259,23 +269,26 @@ module psu(type) { //! Draw a power supply
square(16, center = true);
}
// earth strap
tab_w = w / 2 + cutout[2].x;
color("silver")
translate([-l / 2, w / 2 - tab_w, z])
cube([left, tab_w - bt, lt]);
// Earth pilar and screw
earth_inset = 4.5;
earth_d = 5;
translate([-l / 2 + earth_inset, w / 2 - tab_w / 2]) {
// if the cutout is too wide, then don't draw earth strap, pillar and screw
if (tab_w - bt > 0) {
// earth strap
color("silver")
cylinder(d = earth_d, h = z - pcb_thickness);
translate([-l / 2, w / 2 - tab_w, z])
cube([left, tab_w - bt, lt]);
translate_z(z + lt)
not_on_bom() no_explode()
spring_washer(M3_washer)
screw(M3_pan_screw, 8);
// Earth pillar and screw
earth_inset = 4.5;
earth_d = 5;
translate([-l / 2 + earth_inset, w / 2 - tab_w / 2]) {
color("silver")
cylinder(d = earth_d, h = z - pcb_thickness);
translate_z(z + lt)
not_on_bom() no_explode()
spring_washer(M3_washer)
screw(M3_pan_screw, 8);
}
}
// terminal block

View File

@@ -83,15 +83,95 @@ KY240W =
// This PSU, and ones very like it, are sold by LulzBot, and various sellers on eBay.
// The screw layout specified here uses the inner set of screw-mounts on the PSU, which are M4.
// The outer set don't appear to be M3, even though the datasheet claims they are.
S_300_12 =
["S_300_12", "S-300-12", 215, 115, 50, M4_cap_screw, M4_clearance_radius, false, 0, 0, [],
[ [[[ 215 / 2 - 32.5, 115 / 2 - 82.5],
[ 215 / 2 - 32.5, 115 / 2 - 32.5],
[ 215 / 2 - 182.5, 115 / 2 - 82.5],
[ 215 / 2 - 182.5, 115 / 2 - 32.5]]]
S_300_12 = [
"S_300_12",
"S-300-12",// part name
215, 115, 50,// length, width, height
M4_cap_screw, M4_clearance_radius,// screw type and clearance
false,// true if ATX style
13,// terminals bay depth
0,// heatsink bay depth
[// terminals
9,// count
18,// y offset
st_terminals
],
// faces
[
[// f_bottom, bottom
[// holes
[215/2 - 32.5, 115/2 - 82.5], [215/2 - 32.5, 115/2 - 32.5], [215/2 - 182.5, 115/2 - 82.5], [215/2 - 182.5, 115/2 - 32.5]
],
1.5,// thickness
[],// cutouts
false,// grill
[],[],[],// fan, iec, rocker
[// vents
// [ [pos.x, pos.y, angle], [size.x, size.y], corner radius ]
for(x = [0:21], y = [-1,1]) [ [-7*x+215/2-34, (115/2-5)*y, 0], [3, 25], 1.5 ]
]
],
[]
];
[// f_top, top
[],// holes
0.5,// thickness
[],// coutouts
false,// grill
[215/2 - 47.5, 115/2 - 37.5, fan50x15],
[],//iec
[],//rocker
[// vents
for(x = [0:4], y = [-1,1]) [ [-7*x-215/2+48, 28*y, 0], [3, 25], 1.5 ]
]
],
[// f_left, front (terminals) after rotation
[],// holes
0.5,// thickness
[// cutouts
[
[-56, -25], [-56, -17],
[-60, -17], [-60, 0],
[115/2, 0], [115/2, -25]
]
],
false,// grill
],
[// f_right, back after rotation
[], // holes
1.5,// thickness
[],// cutouts
false,// grill
],
[// f_front, right after rotation
[// holes, offset from center
[215/2 - 32.5,-15], [215/2 - 182.5,-15],
[215/2 - 32.5, 10], [215/2 - 182.5, 10]
],
1.5,// thickness
[],// cutouts
false,// grill
[],[],[],// fan, iec, rocker
[// vents
for(x = [0 : 21]) [ [-7*x+215/2-34, -25, 0], [3, 10], 1.5 ],
for(x = [0 : 1]) [ [-7*x, -1, 0], [3, 25], 1.5 ],
for(x = [0 : 2]) [ [-7*x-215/2+20, -1, 0], [3, 25], 1.5 ],
]
],
[// f_back, left after rotation
[// holes, offset from center
[215/2 - 32.5 - 13/2, 15], [215/2 - 182.5 - 13/2, 15]
],
1.5,// thickness
[],// cutouts
false,// grill
[],[],[],// fan, iec, rocker
[// vents
for(x = [0 : 21]) [ [-7*x+215/2-34-13/2, 25, 0], [3, 10], 1.5 ]
]
],
],
// accessories to add to BOM
[]
];
External =
["External", "X Box", 0, 0, 0, false, false, false, 0, 0, [],
@@ -99,6 +179,6 @@ External =
[": IEC mains lead"]
];
psus = [PD_150_12, S_250_48, ATX500, KY240W, S_300_12];
psus = [PD_150_12, S_250_48, S_300_12, ATX500, KY240W];
use <psu.scad>

View File

@@ -26,6 +26,7 @@ include <screws.scad>
use <washer.scad>
include <ring_terminals.scad>
use <../utils/tube.scad>
use <../utils/thread.scad>
use <rod.scad>
function NEMA_width(type) = type[1]; //! Width of the square face
@@ -60,6 +61,7 @@ module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor
shaft_rad = NEMA_shaft_dia(type) / 2;
cap = 8;
vitamin(str("NEMA(", type[0], "): Stepper motor NEMA", round(NEMA_width(type) / 2.54), " x ", length, "mm"));
thread_d = 3; // Is this always the case?
union() {
color(stepper_body_colour) // black laminations
@@ -75,7 +77,7 @@ module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor
tube(or = boss_rad, ir = shaft_rad + 2, h = boss_height * 2); // raised boss
for(end = [-1, 1])
translate_z(-length / 2 + end * (length - cap) / 2)
translate_z(-length / 2 + end * (length - cap) / 2) {
linear_extrude(height = cap, center = true)
difference() {
intersection() {
@@ -85,9 +87,14 @@ module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor
if(end > 0)
for(x = NEMA_holes(type), y = NEMA_holes(type))
translate([x, y])
circle(r = 3/2);
circle(d = thread_d);
}
}
}
if(show_threads)
for(x = NEMA_holes(type), y = NEMA_holes(type))
translate([x, y, -cap / 2])
female_metric_thread(thread_d, metric_coarse_pitch(thread_d), cap, colour = stepper_cap_colour);
shaft = NEMA_shaft_length(type);
translate_z(-5)
@@ -112,7 +119,7 @@ module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor
module NEMA_screw_positions(type, n = 4) { //! Positions children at the screw holes
pitch = NEMA_hole_pitch(type);
for($i = [0 : n - 1])
for($i = [0 : 1 : min(n - 1, 4)])
rotate($i * 90)
translate([pitch / 2, pitch / 2])
rotate($i * -90)