|
| 1 | +/* |
| 2 | + * Controleo3 reflow oven add-ons |
| 3 | + * Power cord grommet |
| 4 | + * By smkent (GitHub) / bulbasaur0 (Printables) |
| 5 | + * |
| 6 | + * Licensed under Creative Commons (4.0 International License) Attribution-ShareAlike |
| 7 | + */ |
| 8 | + |
| 9 | +/* [Rendering Options] */ |
| 10 | +Print_Orientation = true; |
| 11 | + |
| 12 | +/* [Size] */ |
| 13 | +// All units in millimeters |
| 14 | + |
| 15 | +Dimensions = [15, 10.2]; // [5:0.1:20] |
| 16 | +Radius = 3.5; // [0:0.1:5] |
| 17 | +Thickness = 3; // [1.5:0.1:10] |
| 18 | +Cord_Diameter = 9.5; // [5:0.05:20] |
| 19 | + |
| 20 | +Screw_Hole_Diameter = 3; // [2:0.1:5] |
| 21 | +Screw_Hole_Offset = 5; |
| 22 | +Grommet_Thickness = 3; // [0.8:0.1:5] |
| 23 | +Grommet_Depth = 6; // [0.4:0.1:5] |
| 24 | + |
| 25 | +/* [Advanced Options] */ |
| 26 | +Vertical_Overlap = 8; // [0:0.1:10] |
| 27 | +Screw_Hole_Fit = 0.2; // [0:0.05:1] |
| 28 | +Screw_Hole_Style = "inset"; // [flat: Flat, countersink: Countersink, inset: Inset] |
| 29 | +Edge_Radius = 0.4; // [0:0.1:3] |
| 30 | + |
| 31 | +/* [Development Toggles] */ |
| 32 | + |
| 33 | +module __end_customizer_options__() { } |
| 34 | + |
| 35 | +// Constants // |
| 36 | + |
| 37 | +$fa = $preview ? $fa : 2; |
| 38 | +$fs = $preview ? $fs / 4 : 0.4; |
| 39 | + |
| 40 | +shd = Screw_Hole_Diameter + Screw_Hole_Fit; |
| 41 | +soff = shd * 2 + Grommet_Thickness; |
| 42 | + |
| 43 | +slop = 0.001; |
| 44 | + |
| 45 | +// Functions // |
| 46 | + |
| 47 | +function vec_add(vector, add) = [for (v = vector) v + add]; |
| 48 | + |
| 49 | +// Modules // |
| 50 | + |
| 51 | +module _round_3d(radius = Edge_Radius) { |
| 52 | + if (radius == 0) { |
| 53 | + children(); |
| 54 | + } else { |
| 55 | + render() |
| 56 | + minkowski() { |
| 57 | + children(); |
| 58 | + for (mz = [0, 1]) |
| 59 | + mirror([0, 0, mz]) |
| 60 | + cylinder(r1=radius, r2=0, h=radius); |
| 61 | + } |
| 62 | + } |
| 63 | +} |
| 64 | + |
| 65 | +module _screw_hole(d, h, fit=0, style="flat", print_upside_down=false) { |
| 66 | + inset_bare_min_h = 1.4; |
| 67 | + inset_min_h = (style == "inset") ? max((h - d), inset_bare_min_h) - (h - d) : 0; |
| 68 | + translate([0, 0, -slop]) |
| 69 | + cylinder(d=(d + fit), h=h + slop * 2); |
| 70 | + if (style == "countersink" || style == "inset") { |
| 71 | + translate([0, 0, h + inset_min_h + slop * 2]) |
| 72 | + mirror([0, 0, 1]) |
| 73 | + cylinder(d1=d * 2, d2=d * (style == "inset" ? 2 : 1), h=d); |
| 74 | + } |
| 75 | + if (style == "inset" && print_upside_down) { |
| 76 | + layer_height = 0.2; |
| 77 | + translate([0, 0, (h + inset_min_h) - d - layer_height]) |
| 78 | + linear_extrude(height=layer_height + slop * 2) |
| 79 | + intersection() { |
| 80 | + square([d * 2, d + fit], center=true); |
| 81 | + circle(d=d*2); |
| 82 | + } |
| 83 | + } |
| 84 | +} |
| 85 | + |
| 86 | +module _round_hole(r=Radius) { |
| 87 | + offset(r=r) |
| 88 | + offset(r=-r) |
| 89 | + children(); |
| 90 | +} |
| 91 | + |
| 92 | + |
| 93 | +module at_power_cord_grommet_screw_holes() { |
| 94 | + for (mx = [0, 1]) |
| 95 | + mirror([mx, 0]) |
| 96 | + translate([Dimensions[0] / 2 + Screw_Hole_Offset / 2, 0]) |
| 97 | + children(); |
| 98 | +} |
| 99 | + |
| 100 | +module power_cord_grommet_hole() { |
| 101 | + dd = Cord_Diameter; |
| 102 | + translate([0, 0, slop]) |
| 103 | + linear_extrude(height=Thickness + Grommet_Depth + slop * 2) |
| 104 | + circle(d=dd); |
| 105 | + translate([0, 0, -slop]) |
| 106 | + cylinder(d2=dd, d1=dd + Edge_Radius * 2, h=Edge_Radius); |
| 107 | + translate([0, 0, Thickness + Grommet_Depth - Edge_Radius + slop]) |
| 108 | + cylinder(d1=dd, d2=dd + Edge_Radius * 2, h=Edge_Radius); |
| 109 | +} |
| 110 | + |
| 111 | +module power_cord_grommet_screw_holes() { |
| 112 | + translate([0, 0, Thickness]) |
| 113 | + mirror([0, 0, 1]) |
| 114 | + at_power_cord_grommet_screw_holes() |
| 115 | + _screw_hole( |
| 116 | + d=Screw_Hole_Diameter, |
| 117 | + h=Thickness, |
| 118 | + fit=Screw_Hole_Fit, |
| 119 | + style=Screw_Hole_Style, |
| 120 | + print_upside_down=true |
| 121 | + ); |
| 122 | +} |
| 123 | + |
| 124 | +module power_cord_grommet_body() { |
| 125 | + difference() { |
| 126 | + translate([0, 0, Edge_Radius]) |
| 127 | + union() { |
| 128 | + _round_3d() |
| 129 | + linear_extrude(height=Thickness + Grommet_Depth - Edge_Radius * 2) |
| 130 | + _round_hole(Radius - Edge_Radius) |
| 131 | + square(vec_add(Dimensions, -Edge_Radius * 2), center=true); |
| 132 | + |
| 133 | + _round_3d() |
| 134 | + linear_extrude(height=Thickness - Edge_Radius * 2) { |
| 135 | + cd = max(3, shd / 2); |
| 136 | + hull() { |
| 137 | + _round_hole(Radius - Edge_Radius) |
| 138 | + square( |
| 139 | + vec_add(Dimensions, -Edge_Radius * 2) |
| 140 | + + [ |
| 141 | + Screw_Hole_Offset + Screw_Hole_Diameter * 2, |
| 142 | + Vertical_Overlap |
| 143 | + ], |
| 144 | + center=true |
| 145 | + ); |
| 146 | + at_power_cord_grommet_screw_holes() |
| 147 | + translate([Screw_Hole_Diameter, 0]) |
| 148 | + circle(d=cd); |
| 149 | + } |
| 150 | + } |
| 151 | + } |
| 152 | + power_cord_grommet_hole(); |
| 153 | + power_cord_grommet_screw_holes(); |
| 154 | + } |
| 155 | +} |
| 156 | + |
| 157 | +module power_cord_grommet() { |
| 158 | + render() |
| 159 | + power_cord_grommet_body(); |
| 160 | +} |
| 161 | + |
| 162 | +module main() { |
| 163 | + color("lightsteelblue", 0.8) |
| 164 | + power_cord_grommet(); |
| 165 | +} |
| 166 | + |
| 167 | +main(); |
0 commit comments