diff --git a/examples/MainsBreakOutBox/bom/bom.json b/examples/MainsBreakOutBox/bom/bom.json index 46e1716..1e3c053 100644 --- a/examples/MainsBreakOutBox/bom/bom.json +++ b/examples/MainsBreakOutBox/bom/bom.json @@ -26,7 +26,7 @@ "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 + "nut(M3_nut, nyloc = true): Nut M3 x 2.4mm nyloc": 4 }, "printed": { "foot.stl": 4 @@ -42,7 +42,7 @@ "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 + "nut(M3_nut, nyloc = true): Nut M3 x 2.4mm nyloc": 2 }, "printed": {}, "routed": {} diff --git a/examples/MainsBreakOutBox/bom/bom.txt b/examples/MainsBreakOutBox/bom/bom.txt index a3271b9..9e9f9c1 100644 --- a/examples/MainsBreakOutBox/bom/bom.txt +++ b/examples/MainsBreakOutBox/bom/bom.txt @@ -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 diff --git a/examples/MainsBreakOutBox/bom/feet_assembly.txt b/examples/MainsBreakOutBox/bom/feet_assembly.txt index 902a0d8..b35213c 100644 --- a/examples/MainsBreakOutBox/bom/feet_assembly.txt +++ b/examples/MainsBreakOutBox/bom/feet_assembly.txt @@ -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 diff --git a/examples/MainsBreakOutBox/bom/mains_in_assembly.txt b/examples/MainsBreakOutBox/bom/mains_in_assembly.txt index 1e5b5ed..14a9f77 100644 --- a/examples/MainsBreakOutBox/bom/mains_in_assembly.txt +++ b/examples/MainsBreakOutBox/bom/mains_in_assembly.txt @@ -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 diff --git a/examples/MainsBreakOutBox/readme.md b/examples/MainsBreakOutBox/readme.md index eca3e6a..b94bce6 100644 --- a/examples/MainsBreakOutBox/readme.md +++ b/examples/MainsBreakOutBox/readme.md @@ -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 diff --git a/readme.md b/readme.md index b05caa9..80a5fcd 100644 --- a/readme.md +++ b/readme.md @@ -781,12 +781,18 @@ IEC mains inlets and outlet. | ```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) diff --git a/tests/png/pcbs.png b/tests/png/pcbs.png index 82864f6..d5101fa 100644 Binary files a/tests/png/pcbs.png and b/tests/png/pcbs.png differ diff --git a/tests/png/spheres.png b/tests/png/spheres.png deleted file mode 100644 index 2d0ef3f..0000000 Binary files a/tests/png/spheres.png and /dev/null differ diff --git a/tests/png/veroboard.png b/tests/png/veroboard.png index b11b332..07b2a18 100644 Binary files a/tests/png/veroboard.png and b/tests/png/veroboard.png differ diff --git a/tests/png/washers.png b/tests/png/washers.png index 092c9a0..1d32d48 100644 Binary files a/tests/png/washers.png and b/tests/png/washers.png differ diff --git a/utils/core/polyholes.scad b/utils/core/polyholes.scad index e57b087..b10f6dc 100644 --- a/utils/core/polyholes.scad +++ b/utils/core/polyholes.scad @@ -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); diff --git a/vitamins/iec.scad b/vitamins/iec.scad index 0c7152e..2ef9f49 100644 --- a/vitamins/iec.scad +++ b/vitamins/iec.scad @@ -46,7 +46,8 @@ 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 -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))); @@ -181,18 +182,24 @@ 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() @@ -204,13 +211,20 @@ module iec_holes(type, h = 100, poly = false, horizontal = false, insert = false drill(iec_slot_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 +236,5 @@ module iec_assembly(type, thickness) { //! Assembly with fasteners given panel t translate_z(-thickness) vflip() nut_and_washer(nut, true); - else - insert(insert); } } diff --git a/vitamins/insert.scad b/vitamins/insert.scad index 1c46d2b..e6590d4 100644 --- a/vitamins/insert.scad +++ b/vitamins/insert.scad @@ -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)); + } }