Fixed bugs in poly_ring() and insert_boss().

IEC screw length fixed at 10 if inserts used.
This commit is contained in:
Chris Palmer 2019-06-16 17:07:02 +01:00
parent 7eaace0194
commit 757e88ed0c
13 changed files with 49 additions and 29 deletions

View File

@ -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": {}

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

@ -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)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 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

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

@ -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);
}
}

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));
}
}