diff --git a/libtest.png b/libtest.png index b9cae70..15f80be 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/libtest.scad b/libtest.scad index 04ef3a1..238317b 100644 --- a/libtest.scad +++ b/libtest.scad @@ -87,6 +87,7 @@ use use use use +use 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; diff --git a/printed/psu_shroud.scad b/printed/psu_shroud.scad new file mode 100644 index 0000000..54a0185 --- /dev/null +++ b/printed/psu_shroud.scad @@ -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 . +// + +// +//! 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); +} diff --git a/readme.md b/readme.md index a609a38..9f49f4b 100644 --- a/readme.md +++ b/readme.md @@ -29,12 +29,12 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa Displays Rockers Fixing_block Quadrant D_connectors Rod Foot Round Fans Screws Handle Rounded_cylinder - Fuseholder Sealing_strip Ribbon_clamp Rounded_polygon - Hot_ends Sheets Screw_knob Sector - Iecs Spades Socket_box Sweep - Inserts Spools Ssr_shroud Tube - Jack Springs Strap_handle - Leadnuts Ssrs + Fuseholder Sealing_strip Psu_shroud Rounded_polygon + Hot_ends Sheets Ribbon_clamp Sector + Iecs Spades Screw_knob Sweep + Inserts Spools Socket_box Tube + Jack Springs Ssr_shroud + Leadnuts Ssrs Strap_handle Leds Stepper_motors Light_strips Toggles Linear_bearings Transformers @@ -3496,6 +3496,64 @@ Printed handle that can be printed without needing support material due to its t | 1 | handle_assembly | +Top + +--- + +## 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 | + + Top --- diff --git a/tests/png/psu_shroud.png b/tests/png/psu_shroud.png new file mode 100644 index 0000000..1531207 Binary files /dev/null and b/tests/png/psu_shroud.png differ diff --git a/tests/psu_shroud.scad b/tests/psu_shroud.scad new file mode 100644 index 0000000..1c801c8 --- /dev/null +++ b/tests/psu_shroud.scad @@ -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 . +// +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(); diff --git a/tests/ssr_shroud.scad b/tests/ssr_shroud.scad index 17d220a..8f50628 100644 --- a/tests/ssr_shroud.scad +++ b/tests/ssr_shroud.scad @@ -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(); diff --git a/vitamins/psu.scad b/vitamins/psu.scad index ac4e160..7a46a18 100644 --- a/vitamins/psu.scad +++ b/vitamins/psu.scad @@ -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;