mead-horn: note dependency on dotscad
[clinton/3d-models.git] / etc / meanwell_supply_cover.scad
1 // Power Supply Cover
2 // Copyright (c) 2014 "gregington"
3 // CC BY-SA 3.0, http://www.thingiverse.com/thing:216951
4
5 // Customized by Clinton Ebadi <clinton@unknownlamer.org> for the
6 // SE-600 power supply. Copyright (c) 2016.
7
8 // TODO:
9
10 // - powerSocket, powerSwitch, screwHoles, ... might be cleaner if
11 // placement were done separately. Should be possible to add
12 // modules for placing parts (lying flat, centered on the origin)
13 // on each surface of the psu cover, fine tuning positions using
14 // translate().
15 //
16 // - add powerpole mount option
17
18 // new todo: - recheck dimensions -- screw holes are fixed offset from
19 // cover_depth... cover_depth needs to be rechecked/recalculated as
20 // wall + clearance needed for power socket + screw y offset
21
22 // or: optimal case depth is buffer + screw hole distance from edge of
23 // case + whatever space is needed inside the case + back wall
24 // thickness
25
26
27 // case depth = back wall thickness + cavity size + mounting hole offset + extra behind mounting hole
28
29 // cavity size is usually just enough for the plug or terminals + some extra
30
31 WALL = 2;
32
33 PSU_CLEARANCE = 1;
34 PSU_WIDTH = 127 + PSU_CLEARANCE;
35 PSU_HEIGHT = 63.5 + PSU_CLEARANCE;
36 PSU_DEPTH = 200;
37
38 COVER_WIDTH = PSU_WIDTH + (2 * WALL);
39 COVER_HEIGHT = PSU_HEIGHT + (2 * WALL);
40
41 COVER_DEPTH = 11 + 6 + 2*(25.4+2) + WALL; // ac
42 //COVER_DEPTH = 11 + 6 + 30 + WALL; // dc
43
44 //COVER_SUPPORT_WIDTH = 20; // ??
45
46 VENT_HEIGHT = PSU_HEIGHT - PSU_CLEARANCE - WALL - 1;
47 VENT_WIDTH = 2;
48 VENT_DISTANCE = 5; // was 4
49
50 CABLE_SLOT_WIDTH = 18;
51 CABLE_SLOT_HEIGHT = 50;
52 CABLE_SLOT_Y_OFFSET = 40;
53
54 //CABLE_SLOT_VENT_DISTANCE = 2; // ???
55
56 POWER_SOCKET_OFFSET = WALL*2 + 43/2;
57 POWER_SWITCH_OFFSET = 20;
58
59 SCREW_HOLE_HEIGHT = 12;
60 SCREW_HOLE_WIDTH = 3;
61 SCREW_HOLE_Z_OFFSET = 30; // offset from top of PSU
62 SCREW_HOLE_GAP = 20; // distance between screw holes
63 SCREW_HOLE_Y_OFFSET = COVER_DEPTH - 6; // offset from back of case
64
65
66 module cover() {
67 difference() {
68 minkowski () {
69 cube([COVER_WIDTH, COVER_DEPTH, COVER_HEIGHT]);
70 // sphere (d=1);
71 }
72 translate([WALL, WALL, WALL]) {
73 # cube([PSU_WIDTH, PSU_DEPTH, PSU_HEIGHT]);
74 }
75 }
76 }
77
78 module vents(offset = 0, limit = COVER_WIDTH - WALL) {
79 for (x = [ WALL + VENT_DISTANCE + offset : VENT_DISTANCE : limit ]) {
80 translate([x, WALL, (COVER_HEIGHT - VENT_HEIGHT) / 2]) {
81 rotate([0, -90, 90]) {
82 slot(VENT_WIDTH, VENT_HEIGHT, 2 * WALL);
83 }
84 }
85 }
86
87 }
88
89 module slot(width, height, depth, center = false) {
90 translate([width / 2, 0, 0]) {
91 union() {
92 cube([height - width, width, depth]);
93 translate([0, width / 2, 0]) {
94 cylinder(h = depth, r = width / 2);
95 }
96 translate([height - width, width / 2, 0]) {
97 cylinder(h = depth, r = width / 2);
98 }
99 }
100 }
101 }
102
103 module cslot(width, height, depth) {
104 translate ([-height/2, -width/2, -depth/2])
105 slot (width, height, depth);
106 }
107
108
109 // defaults for https://www.digikey.com/product-detail/en/1-1609112-2/CCM1916-ND/2292077
110 //module powerSocket(width = 27, height = 38, screw_distance = 35, side=0) {
111 module powerSocket(width = 1.06*25.4, height = 1.56*25.4, screw_distance = 1.42*25.4, side=0) {
112 translate([WALL*(side ? 2 : 1) + 2 + (side ? PSU_WIDTH : 0), POWER_SOCKET_OFFSET, (COVER_HEIGHT/2+height)/2]) {
113 rotate([0, 90, 0]) {
114 translate([0,screw_distance/2,-5]) { rotate ([0, 0, 90]) cslot (3, 5, 22); }
115 translate([0,-screw_distance/2,-5]) { rotate ([0, 0, 90]) cslot (3, 5, 22); }
116 translate([0,0,-5.5 - 1.5])
117 minkowski() {
118 #cube([height-8,width-8,11], center=true);
119 cylinder(r=4.5,h=0.1);
120 }
121 }
122 }
123 }
124
125 module powerSwitch() {
126 translate([COVER_WIDTH / 2, POWER_SWITCH_OFFSET, COVER_HEIGHT + 2]) {
127 rotate([0, 0, -90]) {
128 cube([14.8,20.8,2], center=true);
129 translate([0,0,-7-1]) cube([13,19.8,14], center=true);
130 }
131 }
132 }
133
134 module cableSlot() {
135 translate([(PSU_WIDTH - CABLE_SLOT_HEIGHT) / 2, WALL, (COVER_HEIGHT - VENT_HEIGHT) / 2]) {
136 rotate([90, 0, 0]) {
137 slot(CABLE_SLOT_WIDTH, CABLE_SLOT_HEIGHT, WALL * 2);
138 }
139 }
140 }
141
142 module cableSlotOutline() {
143 border = 4;
144 translate([(PSU_WIDTH - CABLE_SLOT_HEIGHT - border) / 2, WALL, (COVER_HEIGHT - VENT_HEIGHT - border) / 2]) {
145 rotate([90, 0, 0]) {
146 slot(CABLE_SLOT_WIDTH + border, CABLE_SLOT_HEIGHT + border, WALL * 2);
147 }
148 }
149 }
150
151 module screwHoles() {
152 translate ([-2.5, SCREW_HOLE_Y_OFFSET + WALL - SCREW_HOLE_HEIGHT, -SCREW_HOLE_WIDTH/2 + WALL + + PSU_CLEARANCE/2 + SCREW_HOLE_Z_OFFSET]) {
153 rotate([90, 0, 90]) {
154 #slot(SCREW_HOLE_WIDTH, SCREW_HOLE_HEIGHT, COVER_WIDTH + 5);
155 translate ([0, SCREW_HOLE_GAP, 0])
156 slot(SCREW_HOLE_WIDTH, SCREW_HOLE_HEIGHT, COVER_WIDTH + 5);
157 }
158 }
159 }
160
161 module ac_cover () {
162 translate([0, COVER_HEIGHT, 0]) rotate([90, 0, 0]) {
163 difference() {
164 cover();
165 vents(offset = PSU_WIDTH/2 );
166 powerSocket(side=1);
167 screwHoles();
168 }
169 }
170 }
171
172 module dc_cover () {
173 translate([0, COVER_HEIGHT, 0]) rotate([90, 0, 0]) {
174 difference() {
175 cover();
176 difference () {
177 vents(limit = PSU_WIDTH);
178 cableSlotOutline();
179 }
180 cableSlot();
181 screwHoles();
182 }
183 }
184 }
185
186 $fs = 0.5;
187
188 intersection () {
189 // translate ([115, -10, -1]) #cube ([50, 100, 100]);
190 ac_cover ();
191
192 }
193 //translate ([200,0,0]) dc_cover ();
194
195 // power socket mockups
196
197 /* difference () { */
198 /* cube ([5,45,50]); */
199 /* #translate ([0, 0, -10]) powerSocket (); */
200 /* } */
201
202 /* translate ([100, 0, 0]) */
203 /* difference () { */
204 /* cube ([5, 40,50]); */
205 /* translate ([0, -30, -20]) #screwHoles(); */
206 /* } */