Created
March 17, 2018 02:14
-
-
Save ednisley/0f7346b86d0a3e1f5150e8ce067d156a to your computer and use it in GitHub Desktop.
OpenSCAD source code: Power supply brick mounting brackets for MPCNC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Power Supply Brick brackets | |
// Ed Nisley KE4ZNU 2018-02-26 | |
Layout = "Show"; | |
//-- Extrusion parameters | |
ThreadThick = 0.25; | |
ThreadWidth = 0.4; | |
HoleWindage = 0.3; // enlarge hole dia by this amount | |
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit); | |
Protrusion = 0.1; // make holes look good and joints intersect properly | |
//-- Useful sizes | |
inch = 25.4; | |
Tap10_32 = 0.159 * inch; | |
Clear10_32 = 0.190 * inch; | |
Head10_32 = 0.373 * inch; | |
Head10_32Thick = 0.110 * inch; | |
Nut10_32Dia = 0.433 * inch; | |
Nut10_32Thick = 0.130 * inch; | |
ID = 0; | |
OD = 1; | |
LENGTH = 2; | |
//-- Bracket Dimensions | |
Brick = [170.0,66.0,40.0]; // overall size, add details in module | |
Socket = [30.0,24.0]; // IEC power socket | |
Cable = [6.0,15.0]; // DC output cable ID=wire OD=strain relief | |
WallThick = 3.0; // default wall thickness | |
BaseThick = 4.0; | |
Screw = [5.1,10.0,3.0]; // screw size, more-or-less 10-32, OD & LENGTH for head | |
NumSides = 3*4; | |
//---------------------- | |
// Useful routines | |
module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes | |
Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2); | |
FixDia = Dia / cos(180/Sides); | |
cylinder(r=(FixDia + HoleWindage)/2, | |
h=Height, | |
$fn=Sides); | |
} | |
//---------------------- | |
// Models | |
module BrickMount(End="Both") { | |
difference() { | |
union() { | |
hull() // main block | |
for (i=[-1,1], j=[-1,1], k=[0,1]) | |
translate([i*(Brick.x/2 + WallThick - WallThick), | |
j*(Brick.y/2 + WallThick - WallThick), | |
k*(Brick.z + WallThick - WallThick)]) | |
sphere(r=WallThick,$fn=NumSides); | |
hull() // screw flanges | |
for (i=[-1,1], j=[-1,1]) | |
translate([i*(Brick.x/2 + WallThick - BaseThick), | |
j*(Brick.y/2 + WallThick + 2*Screw[OD] - BaseThick), | |
0]) | |
sphere(r=BaseThick,$fn=NumSides); | |
} | |
for (i=[-1,1], j=[-1,1]) // remove screw holes | |
translate([i*(Brick.x/2 + WallThick - Screw[OD]), | |
j*(Brick.y/2 + WallThick + Screw[OD]), | |
-Protrusion]) | |
rotate(180/6) | |
PolyCyl(Screw[ID],2*WallThick,6); | |
translate([0,0,Brick.z/2]) // remove center part to leave ends | |
cube([(Brick.x + 2*WallThick - 4*Screw[OD]),2*Brick.y,2*Brick.z],center=true); | |
if (End == "Socket") | |
translate([Brick.x/2,0,Brick.z/2]) // remove cable end to leave socket | |
cube([(Brick.x + 2*WallThick - 4*Screw[OD]),2*Brick.y,2*Brick.z],center=true); | |
if (End == "Cable") | |
translate([-Brick.x/2,0,Brick.z/2]) // remove socket end to leave cable | |
cube([(Brick.x + 2*WallThick - 4*Screw[OD]),2*Brick.y,2*Brick.z],center=true); | |
translate([0,0,Brick.z/2 - Protrusion/2]) // remove power supply brick from interior | |
cube(Brick + [0,0,Protrusion],center=true); | |
translate([0,0,-Brick.z]) // remove below XY plane | |
cube(2*Brick,center=true); | |
translate([0,0,Brick.z/2]) // remove AC socket | |
rotate([0,-90,0]) | |
rotate(90) | |
linear_extrude(height=Brick.x,convexity=2) | |
square(Socket,center=true); | |
translate([0,0,Brick.z/2]) // remove DC cable | |
rotate([0,90,0]) | |
rotate(180/8) | |
PolyCyl(Cable[OD],Brick.x,8); | |
translate([Brick.x/2,0,Brick.z/4 - Protrusion/2]) // ... and wire slot | |
cube([Brick.x,Cable[ID],Brick.z/2 + Protrusion],center=true); | |
} | |
} | |
//---------------------- | |
// Build it | |
if (Layout == "Show") | |
BrickMount("Both"); | |
if (Layout == "Build") { | |
translate([5,0,Brick.x/2 + WallThick]) | |
rotate([0,90,0]) | |
BrickMount("Cable"); | |
translate([-5,0,Brick.x/2 + WallThick]) | |
rotate([0,-90,0]) | |
BrickMount("Socket"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More details on my blog at https://wp.me/poZKh-7nR