paul@22 | 1 | /* |
paul@22 | 2 | Copyright (C) 2014 Paul Boddie |
paul@22 | 3 | |
paul@22 | 4 | This program is free software; you can redistribute it and/or modify it under |
paul@22 | 5 | the terms of the GNU General Public License as published by the Free Software |
paul@22 | 6 | Foundation; either version 3 of the License, or (at your option) any later |
paul@22 | 7 | version. |
paul@22 | 8 | |
paul@22 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@22 | 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
paul@22 | 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
paul@22 | 12 | more details. |
paul@22 | 13 | |
paul@22 | 14 | You should have received a copy of the GNU General Public License along with |
paul@22 | 15 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@22 | 16 | */ |
paul@22 | 17 | |
paul@0 | 18 | module cartridge() |
paul@0 | 19 | { |
paul@0 | 20 | $fn = 50; |
paul@0 | 21 | |
paul@41 | 22 | /* Configure the generated shapes. */ |
paul@41 | 23 | |
paul@41 | 24 | BACK_CAVITY = 1; |
paul@41 | 25 | FRONT_LABEL_INSET = 1; |
paul@41 | 26 | TOP_LABEL_INSET = 1; |
paul@41 | 27 | GROOVE = 1; |
paul@41 | 28 | |
paul@45 | 29 | /* |
paul@45 | 30 | Options for checking. Some useful combinations... |
paul@45 | 31 | |
paul@45 | 32 | Check feature alignment: APART = 0; BACK_SURFACE = 0; FRONT_SURFACE = 0; |
paul@45 | 33 | Check PCB alignment: PCB = 1; BACK_SURFACE = 0; |
paul@45 | 34 | */ |
paul@45 | 35 | |
paul@43 | 36 | BACK = 1; BACK_SURFACE = 1; |
paul@43 | 37 | FRONT = 1; FRONT_SURFACE = 1; |
paul@45 | 38 | |
paul@45 | 39 | /* For printing: APART = 1; PCB = 0; */ |
paul@45 | 40 | |
paul@43 | 41 | APART = 1; |
paul@45 | 42 | PCB = 0; |
paul@43 | 43 | |
paul@48 | 44 | /* To save time (before printing): FILLET = 0; */ |
paul@48 | 45 | |
paul@48 | 46 | FILLET = 1; |
paul@48 | 47 | |
paul@22 | 48 | /* |
paul@22 | 49 | Rounding/fillet radius and additional margin of subtracted |
paul@22 | 50 | material. The additional margin helps avoid geometry problems. |
paul@22 | 51 | */ |
paul@3 | 52 | |
paul@23 | 53 | rr = 2; |
paul@3 | 54 | ro = rr; |
paul@3 | 55 | extra = 0.1; |
paul@3 | 56 | |
paul@47 | 57 | groove_rr = 0.2; |
paul@46 | 58 | groove_ro = groove_rr; |
paul@46 | 59 | |
paul@47 | 60 | pcb_lug_rr = 0.5; |
paul@47 | 61 | pcb_lug_ro = pcb_lug_rr; |
paul@47 | 62 | |
paul@47 | 63 | /* A fillet performs rounding using a quarter segment of a cylinder. */ |
paul@47 | 64 | |
paul@0 | 65 | module fillet(r, h) { |
paul@48 | 66 | if (FILLET) |
paul@48 | 67 | translate([0, 0, -h/2]) |
paul@48 | 68 | difference() { |
paul@48 | 69 | cube([r + extra, r + extra, h + extra]); |
paul@48 | 70 | cylinder(r = r, h = h); |
paul@48 | 71 | } |
paul@48 | 72 | } |
paul@48 | 73 | |
paul@50 | 74 | /* A fillet justified using the axes. */ |
paul@50 | 75 | |
paul@48 | 76 | module fillet_justified(r, h) { |
paul@48 | 77 | if (FILLET) |
paul@0 | 78 | difference() { |
paul@12 | 79 | cube([r + extra, r + extra, h + extra]); |
paul@0 | 80 | cylinder(r = r, h = h); |
paul@0 | 81 | } |
paul@0 | 82 | } |
paul@0 | 83 | |
paul@50 | 84 | /* A justified fillet with the extra material below the y-axis. */ |
paul@50 | 85 | |
paul@50 | 86 | module fillet_partitioned(r, h) { |
paul@50 | 87 | if (FILLET) |
paul@50 | 88 | difference() { |
paul@50 | 89 | translate([0, 0, -extra]) |
paul@50 | 90 | cube([r + extra, r + extra, h + extra]); |
paul@50 | 91 | cylinder(r = r, h = h); |
paul@50 | 92 | } |
paul@50 | 93 | } |
paul@50 | 94 | |
paul@47 | 95 | module fillet_torus(radius, rounding) { |
paul@48 | 96 | if (FILLET) |
paul@48 | 97 | difference() { |
paul@48 | 98 | cube_at((radius + extra) * 2, (radius + extra) * 2, rounding + extra, |
paul@48 | 99 | 0, 0, 1, |
paul@48 | 100 | 0, 0, 0); |
paul@48 | 101 | union() { |
paul@48 | 102 | rotate_extrude(convexity = 10) |
paul@48 | 103 | translate([radius - rounding, 0, 0]) |
paul@48 | 104 | circle(r = rounding); |
paul@48 | 105 | cylinder(r = radius - rounding, h = rounding); |
paul@48 | 106 | } |
paul@47 | 107 | } |
paul@47 | 108 | } |
paul@47 | 109 | |
paul@20 | 110 | /* |
paul@21 | 111 | Justify an object of the given dimensions, according to the given |
paul@21 | 112 | factors (where 1 indicates moving the object to the positive side of an |
paul@21 | 113 | axis, and -1 indicates moving it to the negative side of an axis). |
paul@21 | 114 | |
paul@21 | 115 | NOTE: child should eventually be replaced by children. |
paul@21 | 116 | */ |
paul@21 | 117 | module justify(width, depth, height, wdir, ddir, hdir) { |
paul@21 | 118 | translate([ |
paul@21 | 119 | wdir * width / 2, |
paul@21 | 120 | ddir * depth / 2, |
paul@21 | 121 | hdir * height / 2]) |
paul@21 | 122 | child(); |
paul@21 | 123 | } |
paul@21 | 124 | |
paul@21 | 125 | /* |
paul@20 | 126 | Make a cuboid of the given dimensions, justifying it according to the given |
paul@21 | 127 | factors, and moving it to the specified coordinates. |
paul@21 | 128 | |
paul@21 | 129 | NOTE: Usage of justify within this module will not work due to recursion |
paul@21 | 130 | NOTE: limitations in openscad, potentially removed in more recent |
paul@21 | 131 | NOTE: releases. Thus, the justify transform is merged in here. |
paul@20 | 132 | */ |
paul@20 | 133 | module cube_at(width, depth, height, wdir, ddir, hdir, x, y, z) { |
paul@20 | 134 | translate([ |
paul@20 | 135 | x + wdir * width / 2, |
paul@20 | 136 | y + ddir * depth / 2, |
paul@20 | 137 | z + hdir * height / 2]) |
paul@20 | 138 | cube([width, depth, height], center = true); |
paul@20 | 139 | } |
paul@20 | 140 | |
paul@38 | 141 | /* Internal dimensions. */ |
paul@0 | 142 | |
paul@50 | 143 | int_payload_width = 86.0; /* internal width in the payload section */ |
paul@50 | 144 | int_connector_width = 86.0; /* limited to the Plus 1 socket dimensions */ |
paul@49 | 145 | int_payload_depth = 12.5; /* maximum depth in the payload section */ |
paul@49 | 146 | int_connector_depth = 11.0; /* maximum depth in the connector section */ |
paul@42 | 147 | int_payload_height = 50.8; /* space between the top and the floor */ |
paul@42 | 148 | int_connector_height = 13.5; /* vertical offset of bottom/floor of payload area */ |
paul@0 | 149 | |
paul@24 | 150 | /* Side thicknesses. */ |
paul@24 | 151 | |
paul@24 | 152 | front = 2; |
paul@49 | 153 | payload_back = 2; /* in the payload area the thickness is reduced */ |
paul@49 | 154 | connector_back = 3.5; /* the back cavity requires a thicker back wall */ |
paul@24 | 155 | top = 3; |
paul@42 | 156 | side = 2; /* increased from 1.5 for 3D printing reliability */ |
paul@42 | 157 | bottom = 1; /* thickness of floor of payload area */ |
paul@34 | 158 | |
paul@38 | 159 | /* How much extra depth the back provides for mating with the front. */ |
paul@38 | 160 | |
paul@42 | 161 | groove_width_extra = 1.0; |
paul@42 | 162 | front_back_overlap = 1.0; |
paul@42 | 163 | groove_width_overlap = front_back_overlap + groove_width_extra; |
paul@38 | 164 | |
paul@39 | 165 | /* Division of pieces into front and back, defining the extents. */ |
paul@38 | 166 | |
paul@39 | 167 | int_front_depth = 4.5; |
paul@39 | 168 | front_depth = int_front_depth + front; |
paul@49 | 169 | int_payload_back_depth = int_payload_depth - int_front_depth + front_back_overlap; |
paul@49 | 170 | int_connector_back_depth = int_connector_depth - int_front_depth + front_back_overlap; |
paul@49 | 171 | back_depth = int_payload_back_depth + payload_back; |
paul@38 | 172 | |
paul@38 | 173 | /* Cartridge dimensions. */ |
paul@38 | 174 | |
paul@50 | 175 | payload_width = int_payload_width + side + side; |
paul@50 | 176 | connector_width = int_connector_width + side + side; |
paul@49 | 177 | payload_height = top + int_payload_height; |
paul@49 | 178 | connector_height = bottom + int_connector_height; |
paul@49 | 179 | height = payload_height + bottom + int_connector_height; |
paul@49 | 180 | depth = int_payload_depth + front + payload_back; |
paul@42 | 181 | int_payload_upper_extent = height / 2 - top; |
paul@45 | 182 | int_payload_lower_extent = -height / 2 + int_connector_height + bottom; |
paul@38 | 183 | |
paul@51 | 184 | /* Where the payload is wider than the connector, the payload expands to the left. */ |
paul@51 | 185 | |
paul@51 | 186 | int_payload_right_extent = int_connector_width / 2; |
paul@51 | 187 | int_payload_left_extent = int_payload_right_extent - int_payload_width; |
paul@51 | 188 | payload_left_extent = int_payload_left_extent - side; |
paul@51 | 189 | payload_right_extent = int_payload_right_extent + side; |
paul@51 | 190 | payload_centre = (payload_left_extent + payload_right_extent) / 2; |
paul@51 | 191 | |
paul@38 | 192 | /* Cartridge surfaces. */ |
paul@38 | 193 | |
paul@34 | 194 | front_side = side; |
paul@29 | 195 | front_left = front_side; |
paul@29 | 196 | front_right = front_side; |
paul@34 | 197 | back_side = side; |
paul@29 | 198 | back_left = back_side; |
paul@29 | 199 | back_right = back_side; |
paul@24 | 200 | |
paul@20 | 201 | /* Label details. */ |
paul@1 | 202 | |
paul@50 | 203 | front_label_width = payload_width - side - side - 3.0; |
paul@1 | 204 | front_label_height = 46.0; |
paul@1 | 205 | front_label_depth = 1.0; |
paul@1 | 206 | front_label_offset_from_bottom = 19.5; |
paul@51 | 207 | front_label_centre = payload_centre; |
paul@51 | 208 | front_label_left_extent = front_label_centre - front_label_width / 2; |
paul@3 | 209 | |
paul@1 | 210 | top_label_width = front_label_width; |
paul@20 | 211 | top_label_height = 11.5; /* the height as seen from above */ |
paul@1 | 212 | top_label_depth = front_label_depth; |
paul@1 | 213 | top_label_offset_from_front = 2.5; |
paul@51 | 214 | top_label_centre = payload_centre; |
paul@51 | 215 | top_label_left_extent = top_label_centre - front_label_width / 2; |
paul@3 | 216 | |
paul@41 | 217 | /* |
paul@41 | 218 | The groove around the sides and top. This is extended to allow the |
paul@41 | 219 | pieces to fit together, and this extension is generated regardless of |
paul@41 | 220 | whether the visible groove is enabled or not. |
paul@41 | 221 | */ |
paul@20 | 222 | |
paul@41 | 223 | groove_width_exposed = GROOVE ? 1.5 : 0; |
paul@46 | 224 | groove_width_normal = groove_width_exposed + front_back_overlap; |
paul@8 | 225 | groove_depth = 1.0; /* how deep the groove goes into each side */ |
paul@20 | 226 | |
paul@20 | 227 | /* Additional cutting to mate the back and front. */ |
paul@20 | 228 | |
paul@42 | 229 | top_groove_width = groove_width_overlap; |
paul@8 | 230 | top_groove_depth = 2.0; |
paul@20 | 231 | |
paul@29 | 232 | /* |
paul@29 | 233 | Space for the inner edge of the back inside the front. |
paul@29 | 234 | Offsets are measured from the outside surfaces. |
paul@29 | 235 | */ |
paul@20 | 236 | |
paul@50 | 237 | inner_top_front_cutout_width = int_payload_width; |
paul@30 | 238 | inner_top_front_cutout_depth = top_groove_width; |
paul@30 | 239 | inner_top_front_cutout_height = top - top_groove_depth; |
paul@28 | 240 | |
paul@50 | 241 | inner_payload_front_cutout_height = payload_height - top_groove_depth; |
paul@50 | 242 | inner_payload_front_cutout_width = front_side - groove_depth; |
paul@50 | 243 | inner_payload_front_cutout_depth = groove_width_overlap; |
paul@50 | 244 | |
paul@50 | 245 | inner_connector_front_cutout_height = connector_height; |
paul@50 | 246 | inner_connector_front_cutout_width = front_side - groove_depth; |
paul@50 | 247 | inner_connector_front_cutout_depth = groove_width_overlap; |
paul@1 | 248 | |
paul@35 | 249 | /* |
paul@35 | 250 | The back cavity is the indented part at the bottom of the back of the |
paul@40 | 251 | cartridge. It appears to be mechanically superfluous, just making the |
paul@40 | 252 | shape of the cartridge look a bit fancier. |
paul@35 | 253 | */ |
paul@35 | 254 | |
paul@4 | 255 | back_cavity_width = 68.0; |
paul@4 | 256 | back_cavity_inner_width = 65.0; |
paul@40 | 257 | back_cavity_offset_from_inner_left = 9.0; |
paul@40 | 258 | back_cavity_inner_offset_from_inner_left = 10.5; |
paul@4 | 259 | back_cavity_height = 13.5; |
paul@4 | 260 | back_cavity_inner_height = 12.0; |
paul@4 | 261 | back_cavity_depth = 1.5; |
paul@4 | 262 | |
paul@39 | 263 | /* |
paul@40 | 264 | The effect of the cavity on the inside of the case. The most important |
paul@40 | 265 | measurement is the maximum offset since it defines the width of the |
paul@40 | 266 | internal space that should accommodate the plastic guides of the Plus 1 |
paul@40 | 267 | socket. |
paul@39 | 268 | */ |
paul@35 | 269 | |
paul@6 | 270 | inner_back_slope_depth = 2.5; |
paul@40 | 271 | inner_back_slope_width = inner_back_slope_depth; |
paul@40 | 272 | inner_back_slope_max_offset = 10.5; |
paul@40 | 273 | inner_back_slope_min_offset = inner_back_slope_max_offset - inner_back_slope_width; |
paul@5 | 274 | |
paul@40 | 275 | /* The tapering off of the inner back edge. */ |
paul@40 | 276 | |
paul@5 | 277 | inner_back_edge_width = 69.0; |
paul@5 | 278 | inner_back_edge_height = 3.0; |
paul@5 | 279 | inner_back_edge_depth = 1.5; |
paul@5 | 280 | |
paul@40 | 281 | /* The tapering off of the inner front edge. */ |
paul@40 | 282 | |
paul@50 | 283 | inner_front_edge_width = connector_width - front_side * 2; |
paul@7 | 284 | inner_front_edge_height = 3.0; |
paul@7 | 285 | inner_front_edge_depth = 1.5; |
paul@7 | 286 | |
paul@39 | 287 | /* |
paul@39 | 288 | The cutout in the floor of the back of the cartridge that accommodates |
paul@39 | 289 | the edge connector. |
paul@39 | 290 | */ |
paul@39 | 291 | |
paul@8 | 292 | edge_connector_cutout_back_depth = 3.0; |
paul@23 | 293 | edge_connector_cutout_back_width = 57.5; |
paul@8 | 294 | |
paul@17 | 295 | /* |
paul@49 | 296 | The cutouts in the floor of the front of the cartridge that produce a |
paul@49 | 297 | kind of tab that guides the edge connector into place in the back cutout. |
paul@49 | 298 | */ |
paul@49 | 299 | |
paul@49 | 300 | edge_connector_cutout_front_depth = front_back_overlap; |
paul@50 | 301 | edge_connector_cutout_front_width = (int_connector_width - edge_connector_cutout_back_width) / 2; |
paul@49 | 302 | |
paul@49 | 303 | /* |
paul@17 | 304 | Edge connectors are themselves 0.05" or approximately 1.27mm in |
paul@17 | 305 | thickness according to the Acorn Electron Cartridge Interface Specification |
paul@17 | 306 | (Acorn Support Application Group Note 014). |
paul@17 | 307 | */ |
paul@17 | 308 | |
paul@33 | 309 | /* Extra internal features. Depths include front and back surfaces. */ |
paul@14 | 310 | |
paul@23 | 311 | pcb_back_support_width = 1.2; |
paul@14 | 312 | pcb_back_support_depth = back_depth - |
paul@14 | 313 | edge_connector_cutout_back_depth; |
paul@38 | 314 | pcb_back_support_height = height - int_connector_height - top - bottom; |
paul@14 | 315 | |
paul@23 | 316 | pcb_front_support_width = 1.2; |
paul@44 | 317 | pcb_front_support_depth = int_front_depth; |
paul@15 | 318 | pcb_front_support_height = pcb_back_support_height; |
paul@15 | 319 | |
paul@16 | 320 | /* |
paul@45 | 321 | Features measured from the Stardot Dual ROM Adaptor cartridge board |
paul@37 | 322 | dimensions diagram. Offsets are from inside the bottom "floor". |
paul@16 | 323 | */ |
paul@16 | 324 | |
paul@16 | 325 | pcb_back_support_bump_width = pcb_front_support_width; |
paul@18 | 326 | pcb_back_support_bump_depth = 1.5; |
paul@23 | 327 | pcb_back_support_left_bump_height = 13.2; |
paul@23 | 328 | pcb_back_support_right_bump_height = 10.7; |
paul@23 | 329 | pcb_back_support_left_bump_offset_from_bottom = 15.1; |
paul@23 | 330 | pcb_back_support_right_bump_offset_from_bottom = 17.6; |
paul@27 | 331 | pcb_back_support_top_bump_height = 3.8; |
paul@16 | 332 | |
paul@24 | 333 | /* Move the PCB support towards the centre. */ |
paul@35 | 334 | pcb_support_margin = 1.75; |
paul@37 | 335 | pcb_support_offset_from_centre = edge_connector_cutout_back_width / 2 |
paul@37 | 336 | - pcb_support_margin; |
paul@24 | 337 | |
paul@25 | 338 | pcb_lug_depth = pcb_back_support_depth + |
paul@25 | 339 | pcb_back_support_bump_depth; |
paul@25 | 340 | pcb_lug_inner_radius = 1.0; |
paul@25 | 341 | pcb_lug_outer_radius = 5.5 / 2; |
paul@25 | 342 | pcb_lug_offset_from_bottom = 14.35; |
paul@45 | 343 | pcb_lug_offset_from_inside = 5.55; |
paul@25 | 344 | |
paul@25 | 345 | pcb_lug_cross_width = 6.7; |
paul@33 | 346 | pcb_lug_cross_depth = pcb_back_support_depth; |
paul@25 | 347 | pcb_lug_cross_height = 1.4; |
paul@25 | 348 | |
paul@33 | 349 | pcb_front_lug_depth = pcb_back_support_bump_depth + |
paul@44 | 350 | pcb_front_support_depth; |
paul@33 | 351 | pcb_front_lug_inner_radius = pcb_lug_outer_radius; |
paul@33 | 352 | pcb_front_lug_outer_radius = pow( |
paul@33 | 353 | pow(pcb_lug_cross_width / 2, 2) + |
paul@33 | 354 | pow(pcb_lug_cross_height / 2, 2), |
paul@33 | 355 | 0.5); |
paul@33 | 356 | |
paul@25 | 357 | /* Repeated constructs. */ |
paul@25 | 358 | |
paul@26 | 359 | module pcb_support(xdir, bump_height, bump_offset) { |
paul@35 | 360 | |
paul@35 | 361 | /* |
paul@35 | 362 | Translate the support in the stated direction. |
paul@35 | 363 | Since the support is already justified in the direction, the translation |
paul@35 | 364 | moves the inner edge of the support to alignment with the end of the |
paul@35 | 365 | edge connector cutout and then back by the PCB support margin. |
paul@35 | 366 | */ |
paul@35 | 367 | |
paul@25 | 368 | translate([xdir * |
paul@37 | 369 | pcb_support_offset_from_centre, |
paul@25 | 370 | edge_connector_cutout_back_depth, |
paul@45 | 371 | int_payload_lower_extent]) |
paul@25 | 372 | justify(pcb_back_support_width, |
paul@25 | 373 | pcb_back_support_depth, |
paul@25 | 374 | pcb_back_support_height, |
paul@25 | 375 | xdir, 1, 1) |
paul@25 | 376 | union() { |
paul@27 | 377 | |
paul@27 | 378 | /* Underlying support strut. */ |
paul@27 | 379 | |
paul@25 | 380 | cube([pcb_back_support_width, |
paul@25 | 381 | pcb_back_support_depth, |
paul@25 | 382 | pcb_back_support_height], center = true); |
paul@27 | 383 | |
paul@27 | 384 | /* Middle bump. */ |
paul@27 | 385 | |
paul@25 | 386 | cube_at(pcb_back_support_bump_width, |
paul@25 | 387 | pcb_back_support_bump_depth, |
paul@26 | 388 | bump_height, |
paul@25 | 389 | 0, -1, 1, |
paul@25 | 390 | 0, |
paul@25 | 391 | -pcb_back_support_depth / 2, |
paul@26 | 392 | -pcb_back_support_height / 2 + bump_offset); |
paul@27 | 393 | |
paul@27 | 394 | /* Top bump. */ |
paul@27 | 395 | |
paul@27 | 396 | cube_at(pcb_back_support_bump_width, |
paul@27 | 397 | pcb_back_support_bump_depth, |
paul@27 | 398 | pcb_back_support_top_bump_height, |
paul@27 | 399 | 0, -1, 1, |
paul@27 | 400 | 0, |
paul@27 | 401 | -pcb_back_support_depth / 2, |
paul@27 | 402 | pcb_back_support_height / 2 - |
paul@27 | 403 | pcb_back_support_top_bump_height); |
paul@25 | 404 | } |
paul@25 | 405 | } |
paul@25 | 406 | |
paul@25 | 407 | module pcb_lug(xdir) { |
paul@25 | 408 | translate([xdir * |
paul@50 | 409 | (int_connector_width / 2 - pcb_lug_offset_from_inside), |
paul@25 | 410 | back_depth, |
paul@45 | 411 | int_payload_lower_extent + pcb_lug_offset_from_bottom |
paul@25 | 412 | ]) |
paul@25 | 413 | rotate([90, 0, 0]) |
paul@25 | 414 | difference() { |
paul@25 | 415 | union() { |
paul@25 | 416 | cylinder(h=pcb_lug_depth, r=pcb_lug_outer_radius); |
paul@25 | 417 | cube_at(pcb_lug_cross_width, |
paul@25 | 418 | pcb_lug_cross_height, pcb_lug_cross_depth, |
paul@25 | 419 | 0, 0, 1, |
paul@25 | 420 | 0, 0, 0); |
paul@25 | 421 | cube_at(pcb_lug_cross_height, |
paul@25 | 422 | pcb_lug_cross_width, pcb_lug_cross_depth, |
paul@25 | 423 | 0, 0, 1, |
paul@25 | 424 | 0, 0, 0); |
paul@25 | 425 | } |
paul@25 | 426 | cylinder(h=pcb_lug_depth, r=pcb_lug_inner_radius); |
paul@47 | 427 | translate([0, 0, pcb_lug_depth - pcb_lug_ro]) |
paul@47 | 428 | fillet_torus(pcb_lug_outer_radius, pcb_lug_rr); |
paul@25 | 429 | } |
paul@25 | 430 | } |
paul@25 | 431 | |
paul@33 | 432 | module pcb_front_lug(xdir) { |
paul@33 | 433 | translate([xdir * |
paul@50 | 434 | (int_connector_width / 2 - pcb_lug_offset_from_inside), |
paul@39 | 435 | -int_front_depth + pcb_front_lug_depth, |
paul@45 | 436 | int_payload_lower_extent + pcb_lug_offset_from_bottom |
paul@33 | 437 | ]) |
paul@33 | 438 | rotate([90, 0, 0]) |
paul@33 | 439 | difference() { |
paul@33 | 440 | cylinder(h=pcb_front_lug_depth, |
paul@33 | 441 | r=pcb_front_lug_outer_radius); |
paul@33 | 442 | cylinder(h=pcb_front_lug_depth, |
paul@33 | 443 | r=pcb_front_lug_inner_radius); |
paul@33 | 444 | } |
paul@33 | 445 | } |
paul@33 | 446 | |
paul@25 | 447 | /* The actual shapes. */ |
paul@25 | 448 | |
paul@51 | 449 | front_displacement = APART ? -connector_width * 0.6 : 0; |
paul@43 | 450 | |
paul@43 | 451 | if (FRONT) |
paul@43 | 452 | translate([front_displacement, 0, 0]) |
paul@43 | 453 | difference() { |
paul@1 | 454 | |
paul@43 | 455 | /* The cartridge surfaces. */ |
paul@1 | 456 | |
paul@43 | 457 | union() { |
paul@8 | 458 | |
paul@43 | 459 | /* Front portion. */ |
paul@8 | 460 | |
paul@43 | 461 | if (FRONT_SURFACE) { |
paul@50 | 462 | |
paul@50 | 463 | /* Surfaces surrounding the payload. */ |
paul@50 | 464 | |
paul@50 | 465 | cube_at(payload_width, front, payload_height, |
paul@50 | 466 | 0, -1, 1, |
paul@51 | 467 | payload_centre, -int_front_depth, int_payload_lower_extent); |
paul@50 | 468 | |
paul@50 | 469 | cube_at(front_left, front_depth, payload_height, |
paul@50 | 470 | -1, -1, 1, |
paul@51 | 471 | int_payload_left_extent, 0, int_payload_lower_extent); |
paul@50 | 472 | |
paul@50 | 473 | cube_at(front_right, front_depth, payload_height, |
paul@50 | 474 | 1, -1, 1, |
paul@51 | 475 | int_payload_right_extent, 0, int_payload_lower_extent); |
paul@50 | 476 | |
paul@50 | 477 | /* Surfaces surrounding the connector. */ |
paul@50 | 478 | |
paul@50 | 479 | cube_at(connector_width, front, connector_height, |
paul@50 | 480 | 0, -1, -1, |
paul@50 | 481 | 0, -int_front_depth, int_payload_lower_extent); |
paul@50 | 482 | |
paul@50 | 483 | cube_at(front_left, front_depth, connector_height, |
paul@50 | 484 | -1, -1, -1, |
paul@50 | 485 | -int_connector_width / 2, 0, int_payload_lower_extent); |
paul@50 | 486 | |
paul@50 | 487 | cube_at(front_right, front_depth, connector_height, |
paul@50 | 488 | 1, -1, -1, |
paul@50 | 489 | int_connector_width / 2, 0, int_payload_lower_extent); |
paul@50 | 490 | |
paul@50 | 491 | /* Top surface for the front piece. */ |
paul@50 | 492 | |
paul@50 | 493 | cube_at(payload_width, front_depth, top, |
paul@43 | 494 | 0, -1, 1, |
paul@51 | 495 | payload_centre, 0, int_payload_upper_extent); |
paul@43 | 496 | } |
paul@20 | 497 | |
paul@43 | 498 | difference() { |
paul@43 | 499 | |
paul@43 | 500 | /* Floor of cartridge. */ |
paul@43 | 501 | |
paul@50 | 502 | cube_at(int_connector_width, int_front_depth, bottom, |
paul@43 | 503 | 0, -1, 1, |
paul@43 | 504 | 0, 0, -height / 2 + int_connector_height); |
paul@43 | 505 | |
paul@43 | 506 | /* Left cutout. */ |
paul@20 | 507 | |
paul@43 | 508 | cube_at(edge_connector_cutout_front_width, |
paul@43 | 509 | edge_connector_cutout_front_depth, |
paul@43 | 510 | bottom, |
paul@43 | 511 | 1, -1, 1, |
paul@50 | 512 | -int_connector_width / 2, |
paul@43 | 513 | 0, |
paul@43 | 514 | -height / 2 + int_connector_height); |
paul@43 | 515 | |
paul@43 | 516 | /* Right cutout. */ |
paul@20 | 517 | |
paul@43 | 518 | cube_at(edge_connector_cutout_front_width, |
paul@43 | 519 | edge_connector_cutout_front_depth, |
paul@43 | 520 | bottom, |
paul@43 | 521 | -1, -1, 1, |
paul@50 | 522 | int_connector_width / 2, |
paul@43 | 523 | 0, |
paul@43 | 524 | -height / 2 + int_connector_height); |
paul@43 | 525 | } |
paul@43 | 526 | |
paul@52 | 527 | /* Extended floor. */ |
paul@52 | 528 | |
paul@52 | 529 | if (payload_width > connector_width) { |
paul@52 | 530 | |
paul@52 | 531 | cube_at(payload_width - connector_width, front_depth, bottom, |
paul@52 | 532 | 1, -1, 1, |
paul@52 | 533 | payload_left_extent, 0, -height / 2 + int_connector_height); |
paul@52 | 534 | } |
paul@52 | 535 | |
paul@43 | 536 | /* PCB supports. */ |
paul@20 | 537 | |
paul@43 | 538 | cube_at(pcb_front_support_width, |
paul@43 | 539 | pcb_front_support_depth, |
paul@43 | 540 | pcb_front_support_height, |
paul@44 | 541 | -1, -1, 1, |
paul@44 | 542 | -pcb_support_offset_from_centre, |
paul@43 | 543 | 0, |
paul@45 | 544 | int_payload_lower_extent); |
paul@20 | 545 | |
paul@43 | 546 | cube_at(pcb_front_support_width, |
paul@43 | 547 | pcb_front_support_depth, |
paul@43 | 548 | pcb_front_support_height, |
paul@44 | 549 | 1, -1, 1, |
paul@44 | 550 | pcb_support_offset_from_centre, |
paul@43 | 551 | 0, |
paul@45 | 552 | int_payload_lower_extent); |
paul@20 | 553 | |
paul@43 | 554 | /* Circular "lugs" to hold PCBs in place. */ |
paul@43 | 555 | |
paul@43 | 556 | pcb_front_lug(-1); |
paul@43 | 557 | pcb_front_lug(1); |
paul@8 | 558 | } |
paul@15 | 559 | |
paul@43 | 560 | /* Label insets. */ |
paul@43 | 561 | |
paul@43 | 562 | union() { |
paul@43 | 563 | |
paul@43 | 564 | /* Front label. */ |
paul@15 | 565 | |
paul@43 | 566 | if (FRONT_LABEL_INSET) |
paul@51 | 567 | translate([front_label_left_extent, -front_depth, |
paul@43 | 568 | front_label_offset_from_bottom - height / 2]) |
paul@43 | 569 | cube([front_label_width, front_label_depth, |
paul@43 | 570 | front_label_height]); |
paul@33 | 571 | |
paul@43 | 572 | /* Top label. See also the back piece. */ |
paul@10 | 573 | |
paul@43 | 574 | if (TOP_LABEL_INSET) |
paul@51 | 575 | translate([top_label_left_extent, |
paul@43 | 576 | -front_depth + top_label_offset_from_front, |
paul@43 | 577 | height / 2 - top_label_depth]) |
paul@43 | 578 | cube([top_label_width, top_label_height, |
paul@43 | 579 | top_label_depth]); |
paul@43 | 580 | } |
paul@10 | 581 | |
paul@43 | 582 | /* Inner front edge cavity. */ |
paul@10 | 583 | |
paul@43 | 584 | translate([inner_front_edge_width / 2, -int_front_depth, -height / 2]) |
paul@43 | 585 | rotate([0, -90, 0]) |
paul@43 | 586 | linear_extrude(height = inner_front_edge_width) |
paul@43 | 587 | polygon([ |
paul@43 | 588 | [-extra, -inner_front_edge_depth], |
paul@43 | 589 | [0, -inner_front_edge_depth], |
paul@43 | 590 | [inner_front_edge_height, 0], |
paul@43 | 591 | [-extra, 0], |
paul@43 | 592 | ]); |
paul@10 | 593 | |
paul@43 | 594 | /* Inner top cutout for the top and sides of the back portion. */ |
paul@10 | 595 | |
paul@43 | 596 | cube_at(inner_top_front_cutout_width, |
paul@43 | 597 | inner_top_front_cutout_depth, |
paul@43 | 598 | inner_top_front_cutout_height, |
paul@51 | 599 | 1, -1, 1, |
paul@51 | 600 | int_payload_left_extent, 0, int_payload_upper_extent); |
paul@11 | 601 | |
paul@50 | 602 | cube_at(inner_payload_front_cutout_width, |
paul@50 | 603 | inner_payload_front_cutout_depth, |
paul@50 | 604 | inner_payload_front_cutout_height, |
paul@50 | 605 | 1, -1, 1, |
paul@51 | 606 | int_payload_right_extent, 0, int_payload_lower_extent); |
paul@50 | 607 | |
paul@50 | 608 | cube_at(inner_payload_front_cutout_width, |
paul@50 | 609 | inner_payload_front_cutout_depth, |
paul@50 | 610 | inner_payload_front_cutout_height, |
paul@50 | 611 | -1, -1, 1, |
paul@51 | 612 | int_payload_left_extent, 0, int_payload_lower_extent); |
paul@11 | 613 | |
paul@50 | 614 | cube_at(inner_connector_front_cutout_width, |
paul@50 | 615 | inner_connector_front_cutout_depth, |
paul@50 | 616 | inner_connector_front_cutout_height, |
paul@50 | 617 | 1, -1, -1, |
paul@50 | 618 | int_connector_width / 2, 0, int_payload_lower_extent); |
paul@50 | 619 | |
paul@50 | 620 | cube_at(inner_connector_front_cutout_width, |
paul@50 | 621 | inner_connector_front_cutout_depth, |
paul@50 | 622 | inner_connector_front_cutout_height, |
paul@50 | 623 | -1, -1, -1, |
paul@50 | 624 | -int_connector_width / 2, 0, int_payload_lower_extent); |
paul@28 | 625 | |
paul@43 | 626 | /* Fillets to round off the edges. */ |
paul@43 | 627 | |
paul@43 | 628 | union() { |
paul@28 | 629 | |
paul@43 | 630 | /* Top left and right rounding. */ |
paul@43 | 631 | |
paul@51 | 632 | translate([payload_left_extent + ro, -front_depth / 2, height / 2 - ro]) |
paul@43 | 633 | rotate([0, 0, 180]) |
paul@43 | 634 | rotate([90, 0, 0]) |
paul@43 | 635 | fillet(rr, front_depth); |
paul@51 | 636 | translate([payload_right_extent - ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 637 | rotate([90, 0, 0]) |
paul@10 | 638 | fillet(rr, front_depth); |
paul@10 | 639 | |
paul@43 | 640 | /* Top front rounding. */ |
paul@43 | 641 | |
paul@51 | 642 | translate([payload_centre, -front_depth + ro, height / 2 - ro]) |
paul@43 | 643 | rotate([0, 0, 180]) |
paul@43 | 644 | rotate([0, -90, 0]) |
paul@50 | 645 | fillet(rr, payload_width); |
paul@10 | 646 | |
paul@43 | 647 | /* Edge rounding. */ |
paul@43 | 648 | |
paul@52 | 649 | translate([payload_right_extent - ro, -front_depth + ro, int_payload_lower_extent - bottom - extra]) |
paul@52 | 650 | rotate([0, 0, 270]) |
paul@52 | 651 | fillet_justified(rr, payload_height + bottom + extra); |
paul@52 | 652 | |
paul@52 | 653 | translate([payload_left_extent + ro, -front_depth + ro, int_payload_lower_extent - bottom - extra]) |
paul@43 | 654 | rotate([0, 0, 180]) |
paul@52 | 655 | fillet_justified(rr, payload_height + bottom + extra); |
paul@52 | 656 | |
paul@52 | 657 | translate([connector_width / 2 - ro, -front_depth + ro, -height / 2]) |
paul@43 | 658 | rotate([0, 0, 270]) |
paul@52 | 659 | fillet_partitioned(rr, connector_height - bottom); |
paul@52 | 660 | |
paul@52 | 661 | translate([-connector_width / 2 + ro, -front_depth + ro, -height / 2]) |
paul@52 | 662 | rotate([0, 0, 180]) |
paul@52 | 663 | fillet_partitioned(rr, connector_height - bottom); |
paul@43 | 664 | } |
paul@10 | 665 | } |
paul@10 | 666 | |
paul@41 | 667 | /* |
paul@41 | 668 | Place the back piece next to the front, with the internals facing out |
paul@43 | 669 | the same way, if APART is defined. |
paul@41 | 670 | */ |
paul@41 | 671 | |
paul@51 | 672 | back_displacement = APART ? connector_width * 0.6 : 0; |
paul@43 | 673 | back_rotation = APART ? 180 : 0; |
paul@43 | 674 | |
paul@43 | 675 | if (BACK) |
paul@43 | 676 | translate([back_displacement, 0, 0]) |
paul@43 | 677 | rotate([0, 0, back_rotation]) |
paul@43 | 678 | difference() { |
paul@43 | 679 | |
paul@43 | 680 | /* The cartridge surfaces. */ |
paul@43 | 681 | |
paul@43 | 682 | union() { |
paul@43 | 683 | |
paul@43 | 684 | /* Back portion. */ |
paul@10 | 685 | |
paul@43 | 686 | if (BACK_SURFACE) { |
paul@49 | 687 | |
paul@50 | 688 | /* Surfaces surrounding the payload. */ |
paul@50 | 689 | |
paul@49 | 690 | /* Payload section of back surface. */ |
paul@49 | 691 | |
paul@50 | 692 | cube_at(payload_width, payload_back, payload_height, |
paul@49 | 693 | 0, 1, 1, |
paul@51 | 694 | payload_centre, int_payload_back_depth, int_payload_lower_extent); |
paul@49 | 695 | |
paul@50 | 696 | cube_at(back_left, back_depth, payload_height, |
paul@50 | 697 | -1, 1, 1, |
paul@51 | 698 | int_payload_left_extent, 0, int_payload_lower_extent); |
paul@50 | 699 | |
paul@50 | 700 | cube_at(back_right, back_depth, payload_height, |
paul@50 | 701 | 1, 1, 1, |
paul@51 | 702 | int_payload_right_extent, 0, int_payload_lower_extent); |
paul@50 | 703 | |
paul@50 | 704 | /* Surfaces surrounding the connector. */ |
paul@50 | 705 | |
paul@49 | 706 | /* Connector section of back surface overlapping the floor. */ |
paul@49 | 707 | |
paul@50 | 708 | cube_at(connector_width, connector_back, connector_height, |
paul@50 | 709 | 0, 1, -1, |
paul@50 | 710 | 0, int_connector_back_depth, int_payload_lower_extent); |
paul@46 | 711 | |
paul@50 | 712 | cube_at(back_left, back_depth, connector_height, |
paul@50 | 713 | -1, 1, -1, |
paul@50 | 714 | -int_connector_width / 2, 0, int_payload_lower_extent); |
paul@46 | 715 | |
paul@50 | 716 | cube_at(back_right, back_depth, connector_height, |
paul@50 | 717 | 1, 1, -1, |
paul@50 | 718 | int_connector_width / 2, 0, int_payload_lower_extent); |
paul@46 | 719 | |
paul@49 | 720 | /* Top of back piece. */ |
paul@49 | 721 | |
paul@50 | 722 | cube_at(payload_width, back_depth, top, |
paul@43 | 723 | 0, 1, 1, |
paul@51 | 724 | payload_centre, 0, int_payload_upper_extent); |
paul@46 | 725 | |
paul@50 | 726 | /* |
paul@50 | 727 | The extension of the back to connect with the front. Here, the inside |
paul@50 | 728 | edges are rounded. The outside edges are rounded later. |
paul@50 | 729 | |
paul@50 | 730 | An extra overlapping measure is employed so that the filleting is |
paul@50 | 731 | continuous between the payload and connector portions. On the inside |
paul@50 | 732 | edges, the connector filleting is extended upwards. |
paul@50 | 733 | */ |
paul@50 | 734 | |
paul@50 | 735 | /* Left side of payload. */ |
paul@46 | 736 | |
paul@46 | 737 | difference() { |
paul@50 | 738 | cube_at(back_left - groove_depth, groove_width_extra, inner_payload_front_cutout_height, |
paul@46 | 739 | -1, 1, 1, |
paul@51 | 740 | int_payload_left_extent, -groove_width_extra, int_payload_lower_extent); |
paul@51 | 741 | translate([int_payload_left_extent - groove_ro, -groove_width_extra + groove_ro, |
paul@50 | 742 | int_payload_lower_extent]) |
paul@46 | 743 | rotate([0, 0, -90]) |
paul@50 | 744 | fillet_justified(groove_rr, inner_payload_front_cutout_height); |
paul@46 | 745 | } |
paul@46 | 746 | |
paul@50 | 747 | /* Right side of payload. */ |
paul@50 | 748 | |
paul@46 | 749 | difference() { |
paul@50 | 750 | cube_at(back_right - groove_depth, groove_width_extra, inner_payload_front_cutout_height, |
paul@46 | 751 | 1, 1, 1, |
paul@51 | 752 | int_payload_right_extent, -groove_width_extra, int_payload_lower_extent); |
paul@51 | 753 | translate([int_payload_right_extent + groove_ro, -groove_width_extra + groove_ro, |
paul@50 | 754 | int_payload_lower_extent]) |
paul@50 | 755 | rotate([0, 0, 180]) |
paul@50 | 756 | fillet_justified(groove_rr, inner_payload_front_cutout_height); |
paul@50 | 757 | } |
paul@50 | 758 | |
paul@50 | 759 | /* Left side of connector. */ |
paul@50 | 760 | |
paul@50 | 761 | difference() { |
paul@50 | 762 | cube_at(back_left - groove_depth, groove_width_extra, inner_connector_front_cutout_height, |
paul@50 | 763 | -1, 1, -1, |
paul@50 | 764 | -int_connector_width / 2, -groove_width_extra, int_payload_lower_extent); |
paul@50 | 765 | translate([-int_connector_width / 2 - groove_ro, -groove_width_extra + groove_ro, |
paul@50 | 766 | -height / 2]) |
paul@50 | 767 | rotate([0, 0, -90]) |
paul@50 | 768 | fillet_partitioned(groove_rr, inner_connector_front_cutout_height + extra); |
paul@50 | 769 | } |
paul@50 | 770 | |
paul@50 | 771 | /* Right side of connector. */ |
paul@50 | 772 | |
paul@50 | 773 | difference() { |
paul@50 | 774 | cube_at(back_right - groove_depth, groove_width_extra, inner_connector_front_cutout_height, |
paul@50 | 775 | 1, 1, -1, |
paul@50 | 776 | int_connector_width / 2, -groove_width_extra, int_payload_lower_extent); |
paul@50 | 777 | translate([int_connector_width / 2 + groove_ro, -groove_width_extra + groove_ro, |
paul@46 | 778 | -height / 2]) |
paul@46 | 779 | rotate([0, 0, 180]) |
paul@50 | 780 | fillet_partitioned(groove_rr, inner_connector_front_cutout_height + extra); |
paul@46 | 781 | } |
paul@46 | 782 | |
paul@50 | 783 | /* Top side. */ |
paul@50 | 784 | |
paul@46 | 785 | difference() { |
paul@50 | 786 | cube_at(payload_width - groove_depth * 2, groove_width_extra, top - top_groove_depth, |
paul@46 | 787 | 0, 1, 1, |
paul@51 | 788 | payload_centre, -groove_width_extra, int_payload_upper_extent); |
paul@51 | 789 | translate([payload_centre, -groove_width_extra + groove_ro, |
paul@46 | 790 | int_payload_upper_extent + groove_ro]) |
paul@46 | 791 | rotate([0, 0, 180]) |
paul@46 | 792 | rotate([0, 90, 0]) |
paul@50 | 793 | fillet(groove_rr, payload_width - groove_depth * 2); |
paul@46 | 794 | } |
paul@43 | 795 | } |
paul@10 | 796 | |
paul@43 | 797 | difference() { |
paul@8 | 798 | |
paul@43 | 799 | /* Floor of cartridge. */ |
paul@8 | 800 | |
paul@50 | 801 | cube_at(int_connector_width, int_connector_back_depth, bottom, |
paul@43 | 802 | 0, 1, 1, |
paul@43 | 803 | 0, 0, -height / 2 + int_connector_height); |
paul@43 | 804 | |
paul@43 | 805 | /* Edge connector cutout. */ |
paul@43 | 806 | |
paul@43 | 807 | cube_at(edge_connector_cutout_back_width, |
paul@43 | 808 | edge_connector_cutout_back_depth, |
paul@43 | 809 | bottom, |
paul@43 | 810 | 0, 1, 1, |
paul@43 | 811 | 0, 0, -height / 2 + int_connector_height); |
paul@43 | 812 | } |
paul@43 | 813 | |
paul@52 | 814 | /* Extended floor. */ |
paul@52 | 815 | |
paul@52 | 816 | if (payload_width > connector_width) { |
paul@52 | 817 | |
paul@52 | 818 | difference() { |
paul@52 | 819 | |
paul@52 | 820 | cube_at(payload_width - connector_width, back_depth, bottom, |
paul@52 | 821 | 1, 1, 1, |
paul@52 | 822 | payload_left_extent, 0, -height / 2 + int_connector_height); |
paul@52 | 823 | |
paul@52 | 824 | cube_at(payload_width - connector_width, edge_connector_cutout_front_depth, bottom, |
paul@52 | 825 | 1, 1, 1, |
paul@52 | 826 | payload_left_extent, 0, -height / 2 + int_connector_height); |
paul@52 | 827 | } |
paul@52 | 828 | } |
paul@52 | 829 | |
paul@43 | 830 | /* PCB supports. */ |
paul@42 | 831 | |
paul@43 | 832 | pcb_support(-1, pcb_back_support_left_bump_height, |
paul@43 | 833 | pcb_back_support_left_bump_offset_from_bottom); |
paul@43 | 834 | pcb_support(1, pcb_back_support_right_bump_height, |
paul@43 | 835 | pcb_back_support_right_bump_offset_from_bottom); |
paul@20 | 836 | |
paul@43 | 837 | /* Circular "lugs" to hold PCBs in place. */ |
paul@43 | 838 | |
paul@43 | 839 | pcb_lug(-1); |
paul@43 | 840 | pcb_lug(1); |
paul@43 | 841 | } |
paul@20 | 842 | |
paul@43 | 843 | /* Label insets. */ |
paul@43 | 844 | |
paul@43 | 845 | union() { |
paul@43 | 846 | |
paul@43 | 847 | /* Top label. See also the front piece. */ |
paul@20 | 848 | |
paul@43 | 849 | if (TOP_LABEL_INSET) |
paul@51 | 850 | translate([top_label_left_extent, |
paul@43 | 851 | -front_depth + top_label_offset_from_front, |
paul@43 | 852 | height / 2 - top_label_depth]) |
paul@43 | 853 | cube([top_label_width, top_label_height, |
paul@43 | 854 | top_label_depth]); |
paul@8 | 855 | } |
paul@14 | 856 | |
paul@43 | 857 | /* Top and side grooves, positioned in the back portion. */ |
paul@25 | 858 | |
paul@43 | 859 | union() { |
paul@0 | 860 | |
paul@43 | 861 | /* Left groove. */ |
paul@1 | 862 | |
paul@46 | 863 | cube_at(groove_depth, groove_width_normal, height, |
paul@43 | 864 | 1, 1, 0, |
paul@51 | 865 | payload_left_extent, 0, 0); |
paul@2 | 866 | |
paul@43 | 867 | /* Right groove. */ |
paul@2 | 868 | |
paul@46 | 869 | cube_at(groove_depth, groove_width_normal, height, |
paul@43 | 870 | -1, 1, 0, |
paul@51 | 871 | payload_right_extent, 0, 0); |
paul@8 | 872 | |
paul@43 | 873 | /* Top grooves. */ |
paul@4 | 874 | |
paul@50 | 875 | cube_at(payload_width, groove_width_normal, groove_depth, |
paul@43 | 876 | 0, 1, -1, |
paul@51 | 877 | payload_centre, 0, height / 2); |
paul@4 | 878 | |
paul@50 | 879 | cube_at(payload_width, top_groove_width, top_groove_depth, |
paul@43 | 880 | 0, 1, -1, |
paul@51 | 881 | payload_centre, -groove_width_extra, height / 2); |
paul@41 | 882 | } |
paul@2 | 883 | |
paul@43 | 884 | /* Back cavity. */ |
paul@43 | 885 | |
paul@43 | 886 | if (BACK_CAVITY) |
paul@43 | 887 | intersection() { |
paul@43 | 888 | |
paul@43 | 889 | /* From the bottom upwards. */ |
paul@5 | 890 | |
paul@43 | 891 | translate([0, back_depth, -height / 2]) |
paul@43 | 892 | linear_extrude(height = back_cavity_height) |
paul@50 | 893 | translate([-int_connector_width / 2, 0, 0]) |
paul@43 | 894 | polygon([ |
paul@43 | 895 | [back_cavity_offset_from_inner_left, 0], |
paul@43 | 896 | [back_cavity_inner_offset_from_inner_left, |
paul@43 | 897 | -back_cavity_depth], |
paul@43 | 898 | [back_cavity_inner_offset_from_inner_left + |
paul@43 | 899 | back_cavity_inner_width, |
paul@43 | 900 | -back_cavity_depth], |
paul@43 | 901 | [back_cavity_offset_from_inner_left + |
paul@43 | 902 | back_cavity_width, 0] |
paul@43 | 903 | ]); |
paul@43 | 904 | |
paul@43 | 905 | /* From left to right. */ |
paul@43 | 906 | |
paul@43 | 907 | translate([back_cavity_width / 2, back_depth, -height / 2]) |
paul@43 | 908 | rotate([0, -90, 0]) |
paul@43 | 909 | linear_extrude(height = back_cavity_width) |
paul@43 | 910 | polygon([ |
paul@43 | 911 | [-extra, -back_cavity_depth], |
paul@43 | 912 | [back_cavity_inner_height, |
paul@43 | 913 | -back_cavity_depth], |
paul@43 | 914 | [back_cavity_height, 0], |
paul@43 | 915 | [-extra, 0] |
paul@43 | 916 | ]); |
paul@43 | 917 | } |
paul@43 | 918 | |
paul@43 | 919 | /* Inner back cavities. */ |
paul@5 | 920 | |
paul@49 | 921 | translate([0, int_connector_back_depth, -height / 2]) |
paul@43 | 922 | linear_extrude(height = int_connector_height) |
paul@50 | 923 | translate([-int_connector_width / 2, 0, 0]) |
paul@43 | 924 | polygon([ |
paul@43 | 925 | [0, 0], |
paul@43 | 926 | [inner_back_slope_max_offset, 0], |
paul@43 | 927 | [inner_back_slope_min_offset, |
paul@43 | 928 | inner_back_slope_depth], |
paul@43 | 929 | [0, inner_back_slope_depth] |
paul@43 | 930 | ]); |
paul@5 | 931 | |
paul@49 | 932 | translate([0, int_connector_back_depth, -height / 2]) |
paul@43 | 933 | linear_extrude(height = int_connector_height) |
paul@50 | 934 | translate([int_connector_width / 2, 0, 0]) |
paul@43 | 935 | polygon([ |
paul@43 | 936 | [0, 0], |
paul@43 | 937 | [-inner_back_slope_max_offset, 0], |
paul@43 | 938 | [-inner_back_slope_min_offset, |
paul@43 | 939 | inner_back_slope_depth], |
paul@43 | 940 | [0, inner_back_slope_depth] |
paul@43 | 941 | ]); |
paul@7 | 942 | |
paul@43 | 943 | /* Inner back edge cavity. */ |
paul@5 | 944 | |
paul@43 | 945 | translate([inner_back_edge_width / 2, |
paul@49 | 946 | int_connector_back_depth + inner_back_edge_depth, -height / 2]) |
paul@43 | 947 | rotate([0, -90, 0]) |
paul@43 | 948 | linear_extrude(height = inner_back_edge_width) |
paul@43 | 949 | polygon([ |
paul@43 | 950 | [-extra, -inner_back_edge_depth], |
paul@43 | 951 | [inner_back_edge_height, -inner_back_edge_depth], |
paul@43 | 952 | [0, 0], |
paul@43 | 953 | [-extra, 0] |
paul@43 | 954 | ]); |
paul@0 | 955 | |
paul@43 | 956 | /* Fillets to round off the edges. */ |
paul@43 | 957 | |
paul@43 | 958 | union() { |
paul@43 | 959 | |
paul@43 | 960 | /* Top left and right rounding. */ |
paul@43 | 961 | |
paul@51 | 962 | translate([payload_left_extent + ro, back_depth / 2, height / 2 - ro]) |
paul@43 | 963 | rotate([0, 0, 180]) |
paul@43 | 964 | rotate([90, 0, 0]) |
paul@43 | 965 | fillet(rr, back_depth); |
paul@51 | 966 | translate([payload_right_extent - ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 967 | rotate([90, 0, 0]) |
paul@9 | 968 | fillet(rr, back_depth); |
paul@43 | 969 | |
paul@43 | 970 | /* Top back rounding. */ |
paul@43 | 971 | |
paul@51 | 972 | translate([payload_centre, back_depth - ro, height / 2 - ro]) |
paul@43 | 973 | rotate([0, -90, 0]) |
paul@50 | 974 | fillet(rr, payload_width); |
paul@43 | 975 | |
paul@50 | 976 | /* Outer edge rounding. */ |
paul@43 | 977 | |
paul@52 | 978 | translate([payload_right_extent - ro, back_depth - ro, int_payload_lower_extent - bottom - extra]) |
paul@52 | 979 | fillet_justified(rr, payload_height + bottom + extra); |
paul@50 | 980 | |
paul@52 | 981 | translate([payload_left_extent + ro, back_depth - ro, int_payload_lower_extent - bottom - extra]) |
paul@50 | 982 | rotate([0, 0, 90]) |
paul@52 | 983 | fillet_justified(rr, payload_height + bottom + extra); |
paul@50 | 984 | |
paul@50 | 985 | translate([connector_width / 2 - ro, back_depth - ro, -height / 2]) |
paul@52 | 986 | fillet_partitioned(rr, connector_height - bottom); |
paul@50 | 987 | |
paul@50 | 988 | translate([-connector_width / 2 + ro, back_depth - ro, -height / 2]) |
paul@43 | 989 | rotate([0, 0, 90]) |
paul@52 | 990 | fillet_partitioned(rr, connector_height - bottom); |
paul@50 | 991 | |
paul@50 | 992 | /* |
paul@50 | 993 | Outer edge rounding of the back extension. This is done as a |
paul@50 | 994 | separate removal operation rather than occurring when creating the |
paul@50 | 995 | extension in order to ensure that the edges are actually rounded. |
paul@50 | 996 | |
paul@50 | 997 | An extra overlapping measure is employed so that the filleting is |
paul@50 | 998 | continuous between the payload and connector portions. On the outside |
paul@50 | 999 | edges, the payload filleting is extended downwards. |
paul@50 | 1000 | */ |
paul@46 | 1001 | |
paul@51 | 1002 | translate([payload_left_extent + groove_depth + groove_ro, -groove_width_extra + groove_ro, |
paul@50 | 1003 | int_payload_lower_extent - extra]) |
paul@50 | 1004 | rotate([0, 0, 180]) |
paul@50 | 1005 | fillet_justified(groove_rr, inner_payload_front_cutout_height + extra); |
paul@46 | 1006 | |
paul@51 | 1007 | translate([payload_right_extent - groove_depth - groove_ro, -groove_width_extra + groove_ro, |
paul@50 | 1008 | int_payload_lower_extent - extra]) |
paul@50 | 1009 | rotate([0, 0, -90]) |
paul@50 | 1010 | fillet_justified(groove_rr, inner_payload_front_cutout_height + extra); |
paul@50 | 1011 | |
paul@50 | 1012 | /* Sides of connector. */ |
paul@50 | 1013 | |
paul@50 | 1014 | translate([-connector_width / 2 + groove_depth + groove_ro, -groove_width_extra + groove_ro, |
paul@46 | 1015 | -height / 2]) |
paul@46 | 1016 | rotate([0, 0, 180]) |
paul@50 | 1017 | fillet_partitioned(groove_rr, inner_connector_front_cutout_height); |
paul@46 | 1018 | |
paul@50 | 1019 | translate([connector_width / 2 - groove_depth - groove_ro, -groove_width_extra + groove_ro, |
paul@46 | 1020 | -height / 2]) |
paul@46 | 1021 | rotate([0, 0, -90]) |
paul@50 | 1022 | fillet_partitioned(groove_rr, inner_connector_front_cutout_height); |
paul@50 | 1023 | |
paul@50 | 1024 | /* Top of payload. */ |
paul@46 | 1025 | |
paul@51 | 1026 | translate([payload_centre, -groove_width_extra + groove_ro, |
paul@46 | 1027 | int_payload_upper_extent + inner_top_front_cutout_height - groove_ro]) |
paul@46 | 1028 | rotate([0, 0, 180]) |
paul@46 | 1029 | rotate([0, -90, 0]) |
paul@50 | 1030 | fillet(groove_rr, payload_width - groove_depth * 2); |
paul@43 | 1031 | } |
paul@0 | 1032 | } |
paul@45 | 1033 | |
paul@45 | 1034 | /* PCB for checking. */ |
paul@45 | 1035 | |
paul@45 | 1036 | pcb_width = 84.85; pcb_height = 62.5; pcb_depth = 1; |
paul@45 | 1037 | edge_connector_width = 56.5; edge_connector_height = 11.85; |
paul@45 | 1038 | pcb_position_y = int_payload_lower_extent; |
paul@45 | 1039 | |
paul@45 | 1040 | pcb_left_hole_offset = pcb_back_support_left_bump_offset_from_bottom |
paul@45 | 1041 | + 0.55; |
paul@45 | 1042 | pcb_left_hole_width = 2.2; |
paul@45 | 1043 | pcb_left_hole_height = pcb_back_support_left_bump_height - 0.55 * 2; |
paul@45 | 1044 | pcb_left_hole_offset_from_centre = pcb_support_offset_from_centre + |
paul@45 | 1045 | pcb_back_support_width / 2 - pcb_left_hole_width / 2; |
paul@45 | 1046 | |
paul@45 | 1047 | pcb_right_hole_offset = pcb_back_support_right_bump_offset_from_bottom |
paul@45 | 1048 | + 0.55; |
paul@45 | 1049 | pcb_right_hole_width = pcb_left_hole_width; |
paul@45 | 1050 | pcb_right_hole_height = pcb_back_support_right_bump_height - 0.55 * 2; |
paul@45 | 1051 | pcb_right_hole_offset_from_centre = -pcb_left_hole_offset_from_centre; |
paul@45 | 1052 | |
paul@45 | 1053 | pcb_hole_depth = pcb_depth + 0.2; |
paul@45 | 1054 | pcb_hole_start_depth = -0.1; |
paul@45 | 1055 | pcb_lug_hole_radius = 3.75; |
paul@45 | 1056 | |
paul@45 | 1057 | if (PCB) |
paul@45 | 1058 | translate([back_displacement, 0, 0]) |
paul@45 | 1059 | translate([0, 0, pcb_position_y]) |
paul@45 | 1060 | difference() { |
paul@45 | 1061 | |
paul@45 | 1062 | /* Mock PCB. */ |
paul@45 | 1063 | |
paul@45 | 1064 | union() { |
paul@45 | 1065 | cube_at(pcb_width, pcb_depth, |
paul@45 | 1066 | pcb_height - edge_connector_height, |
paul@45 | 1067 | 0, 1, 1, |
paul@45 | 1068 | 0, 0, 0); |
paul@45 | 1069 | cube_at(edge_connector_width, pcb_depth, |
paul@45 | 1070 | edge_connector_height, |
paul@45 | 1071 | 0, 1, -1, |
paul@45 | 1072 | 0, 0, 0); |
paul@45 | 1073 | } |
paul@45 | 1074 | |
paul@45 | 1075 | /* Holes for mounting. */ |
paul@45 | 1076 | |
paul@45 | 1077 | union() { |
paul@45 | 1078 | cube_at(pcb_left_hole_width, 1, pcb_left_hole_height, |
paul@45 | 1079 | 1, 1, 1, |
paul@45 | 1080 | pcb_left_hole_offset_from_centre, 0, pcb_left_hole_offset); |
paul@45 | 1081 | translate([pcb_left_hole_offset_from_centre + |
paul@45 | 1082 | pcb_left_hole_width / 2, pcb_hole_start_depth, pcb_left_hole_offset]) |
paul@45 | 1083 | rotate([-90, 0, 0]) |
paul@45 | 1084 | cylinder(h=pcb_hole_depth, r=pcb_left_hole_width / 2); |
paul@45 | 1085 | translate([pcb_left_hole_offset_from_centre + |
paul@45 | 1086 | pcb_left_hole_width / 2, pcb_hole_start_depth, |
paul@45 | 1087 | pcb_left_hole_offset + pcb_left_hole_height]) |
paul@45 | 1088 | rotate([-90, 0, 0]) |
paul@45 | 1089 | cylinder(h=pcb_hole_depth, r=pcb_left_hole_width / 2); |
paul@45 | 1090 | } |
paul@45 | 1091 | |
paul@45 | 1092 | union() { |
paul@45 | 1093 | cube_at(pcb_right_hole_width, 1, pcb_right_hole_height, |
paul@45 | 1094 | -1, 1, 1, |
paul@45 | 1095 | pcb_right_hole_offset_from_centre, 0, pcb_right_hole_offset); |
paul@45 | 1096 | translate([pcb_right_hole_offset_from_centre - |
paul@45 | 1097 | pcb_right_hole_width / 2, pcb_hole_start_depth, pcb_right_hole_offset]) |
paul@45 | 1098 | rotate([-90, 0, 0]) |
paul@45 | 1099 | cylinder(h=pcb_hole_depth, r=pcb_right_hole_width / 2); |
paul@45 | 1100 | translate([pcb_right_hole_offset_from_centre - |
paul@45 | 1101 | pcb_right_hole_width / 2, pcb_hole_start_depth, |
paul@45 | 1102 | pcb_right_hole_offset + pcb_right_hole_height]) |
paul@45 | 1103 | rotate([-90, 0, 0]) |
paul@45 | 1104 | cylinder(h=pcb_hole_depth, r=pcb_right_hole_width / 2); |
paul@45 | 1105 | } |
paul@45 | 1106 | |
paul@45 | 1107 | /* Holes for lugs. */ |
paul@45 | 1108 | |
paul@45 | 1109 | translate([ |
paul@50 | 1110 | -int_connector_width / 2 + pcb_lug_offset_from_inside, |
paul@45 | 1111 | pcb_hole_start_depth, pcb_lug_offset_from_bottom]) |
paul@45 | 1112 | rotate([-90, 0, 0]) |
paul@45 | 1113 | cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius); |
paul@45 | 1114 | |
paul@45 | 1115 | translate([ |
paul@50 | 1116 | int_connector_width / 2 - pcb_lug_offset_from_inside, |
paul@45 | 1117 | pcb_hole_start_depth, pcb_lug_offset_from_bottom]) |
paul@45 | 1118 | rotate([-90, 0, 0]) |
paul@45 | 1119 | cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius); |
paul@45 | 1120 | } |
paul@0 | 1121 | } |
paul@0 | 1122 | |
paul@38 | 1123 | cartridge(); |