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@38 | 184 | /* Cartridge surfaces. */ |
paul@38 | 185 | |
paul@34 | 186 | front_side = side; |
paul@29 | 187 | front_left = front_side; |
paul@29 | 188 | front_right = front_side; |
paul@34 | 189 | back_side = side; |
paul@29 | 190 | back_left = back_side; |
paul@29 | 191 | back_right = back_side; |
paul@24 | 192 | |
paul@20 | 193 | /* Label details. */ |
paul@1 | 194 | |
paul@50 | 195 | front_label_width = payload_width - side - side - 3.0; |
paul@1 | 196 | front_label_height = 46.0; |
paul@1 | 197 | front_label_depth = 1.0; |
paul@1 | 198 | front_label_offset_from_bottom = 19.5; |
paul@3 | 199 | |
paul@1 | 200 | top_label_width = front_label_width; |
paul@20 | 201 | top_label_height = 11.5; /* the height as seen from above */ |
paul@1 | 202 | top_label_depth = front_label_depth; |
paul@1 | 203 | top_label_offset_from_front = 2.5; |
paul@3 | 204 | |
paul@41 | 205 | /* |
paul@41 | 206 | The groove around the sides and top. This is extended to allow the |
paul@41 | 207 | pieces to fit together, and this extension is generated regardless of |
paul@41 | 208 | whether the visible groove is enabled or not. |
paul@41 | 209 | */ |
paul@20 | 210 | |
paul@41 | 211 | groove_width_exposed = GROOVE ? 1.5 : 0; |
paul@46 | 212 | groove_width_normal = groove_width_exposed + front_back_overlap; |
paul@8 | 213 | groove_depth = 1.0; /* how deep the groove goes into each side */ |
paul@20 | 214 | |
paul@20 | 215 | /* Additional cutting to mate the back and front. */ |
paul@20 | 216 | |
paul@42 | 217 | top_groove_width = groove_width_overlap; |
paul@8 | 218 | top_groove_depth = 2.0; |
paul@20 | 219 | |
paul@29 | 220 | /* |
paul@29 | 221 | Space for the inner edge of the back inside the front. |
paul@29 | 222 | Offsets are measured from the outside surfaces. |
paul@29 | 223 | */ |
paul@20 | 224 | |
paul@50 | 225 | inner_top_front_cutout_width = int_payload_width; |
paul@30 | 226 | inner_top_front_cutout_depth = top_groove_width; |
paul@30 | 227 | inner_top_front_cutout_height = top - top_groove_depth; |
paul@28 | 228 | |
paul@50 | 229 | inner_payload_front_cutout_height = payload_height - top_groove_depth; |
paul@50 | 230 | inner_payload_front_cutout_width = front_side - groove_depth; |
paul@50 | 231 | inner_payload_front_cutout_depth = groove_width_overlap; |
paul@50 | 232 | |
paul@50 | 233 | inner_connector_front_cutout_height = connector_height; |
paul@50 | 234 | inner_connector_front_cutout_width = front_side - groove_depth; |
paul@50 | 235 | inner_connector_front_cutout_depth = groove_width_overlap; |
paul@1 | 236 | |
paul@35 | 237 | /* |
paul@35 | 238 | The back cavity is the indented part at the bottom of the back of the |
paul@40 | 239 | cartridge. It appears to be mechanically superfluous, just making the |
paul@40 | 240 | shape of the cartridge look a bit fancier. |
paul@35 | 241 | */ |
paul@35 | 242 | |
paul@4 | 243 | back_cavity_width = 68.0; |
paul@4 | 244 | back_cavity_inner_width = 65.0; |
paul@40 | 245 | back_cavity_offset_from_inner_left = 9.0; |
paul@40 | 246 | back_cavity_inner_offset_from_inner_left = 10.5; |
paul@4 | 247 | back_cavity_height = 13.5; |
paul@4 | 248 | back_cavity_inner_height = 12.0; |
paul@4 | 249 | back_cavity_depth = 1.5; |
paul@4 | 250 | |
paul@39 | 251 | /* |
paul@40 | 252 | The effect of the cavity on the inside of the case. The most important |
paul@40 | 253 | measurement is the maximum offset since it defines the width of the |
paul@40 | 254 | internal space that should accommodate the plastic guides of the Plus 1 |
paul@40 | 255 | socket. |
paul@39 | 256 | */ |
paul@35 | 257 | |
paul@6 | 258 | inner_back_slope_depth = 2.5; |
paul@40 | 259 | inner_back_slope_width = inner_back_slope_depth; |
paul@40 | 260 | inner_back_slope_max_offset = 10.5; |
paul@40 | 261 | inner_back_slope_min_offset = inner_back_slope_max_offset - inner_back_slope_width; |
paul@5 | 262 | |
paul@40 | 263 | /* The tapering off of the inner back edge. */ |
paul@40 | 264 | |
paul@5 | 265 | inner_back_edge_width = 69.0; |
paul@5 | 266 | inner_back_edge_height = 3.0; |
paul@5 | 267 | inner_back_edge_depth = 1.5; |
paul@5 | 268 | |
paul@40 | 269 | /* The tapering off of the inner front edge. */ |
paul@40 | 270 | |
paul@50 | 271 | inner_front_edge_width = connector_width - front_side * 2; |
paul@7 | 272 | inner_front_edge_height = 3.0; |
paul@7 | 273 | inner_front_edge_depth = 1.5; |
paul@7 | 274 | |
paul@39 | 275 | /* |
paul@39 | 276 | The cutout in the floor of the back of the cartridge that accommodates |
paul@39 | 277 | the edge connector. |
paul@39 | 278 | */ |
paul@39 | 279 | |
paul@8 | 280 | edge_connector_cutout_back_depth = 3.0; |
paul@23 | 281 | edge_connector_cutout_back_width = 57.5; |
paul@8 | 282 | |
paul@17 | 283 | /* |
paul@49 | 284 | The cutouts in the floor of the front of the cartridge that produce a |
paul@49 | 285 | kind of tab that guides the edge connector into place in the back cutout. |
paul@49 | 286 | */ |
paul@49 | 287 | |
paul@49 | 288 | edge_connector_cutout_front_depth = front_back_overlap; |
paul@50 | 289 | edge_connector_cutout_front_width = (int_connector_width - edge_connector_cutout_back_width) / 2; |
paul@49 | 290 | |
paul@49 | 291 | /* |
paul@17 | 292 | Edge connectors are themselves 0.05" or approximately 1.27mm in |
paul@17 | 293 | thickness according to the Acorn Electron Cartridge Interface Specification |
paul@17 | 294 | (Acorn Support Application Group Note 014). |
paul@17 | 295 | */ |
paul@17 | 296 | |
paul@33 | 297 | /* Extra internal features. Depths include front and back surfaces. */ |
paul@14 | 298 | |
paul@23 | 299 | pcb_back_support_width = 1.2; |
paul@14 | 300 | pcb_back_support_depth = back_depth - |
paul@14 | 301 | edge_connector_cutout_back_depth; |
paul@38 | 302 | pcb_back_support_height = height - int_connector_height - top - bottom; |
paul@14 | 303 | |
paul@23 | 304 | pcb_front_support_width = 1.2; |
paul@44 | 305 | pcb_front_support_depth = int_front_depth; |
paul@15 | 306 | pcb_front_support_height = pcb_back_support_height; |
paul@15 | 307 | |
paul@16 | 308 | /* |
paul@45 | 309 | Features measured from the Stardot Dual ROM Adaptor cartridge board |
paul@37 | 310 | dimensions diagram. Offsets are from inside the bottom "floor". |
paul@16 | 311 | */ |
paul@16 | 312 | |
paul@16 | 313 | pcb_back_support_bump_width = pcb_front_support_width; |
paul@18 | 314 | pcb_back_support_bump_depth = 1.5; |
paul@23 | 315 | pcb_back_support_left_bump_height = 13.2; |
paul@23 | 316 | pcb_back_support_right_bump_height = 10.7; |
paul@23 | 317 | pcb_back_support_left_bump_offset_from_bottom = 15.1; |
paul@23 | 318 | pcb_back_support_right_bump_offset_from_bottom = 17.6; |
paul@27 | 319 | pcb_back_support_top_bump_height = 3.8; |
paul@16 | 320 | |
paul@24 | 321 | /* Move the PCB support towards the centre. */ |
paul@35 | 322 | pcb_support_margin = 1.75; |
paul@37 | 323 | pcb_support_offset_from_centre = edge_connector_cutout_back_width / 2 |
paul@37 | 324 | - pcb_support_margin; |
paul@24 | 325 | |
paul@25 | 326 | pcb_lug_depth = pcb_back_support_depth + |
paul@25 | 327 | pcb_back_support_bump_depth; |
paul@25 | 328 | pcb_lug_inner_radius = 1.0; |
paul@25 | 329 | pcb_lug_outer_radius = 5.5 / 2; |
paul@25 | 330 | pcb_lug_offset_from_bottom = 14.35; |
paul@45 | 331 | pcb_lug_offset_from_inside = 5.55; |
paul@25 | 332 | |
paul@25 | 333 | pcb_lug_cross_width = 6.7; |
paul@33 | 334 | pcb_lug_cross_depth = pcb_back_support_depth; |
paul@25 | 335 | pcb_lug_cross_height = 1.4; |
paul@25 | 336 | |
paul@33 | 337 | pcb_front_lug_depth = pcb_back_support_bump_depth + |
paul@44 | 338 | pcb_front_support_depth; |
paul@33 | 339 | pcb_front_lug_inner_radius = pcb_lug_outer_radius; |
paul@33 | 340 | pcb_front_lug_outer_radius = pow( |
paul@33 | 341 | pow(pcb_lug_cross_width / 2, 2) + |
paul@33 | 342 | pow(pcb_lug_cross_height / 2, 2), |
paul@33 | 343 | 0.5); |
paul@33 | 344 | |
paul@25 | 345 | /* Repeated constructs. */ |
paul@25 | 346 | |
paul@26 | 347 | module pcb_support(xdir, bump_height, bump_offset) { |
paul@35 | 348 | |
paul@35 | 349 | /* |
paul@35 | 350 | Translate the support in the stated direction. |
paul@35 | 351 | Since the support is already justified in the direction, the translation |
paul@35 | 352 | moves the inner edge of the support to alignment with the end of the |
paul@35 | 353 | edge connector cutout and then back by the PCB support margin. |
paul@35 | 354 | */ |
paul@35 | 355 | |
paul@25 | 356 | translate([xdir * |
paul@37 | 357 | pcb_support_offset_from_centre, |
paul@25 | 358 | edge_connector_cutout_back_depth, |
paul@45 | 359 | int_payload_lower_extent]) |
paul@25 | 360 | justify(pcb_back_support_width, |
paul@25 | 361 | pcb_back_support_depth, |
paul@25 | 362 | pcb_back_support_height, |
paul@25 | 363 | xdir, 1, 1) |
paul@25 | 364 | union() { |
paul@27 | 365 | |
paul@27 | 366 | /* Underlying support strut. */ |
paul@27 | 367 | |
paul@25 | 368 | cube([pcb_back_support_width, |
paul@25 | 369 | pcb_back_support_depth, |
paul@25 | 370 | pcb_back_support_height], center = true); |
paul@27 | 371 | |
paul@27 | 372 | /* Middle bump. */ |
paul@27 | 373 | |
paul@25 | 374 | cube_at(pcb_back_support_bump_width, |
paul@25 | 375 | pcb_back_support_bump_depth, |
paul@26 | 376 | bump_height, |
paul@25 | 377 | 0, -1, 1, |
paul@25 | 378 | 0, |
paul@25 | 379 | -pcb_back_support_depth / 2, |
paul@26 | 380 | -pcb_back_support_height / 2 + bump_offset); |
paul@27 | 381 | |
paul@27 | 382 | /* Top bump. */ |
paul@27 | 383 | |
paul@27 | 384 | cube_at(pcb_back_support_bump_width, |
paul@27 | 385 | pcb_back_support_bump_depth, |
paul@27 | 386 | pcb_back_support_top_bump_height, |
paul@27 | 387 | 0, -1, 1, |
paul@27 | 388 | 0, |
paul@27 | 389 | -pcb_back_support_depth / 2, |
paul@27 | 390 | pcb_back_support_height / 2 - |
paul@27 | 391 | pcb_back_support_top_bump_height); |
paul@25 | 392 | } |
paul@25 | 393 | } |
paul@25 | 394 | |
paul@25 | 395 | module pcb_lug(xdir) { |
paul@25 | 396 | translate([xdir * |
paul@50 | 397 | (int_connector_width / 2 - pcb_lug_offset_from_inside), |
paul@25 | 398 | back_depth, |
paul@45 | 399 | int_payload_lower_extent + pcb_lug_offset_from_bottom |
paul@25 | 400 | ]) |
paul@25 | 401 | rotate([90, 0, 0]) |
paul@25 | 402 | difference() { |
paul@25 | 403 | union() { |
paul@25 | 404 | cylinder(h=pcb_lug_depth, r=pcb_lug_outer_radius); |
paul@25 | 405 | cube_at(pcb_lug_cross_width, |
paul@25 | 406 | pcb_lug_cross_height, pcb_lug_cross_depth, |
paul@25 | 407 | 0, 0, 1, |
paul@25 | 408 | 0, 0, 0); |
paul@25 | 409 | cube_at(pcb_lug_cross_height, |
paul@25 | 410 | pcb_lug_cross_width, pcb_lug_cross_depth, |
paul@25 | 411 | 0, 0, 1, |
paul@25 | 412 | 0, 0, 0); |
paul@25 | 413 | } |
paul@25 | 414 | cylinder(h=pcb_lug_depth, r=pcb_lug_inner_radius); |
paul@47 | 415 | translate([0, 0, pcb_lug_depth - pcb_lug_ro]) |
paul@47 | 416 | fillet_torus(pcb_lug_outer_radius, pcb_lug_rr); |
paul@25 | 417 | } |
paul@25 | 418 | } |
paul@25 | 419 | |
paul@33 | 420 | module pcb_front_lug(xdir) { |
paul@33 | 421 | translate([xdir * |
paul@50 | 422 | (int_connector_width / 2 - pcb_lug_offset_from_inside), |
paul@39 | 423 | -int_front_depth + pcb_front_lug_depth, |
paul@45 | 424 | int_payload_lower_extent + pcb_lug_offset_from_bottom |
paul@33 | 425 | ]) |
paul@33 | 426 | rotate([90, 0, 0]) |
paul@33 | 427 | difference() { |
paul@33 | 428 | cylinder(h=pcb_front_lug_depth, |
paul@33 | 429 | r=pcb_front_lug_outer_radius); |
paul@33 | 430 | cylinder(h=pcb_front_lug_depth, |
paul@33 | 431 | r=pcb_front_lug_inner_radius); |
paul@33 | 432 | } |
paul@33 | 433 | } |
paul@33 | 434 | |
paul@25 | 435 | /* The actual shapes. */ |
paul@25 | 436 | |
paul@50 | 437 | front_displacement = APART ? -payload_width * 0.6 : 0; |
paul@43 | 438 | |
paul@43 | 439 | if (FRONT) |
paul@43 | 440 | translate([front_displacement, 0, 0]) |
paul@43 | 441 | difference() { |
paul@1 | 442 | |
paul@43 | 443 | /* The cartridge surfaces. */ |
paul@1 | 444 | |
paul@43 | 445 | union() { |
paul@8 | 446 | |
paul@43 | 447 | /* Front portion. */ |
paul@8 | 448 | |
paul@43 | 449 | if (FRONT_SURFACE) { |
paul@50 | 450 | |
paul@50 | 451 | /* Surfaces surrounding the payload. */ |
paul@50 | 452 | |
paul@50 | 453 | cube_at(payload_width, front, payload_height, |
paul@50 | 454 | 0, -1, 1, |
paul@50 | 455 | 0, -int_front_depth, int_payload_lower_extent); |
paul@50 | 456 | |
paul@50 | 457 | cube_at(front_left, front_depth, payload_height, |
paul@50 | 458 | -1, -1, 1, |
paul@50 | 459 | -int_payload_width / 2, 0, int_payload_lower_extent); |
paul@50 | 460 | |
paul@50 | 461 | cube_at(front_right, front_depth, payload_height, |
paul@50 | 462 | 1, -1, 1, |
paul@50 | 463 | int_payload_width / 2, 0, int_payload_lower_extent); |
paul@50 | 464 | |
paul@50 | 465 | /* Surfaces surrounding the connector. */ |
paul@50 | 466 | |
paul@50 | 467 | cube_at(connector_width, front, connector_height, |
paul@50 | 468 | 0, -1, -1, |
paul@50 | 469 | 0, -int_front_depth, int_payload_lower_extent); |
paul@50 | 470 | |
paul@50 | 471 | cube_at(front_left, front_depth, connector_height, |
paul@50 | 472 | -1, -1, -1, |
paul@50 | 473 | -int_connector_width / 2, 0, int_payload_lower_extent); |
paul@50 | 474 | |
paul@50 | 475 | cube_at(front_right, front_depth, connector_height, |
paul@50 | 476 | 1, -1, -1, |
paul@50 | 477 | int_connector_width / 2, 0, int_payload_lower_extent); |
paul@50 | 478 | |
paul@50 | 479 | /* Top surface for the front piece. */ |
paul@50 | 480 | |
paul@50 | 481 | cube_at(payload_width, front_depth, top, |
paul@43 | 482 | 0, -1, 1, |
paul@43 | 483 | 0, 0, int_payload_upper_extent); |
paul@43 | 484 | } |
paul@20 | 485 | |
paul@43 | 486 | difference() { |
paul@43 | 487 | |
paul@43 | 488 | /* Floor of cartridge. */ |
paul@43 | 489 | |
paul@50 | 490 | cube_at(int_connector_width, int_front_depth, bottom, |
paul@43 | 491 | 0, -1, 1, |
paul@43 | 492 | 0, 0, -height / 2 + int_connector_height); |
paul@43 | 493 | |
paul@43 | 494 | /* Left cutout. */ |
paul@20 | 495 | |
paul@43 | 496 | cube_at(edge_connector_cutout_front_width, |
paul@43 | 497 | edge_connector_cutout_front_depth, |
paul@43 | 498 | bottom, |
paul@43 | 499 | 1, -1, 1, |
paul@50 | 500 | -int_connector_width / 2, |
paul@43 | 501 | 0, |
paul@43 | 502 | -height / 2 + int_connector_height); |
paul@43 | 503 | |
paul@43 | 504 | /* Right cutout. */ |
paul@20 | 505 | |
paul@43 | 506 | cube_at(edge_connector_cutout_front_width, |
paul@43 | 507 | edge_connector_cutout_front_depth, |
paul@43 | 508 | bottom, |
paul@43 | 509 | -1, -1, 1, |
paul@50 | 510 | int_connector_width / 2, |
paul@43 | 511 | 0, |
paul@43 | 512 | -height / 2 + int_connector_height); |
paul@43 | 513 | } |
paul@43 | 514 | |
paul@43 | 515 | /* PCB supports. */ |
paul@20 | 516 | |
paul@43 | 517 | cube_at(pcb_front_support_width, |
paul@43 | 518 | pcb_front_support_depth, |
paul@43 | 519 | pcb_front_support_height, |
paul@44 | 520 | -1, -1, 1, |
paul@44 | 521 | -pcb_support_offset_from_centre, |
paul@43 | 522 | 0, |
paul@45 | 523 | int_payload_lower_extent); |
paul@20 | 524 | |
paul@43 | 525 | cube_at(pcb_front_support_width, |
paul@43 | 526 | pcb_front_support_depth, |
paul@43 | 527 | pcb_front_support_height, |
paul@44 | 528 | 1, -1, 1, |
paul@44 | 529 | pcb_support_offset_from_centre, |
paul@43 | 530 | 0, |
paul@45 | 531 | int_payload_lower_extent); |
paul@20 | 532 | |
paul@43 | 533 | /* Circular "lugs" to hold PCBs in place. */ |
paul@43 | 534 | |
paul@43 | 535 | pcb_front_lug(-1); |
paul@43 | 536 | pcb_front_lug(1); |
paul@8 | 537 | } |
paul@15 | 538 | |
paul@43 | 539 | /* Label insets. */ |
paul@43 | 540 | |
paul@43 | 541 | union() { |
paul@43 | 542 | |
paul@43 | 543 | /* Front label. */ |
paul@15 | 544 | |
paul@43 | 545 | if (FRONT_LABEL_INSET) |
paul@43 | 546 | translate([-front_label_width / 2, -front_depth, |
paul@43 | 547 | front_label_offset_from_bottom - height / 2]) |
paul@43 | 548 | cube([front_label_width, front_label_depth, |
paul@43 | 549 | front_label_height]); |
paul@33 | 550 | |
paul@43 | 551 | /* Top label. See also the back piece. */ |
paul@10 | 552 | |
paul@43 | 553 | if (TOP_LABEL_INSET) |
paul@43 | 554 | translate([-top_label_width / 2, |
paul@43 | 555 | -front_depth + top_label_offset_from_front, |
paul@43 | 556 | height / 2 - top_label_depth]) |
paul@43 | 557 | cube([top_label_width, top_label_height, |
paul@43 | 558 | top_label_depth]); |
paul@43 | 559 | } |
paul@10 | 560 | |
paul@43 | 561 | /* Inner front edge cavity. */ |
paul@10 | 562 | |
paul@43 | 563 | translate([inner_front_edge_width / 2, -int_front_depth, -height / 2]) |
paul@43 | 564 | rotate([0, -90, 0]) |
paul@43 | 565 | linear_extrude(height = inner_front_edge_width) |
paul@43 | 566 | polygon([ |
paul@43 | 567 | [-extra, -inner_front_edge_depth], |
paul@43 | 568 | [0, -inner_front_edge_depth], |
paul@43 | 569 | [inner_front_edge_height, 0], |
paul@43 | 570 | [-extra, 0], |
paul@43 | 571 | ]); |
paul@10 | 572 | |
paul@43 | 573 | /* Inner top cutout for the top and sides of the back portion. */ |
paul@10 | 574 | |
paul@43 | 575 | cube_at(inner_top_front_cutout_width, |
paul@43 | 576 | inner_top_front_cutout_depth, |
paul@43 | 577 | inner_top_front_cutout_height, |
paul@43 | 578 | 0, -1, 1, |
paul@43 | 579 | 0, 0, int_payload_upper_extent); |
paul@11 | 580 | |
paul@50 | 581 | cube_at(inner_payload_front_cutout_width, |
paul@50 | 582 | inner_payload_front_cutout_depth, |
paul@50 | 583 | inner_payload_front_cutout_height, |
paul@50 | 584 | 1, -1, 1, |
paul@50 | 585 | int_payload_width / 2, 0, int_payload_lower_extent); |
paul@50 | 586 | |
paul@50 | 587 | cube_at(inner_payload_front_cutout_width, |
paul@50 | 588 | inner_payload_front_cutout_depth, |
paul@50 | 589 | inner_payload_front_cutout_height, |
paul@50 | 590 | -1, -1, 1, |
paul@50 | 591 | -int_payload_width / 2, 0, int_payload_lower_extent); |
paul@11 | 592 | |
paul@50 | 593 | cube_at(inner_connector_front_cutout_width, |
paul@50 | 594 | inner_connector_front_cutout_depth, |
paul@50 | 595 | inner_connector_front_cutout_height, |
paul@50 | 596 | 1, -1, -1, |
paul@50 | 597 | int_connector_width / 2, 0, int_payload_lower_extent); |
paul@50 | 598 | |
paul@50 | 599 | cube_at(inner_connector_front_cutout_width, |
paul@50 | 600 | inner_connector_front_cutout_depth, |
paul@50 | 601 | inner_connector_front_cutout_height, |
paul@50 | 602 | -1, -1, -1, |
paul@50 | 603 | -int_connector_width / 2, 0, int_payload_lower_extent); |
paul@28 | 604 | |
paul@43 | 605 | /* Fillets to round off the edges. */ |
paul@43 | 606 | |
paul@43 | 607 | union() { |
paul@28 | 608 | |
paul@43 | 609 | /* Top left and right rounding. */ |
paul@43 | 610 | |
paul@50 | 611 | translate([-payload_width / 2 + ro, -front_depth / 2, height / 2 - ro]) |
paul@43 | 612 | rotate([0, 0, 180]) |
paul@43 | 613 | rotate([90, 0, 0]) |
paul@43 | 614 | fillet(rr, front_depth); |
paul@50 | 615 | translate([payload_width / 2 - ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 616 | rotate([90, 0, 0]) |
paul@10 | 617 | fillet(rr, front_depth); |
paul@10 | 618 | |
paul@43 | 619 | /* Top front rounding. */ |
paul@43 | 620 | |
paul@43 | 621 | translate([0, -front_depth + ro, height / 2 - ro]) |
paul@43 | 622 | rotate([0, 0, 180]) |
paul@43 | 623 | rotate([0, -90, 0]) |
paul@50 | 624 | fillet(rr, payload_width); |
paul@10 | 625 | |
paul@43 | 626 | /* Edge rounding. */ |
paul@43 | 627 | |
paul@50 | 628 | translate([-payload_width / 2 + ro, -front_depth + ro, 0]) |
paul@43 | 629 | rotate([0, 0, 180]) |
paul@43 | 630 | fillet(rr, height); |
paul@50 | 631 | translate([payload_width / 2 - ro, -front_depth + ro, 0]) |
paul@43 | 632 | rotate([0, 0, 270]) |
paul@43 | 633 | fillet(rr, height); |
paul@43 | 634 | } |
paul@10 | 635 | } |
paul@10 | 636 | |
paul@41 | 637 | /* |
paul@41 | 638 | Place the back piece next to the front, with the internals facing out |
paul@43 | 639 | the same way, if APART is defined. |
paul@41 | 640 | */ |
paul@41 | 641 | |
paul@50 | 642 | back_displacement = APART ? payload_width * 0.6 : 0; |
paul@43 | 643 | back_rotation = APART ? 180 : 0; |
paul@43 | 644 | |
paul@43 | 645 | if (BACK) |
paul@43 | 646 | translate([back_displacement, 0, 0]) |
paul@43 | 647 | rotate([0, 0, back_rotation]) |
paul@43 | 648 | difference() { |
paul@43 | 649 | |
paul@43 | 650 | /* The cartridge surfaces. */ |
paul@43 | 651 | |
paul@43 | 652 | union() { |
paul@43 | 653 | |
paul@43 | 654 | /* Back portion. */ |
paul@10 | 655 | |
paul@43 | 656 | if (BACK_SURFACE) { |
paul@49 | 657 | |
paul@50 | 658 | /* Surfaces surrounding the payload. */ |
paul@50 | 659 | |
paul@49 | 660 | /* Payload section of back surface. */ |
paul@49 | 661 | |
paul@50 | 662 | cube_at(payload_width, payload_back, payload_height, |
paul@49 | 663 | 0, 1, 1, |
paul@49 | 664 | 0, int_payload_back_depth, int_payload_lower_extent); |
paul@49 | 665 | |
paul@50 | 666 | cube_at(back_left, back_depth, payload_height, |
paul@50 | 667 | -1, 1, 1, |
paul@50 | 668 | -int_payload_width / 2, 0, int_payload_lower_extent); |
paul@50 | 669 | |
paul@50 | 670 | cube_at(back_right, back_depth, payload_height, |
paul@50 | 671 | 1, 1, 1, |
paul@50 | 672 | int_payload_width / 2, 0, int_payload_lower_extent); |
paul@50 | 673 | |
paul@50 | 674 | /* Surfaces surrounding the connector. */ |
paul@50 | 675 | |
paul@49 | 676 | /* Connector section of back surface overlapping the floor. */ |
paul@49 | 677 | |
paul@50 | 678 | cube_at(connector_width, connector_back, connector_height, |
paul@50 | 679 | 0, 1, -1, |
paul@50 | 680 | 0, int_connector_back_depth, int_payload_lower_extent); |
paul@46 | 681 | |
paul@50 | 682 | cube_at(back_left, back_depth, connector_height, |
paul@50 | 683 | -1, 1, -1, |
paul@50 | 684 | -int_connector_width / 2, 0, int_payload_lower_extent); |
paul@46 | 685 | |
paul@50 | 686 | cube_at(back_right, back_depth, connector_height, |
paul@50 | 687 | 1, 1, -1, |
paul@50 | 688 | int_connector_width / 2, 0, int_payload_lower_extent); |
paul@46 | 689 | |
paul@49 | 690 | /* Top of back piece. */ |
paul@49 | 691 | |
paul@50 | 692 | cube_at(payload_width, back_depth, top, |
paul@43 | 693 | 0, 1, 1, |
paul@46 | 694 | 0, 0, int_payload_upper_extent); |
paul@46 | 695 | |
paul@50 | 696 | /* |
paul@50 | 697 | The extension of the back to connect with the front. Here, the inside |
paul@50 | 698 | edges are rounded. The outside edges are rounded later. |
paul@50 | 699 | |
paul@50 | 700 | An extra overlapping measure is employed so that the filleting is |
paul@50 | 701 | continuous between the payload and connector portions. On the inside |
paul@50 | 702 | edges, the connector filleting is extended upwards. |
paul@50 | 703 | */ |
paul@50 | 704 | |
paul@50 | 705 | /* Left side of payload. */ |
paul@46 | 706 | |
paul@46 | 707 | difference() { |
paul@50 | 708 | cube_at(back_left - groove_depth, groove_width_extra, inner_payload_front_cutout_height, |
paul@46 | 709 | -1, 1, 1, |
paul@50 | 710 | -int_payload_width / 2, -groove_width_extra, int_payload_lower_extent); |
paul@50 | 711 | translate([-int_payload_width / 2 - groove_ro, -groove_width_extra + groove_ro, |
paul@50 | 712 | int_payload_lower_extent]) |
paul@46 | 713 | rotate([0, 0, -90]) |
paul@50 | 714 | fillet_justified(groove_rr, inner_payload_front_cutout_height); |
paul@46 | 715 | } |
paul@46 | 716 | |
paul@50 | 717 | /* Right side of payload. */ |
paul@50 | 718 | |
paul@46 | 719 | difference() { |
paul@50 | 720 | cube_at(back_right - groove_depth, groove_width_extra, inner_payload_front_cutout_height, |
paul@46 | 721 | 1, 1, 1, |
paul@50 | 722 | int_payload_width / 2, -groove_width_extra, int_payload_lower_extent); |
paul@50 | 723 | translate([int_payload_width / 2 + groove_ro, -groove_width_extra + groove_ro, |
paul@50 | 724 | int_payload_lower_extent]) |
paul@50 | 725 | rotate([0, 0, 180]) |
paul@50 | 726 | fillet_justified(groove_rr, inner_payload_front_cutout_height); |
paul@50 | 727 | } |
paul@50 | 728 | |
paul@50 | 729 | /* Left side of connector. */ |
paul@50 | 730 | |
paul@50 | 731 | difference() { |
paul@50 | 732 | cube_at(back_left - groove_depth, groove_width_extra, inner_connector_front_cutout_height, |
paul@50 | 733 | -1, 1, -1, |
paul@50 | 734 | -int_connector_width / 2, -groove_width_extra, int_payload_lower_extent); |
paul@50 | 735 | translate([-int_connector_width / 2 - groove_ro, -groove_width_extra + groove_ro, |
paul@50 | 736 | -height / 2]) |
paul@50 | 737 | rotate([0, 0, -90]) |
paul@50 | 738 | fillet_partitioned(groove_rr, inner_connector_front_cutout_height + extra); |
paul@50 | 739 | } |
paul@50 | 740 | |
paul@50 | 741 | /* Right side of connector. */ |
paul@50 | 742 | |
paul@50 | 743 | difference() { |
paul@50 | 744 | cube_at(back_right - groove_depth, groove_width_extra, inner_connector_front_cutout_height, |
paul@50 | 745 | 1, 1, -1, |
paul@50 | 746 | int_connector_width / 2, -groove_width_extra, int_payload_lower_extent); |
paul@50 | 747 | translate([int_connector_width / 2 + groove_ro, -groove_width_extra + groove_ro, |
paul@46 | 748 | -height / 2]) |
paul@46 | 749 | rotate([0, 0, 180]) |
paul@50 | 750 | fillet_partitioned(groove_rr, inner_connector_front_cutout_height + extra); |
paul@46 | 751 | } |
paul@46 | 752 | |
paul@50 | 753 | /* Top side. */ |
paul@50 | 754 | |
paul@46 | 755 | difference() { |
paul@50 | 756 | cube_at(payload_width - groove_depth * 2, groove_width_extra, top - top_groove_depth, |
paul@46 | 757 | 0, 1, 1, |
paul@46 | 758 | 0, -groove_width_extra, int_payload_upper_extent); |
paul@46 | 759 | translate([0, -groove_width_extra + groove_ro, |
paul@46 | 760 | int_payload_upper_extent + groove_ro]) |
paul@46 | 761 | rotate([0, 0, 180]) |
paul@46 | 762 | rotate([0, 90, 0]) |
paul@50 | 763 | fillet(groove_rr, payload_width - groove_depth * 2); |
paul@46 | 764 | } |
paul@43 | 765 | } |
paul@10 | 766 | |
paul@43 | 767 | difference() { |
paul@8 | 768 | |
paul@43 | 769 | /* Floor of cartridge. */ |
paul@8 | 770 | |
paul@50 | 771 | cube_at(int_connector_width, int_connector_back_depth, bottom, |
paul@43 | 772 | 0, 1, 1, |
paul@43 | 773 | 0, 0, -height / 2 + int_connector_height); |
paul@43 | 774 | |
paul@43 | 775 | /* Edge connector cutout. */ |
paul@43 | 776 | |
paul@43 | 777 | cube_at(edge_connector_cutout_back_width, |
paul@43 | 778 | edge_connector_cutout_back_depth, |
paul@43 | 779 | bottom, |
paul@43 | 780 | 0, 1, 1, |
paul@43 | 781 | 0, 0, -height / 2 + int_connector_height); |
paul@43 | 782 | } |
paul@43 | 783 | |
paul@43 | 784 | /* PCB supports. */ |
paul@42 | 785 | |
paul@43 | 786 | pcb_support(-1, pcb_back_support_left_bump_height, |
paul@43 | 787 | pcb_back_support_left_bump_offset_from_bottom); |
paul@43 | 788 | pcb_support(1, pcb_back_support_right_bump_height, |
paul@43 | 789 | pcb_back_support_right_bump_offset_from_bottom); |
paul@20 | 790 | |
paul@43 | 791 | /* Circular "lugs" to hold PCBs in place. */ |
paul@43 | 792 | |
paul@43 | 793 | pcb_lug(-1); |
paul@43 | 794 | pcb_lug(1); |
paul@43 | 795 | } |
paul@20 | 796 | |
paul@43 | 797 | /* Label insets. */ |
paul@43 | 798 | |
paul@43 | 799 | union() { |
paul@43 | 800 | |
paul@43 | 801 | /* Top label. See also the front piece. */ |
paul@20 | 802 | |
paul@43 | 803 | if (TOP_LABEL_INSET) |
paul@43 | 804 | translate([-top_label_width / 2, |
paul@43 | 805 | -front_depth + top_label_offset_from_front, |
paul@43 | 806 | height / 2 - top_label_depth]) |
paul@43 | 807 | cube([top_label_width, top_label_height, |
paul@43 | 808 | top_label_depth]); |
paul@8 | 809 | } |
paul@14 | 810 | |
paul@43 | 811 | /* Top and side grooves, positioned in the back portion. */ |
paul@25 | 812 | |
paul@43 | 813 | union() { |
paul@0 | 814 | |
paul@43 | 815 | /* Left groove. */ |
paul@1 | 816 | |
paul@46 | 817 | cube_at(groove_depth, groove_width_normal, height, |
paul@43 | 818 | 1, 1, 0, |
paul@50 | 819 | -payload_width / 2, 0, 0); |
paul@2 | 820 | |
paul@43 | 821 | /* Right groove. */ |
paul@2 | 822 | |
paul@46 | 823 | cube_at(groove_depth, groove_width_normal, height, |
paul@43 | 824 | -1, 1, 0, |
paul@50 | 825 | payload_width / 2, 0, 0); |
paul@8 | 826 | |
paul@43 | 827 | /* Top grooves. */ |
paul@4 | 828 | |
paul@50 | 829 | cube_at(payload_width, groove_width_normal, groove_depth, |
paul@43 | 830 | 0, 1, -1, |
paul@46 | 831 | 0, 0, height / 2); |
paul@4 | 832 | |
paul@50 | 833 | cube_at(payload_width, top_groove_width, top_groove_depth, |
paul@43 | 834 | 0, 1, -1, |
paul@43 | 835 | 0, -groove_width_extra, height / 2); |
paul@41 | 836 | } |
paul@2 | 837 | |
paul@43 | 838 | /* Back cavity. */ |
paul@43 | 839 | |
paul@43 | 840 | if (BACK_CAVITY) |
paul@43 | 841 | intersection() { |
paul@43 | 842 | |
paul@43 | 843 | /* From the bottom upwards. */ |
paul@5 | 844 | |
paul@43 | 845 | translate([0, back_depth, -height / 2]) |
paul@43 | 846 | linear_extrude(height = back_cavity_height) |
paul@50 | 847 | translate([-int_connector_width / 2, 0, 0]) |
paul@43 | 848 | polygon([ |
paul@43 | 849 | [back_cavity_offset_from_inner_left, 0], |
paul@43 | 850 | [back_cavity_inner_offset_from_inner_left, |
paul@43 | 851 | -back_cavity_depth], |
paul@43 | 852 | [back_cavity_inner_offset_from_inner_left + |
paul@43 | 853 | back_cavity_inner_width, |
paul@43 | 854 | -back_cavity_depth], |
paul@43 | 855 | [back_cavity_offset_from_inner_left + |
paul@43 | 856 | back_cavity_width, 0] |
paul@43 | 857 | ]); |
paul@43 | 858 | |
paul@43 | 859 | /* From left to right. */ |
paul@43 | 860 | |
paul@43 | 861 | translate([back_cavity_width / 2, back_depth, -height / 2]) |
paul@43 | 862 | rotate([0, -90, 0]) |
paul@43 | 863 | linear_extrude(height = back_cavity_width) |
paul@43 | 864 | polygon([ |
paul@43 | 865 | [-extra, -back_cavity_depth], |
paul@43 | 866 | [back_cavity_inner_height, |
paul@43 | 867 | -back_cavity_depth], |
paul@43 | 868 | [back_cavity_height, 0], |
paul@43 | 869 | [-extra, 0] |
paul@43 | 870 | ]); |
paul@43 | 871 | } |
paul@43 | 872 | |
paul@43 | 873 | /* Inner back cavities. */ |
paul@5 | 874 | |
paul@49 | 875 | translate([0, int_connector_back_depth, -height / 2]) |
paul@43 | 876 | linear_extrude(height = int_connector_height) |
paul@50 | 877 | translate([-int_connector_width / 2, 0, 0]) |
paul@43 | 878 | polygon([ |
paul@43 | 879 | [0, 0], |
paul@43 | 880 | [inner_back_slope_max_offset, 0], |
paul@43 | 881 | [inner_back_slope_min_offset, |
paul@43 | 882 | inner_back_slope_depth], |
paul@43 | 883 | [0, inner_back_slope_depth] |
paul@43 | 884 | ]); |
paul@5 | 885 | |
paul@49 | 886 | translate([0, int_connector_back_depth, -height / 2]) |
paul@43 | 887 | linear_extrude(height = int_connector_height) |
paul@50 | 888 | translate([int_connector_width / 2, 0, 0]) |
paul@43 | 889 | polygon([ |
paul@43 | 890 | [0, 0], |
paul@43 | 891 | [-inner_back_slope_max_offset, 0], |
paul@43 | 892 | [-inner_back_slope_min_offset, |
paul@43 | 893 | inner_back_slope_depth], |
paul@43 | 894 | [0, inner_back_slope_depth] |
paul@43 | 895 | ]); |
paul@7 | 896 | |
paul@43 | 897 | /* Inner back edge cavity. */ |
paul@5 | 898 | |
paul@43 | 899 | translate([inner_back_edge_width / 2, |
paul@49 | 900 | int_connector_back_depth + inner_back_edge_depth, -height / 2]) |
paul@43 | 901 | rotate([0, -90, 0]) |
paul@43 | 902 | linear_extrude(height = inner_back_edge_width) |
paul@43 | 903 | polygon([ |
paul@43 | 904 | [-extra, -inner_back_edge_depth], |
paul@43 | 905 | [inner_back_edge_height, -inner_back_edge_depth], |
paul@43 | 906 | [0, 0], |
paul@43 | 907 | [-extra, 0] |
paul@43 | 908 | ]); |
paul@0 | 909 | |
paul@43 | 910 | /* Fillets to round off the edges. */ |
paul@43 | 911 | |
paul@43 | 912 | union() { |
paul@43 | 913 | |
paul@43 | 914 | /* Top left and right rounding. */ |
paul@43 | 915 | |
paul@50 | 916 | translate([-payload_width / 2 + ro, back_depth / 2, height / 2 - ro]) |
paul@43 | 917 | rotate([0, 0, 180]) |
paul@43 | 918 | rotate([90, 0, 0]) |
paul@43 | 919 | fillet(rr, back_depth); |
paul@50 | 920 | translate([payload_width / 2 - ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 921 | rotate([90, 0, 0]) |
paul@9 | 922 | fillet(rr, back_depth); |
paul@43 | 923 | |
paul@43 | 924 | /* Top back rounding. */ |
paul@43 | 925 | |
paul@43 | 926 | translate([0, back_depth - ro, height / 2 - ro]) |
paul@43 | 927 | rotate([0, -90, 0]) |
paul@50 | 928 | fillet(rr, payload_width); |
paul@43 | 929 | |
paul@50 | 930 | /* Outer edge rounding. */ |
paul@43 | 931 | |
paul@50 | 932 | translate([payload_width / 2 - ro, back_depth - ro, int_payload_lower_extent - extra]) |
paul@50 | 933 | fillet_justified(rr, payload_height + extra); |
paul@50 | 934 | |
paul@50 | 935 | translate([-payload_width / 2 + ro, back_depth - ro, int_payload_lower_extent - extra]) |
paul@50 | 936 | rotate([0, 0, 90]) |
paul@50 | 937 | fillet_justified(rr, payload_height + extra); |
paul@50 | 938 | |
paul@50 | 939 | translate([connector_width / 2 - ro, back_depth - ro, -height / 2]) |
paul@50 | 940 | fillet_partitioned(rr, connector_height); |
paul@50 | 941 | |
paul@50 | 942 | translate([-connector_width / 2 + ro, back_depth - ro, -height / 2]) |
paul@43 | 943 | rotate([0, 0, 90]) |
paul@50 | 944 | fillet_partitioned(rr, connector_height); |
paul@50 | 945 | |
paul@50 | 946 | /* |
paul@50 | 947 | Outer edge rounding of the back extension. This is done as a |
paul@50 | 948 | separate removal operation rather than occurring when creating the |
paul@50 | 949 | extension in order to ensure that the edges are actually rounded. |
paul@50 | 950 | |
paul@50 | 951 | An extra overlapping measure is employed so that the filleting is |
paul@50 | 952 | continuous between the payload and connector portions. On the outside |
paul@50 | 953 | edges, the payload filleting is extended downwards. |
paul@50 | 954 | */ |
paul@46 | 955 | |
paul@50 | 956 | translate([-payload_width / 2 + groove_depth + groove_ro, -groove_width_extra + groove_ro, |
paul@50 | 957 | int_payload_lower_extent - extra]) |
paul@50 | 958 | rotate([0, 0, 180]) |
paul@50 | 959 | fillet_justified(groove_rr, inner_payload_front_cutout_height + extra); |
paul@46 | 960 | |
paul@50 | 961 | translate([payload_width / 2 - groove_depth - groove_ro, -groove_width_extra + groove_ro, |
paul@50 | 962 | int_payload_lower_extent - extra]) |
paul@50 | 963 | rotate([0, 0, -90]) |
paul@50 | 964 | fillet_justified(groove_rr, inner_payload_front_cutout_height + extra); |
paul@50 | 965 | |
paul@50 | 966 | /* Sides of connector. */ |
paul@50 | 967 | |
paul@50 | 968 | translate([-connector_width / 2 + groove_depth + groove_ro, -groove_width_extra + groove_ro, |
paul@46 | 969 | -height / 2]) |
paul@46 | 970 | rotate([0, 0, 180]) |
paul@50 | 971 | fillet_partitioned(groove_rr, inner_connector_front_cutout_height); |
paul@46 | 972 | |
paul@50 | 973 | translate([connector_width / 2 - groove_depth - groove_ro, -groove_width_extra + groove_ro, |
paul@46 | 974 | -height / 2]) |
paul@46 | 975 | rotate([0, 0, -90]) |
paul@50 | 976 | fillet_partitioned(groove_rr, inner_connector_front_cutout_height); |
paul@50 | 977 | |
paul@50 | 978 | /* Top of payload. */ |
paul@46 | 979 | |
paul@46 | 980 | translate([0, -groove_width_extra + groove_ro, |
paul@46 | 981 | int_payload_upper_extent + inner_top_front_cutout_height - groove_ro]) |
paul@46 | 982 | rotate([0, 0, 180]) |
paul@46 | 983 | rotate([0, -90, 0]) |
paul@50 | 984 | fillet(groove_rr, payload_width - groove_depth * 2); |
paul@43 | 985 | } |
paul@0 | 986 | } |
paul@45 | 987 | |
paul@45 | 988 | /* PCB for checking. */ |
paul@45 | 989 | |
paul@45 | 990 | pcb_width = 84.85; pcb_height = 62.5; pcb_depth = 1; |
paul@45 | 991 | edge_connector_width = 56.5; edge_connector_height = 11.85; |
paul@45 | 992 | pcb_position_y = int_payload_lower_extent; |
paul@45 | 993 | |
paul@45 | 994 | pcb_left_hole_offset = pcb_back_support_left_bump_offset_from_bottom |
paul@45 | 995 | + 0.55; |
paul@45 | 996 | pcb_left_hole_width = 2.2; |
paul@45 | 997 | pcb_left_hole_height = pcb_back_support_left_bump_height - 0.55 * 2; |
paul@45 | 998 | pcb_left_hole_offset_from_centre = pcb_support_offset_from_centre + |
paul@45 | 999 | pcb_back_support_width / 2 - pcb_left_hole_width / 2; |
paul@45 | 1000 | |
paul@45 | 1001 | pcb_right_hole_offset = pcb_back_support_right_bump_offset_from_bottom |
paul@45 | 1002 | + 0.55; |
paul@45 | 1003 | pcb_right_hole_width = pcb_left_hole_width; |
paul@45 | 1004 | pcb_right_hole_height = pcb_back_support_right_bump_height - 0.55 * 2; |
paul@45 | 1005 | pcb_right_hole_offset_from_centre = -pcb_left_hole_offset_from_centre; |
paul@45 | 1006 | |
paul@45 | 1007 | pcb_hole_depth = pcb_depth + 0.2; |
paul@45 | 1008 | pcb_hole_start_depth = -0.1; |
paul@45 | 1009 | pcb_lug_hole_radius = 3.75; |
paul@45 | 1010 | |
paul@45 | 1011 | if (PCB) |
paul@45 | 1012 | translate([back_displacement, 0, 0]) |
paul@45 | 1013 | translate([0, 0, pcb_position_y]) |
paul@45 | 1014 | difference() { |
paul@45 | 1015 | |
paul@45 | 1016 | /* Mock PCB. */ |
paul@45 | 1017 | |
paul@45 | 1018 | union() { |
paul@45 | 1019 | cube_at(pcb_width, pcb_depth, |
paul@45 | 1020 | pcb_height - edge_connector_height, |
paul@45 | 1021 | 0, 1, 1, |
paul@45 | 1022 | 0, 0, 0); |
paul@45 | 1023 | cube_at(edge_connector_width, pcb_depth, |
paul@45 | 1024 | edge_connector_height, |
paul@45 | 1025 | 0, 1, -1, |
paul@45 | 1026 | 0, 0, 0); |
paul@45 | 1027 | } |
paul@45 | 1028 | |
paul@45 | 1029 | /* Holes for mounting. */ |
paul@45 | 1030 | |
paul@45 | 1031 | union() { |
paul@45 | 1032 | cube_at(pcb_left_hole_width, 1, pcb_left_hole_height, |
paul@45 | 1033 | 1, 1, 1, |
paul@45 | 1034 | pcb_left_hole_offset_from_centre, 0, pcb_left_hole_offset); |
paul@45 | 1035 | translate([pcb_left_hole_offset_from_centre + |
paul@45 | 1036 | pcb_left_hole_width / 2, pcb_hole_start_depth, pcb_left_hole_offset]) |
paul@45 | 1037 | rotate([-90, 0, 0]) |
paul@45 | 1038 | cylinder(h=pcb_hole_depth, r=pcb_left_hole_width / 2); |
paul@45 | 1039 | translate([pcb_left_hole_offset_from_centre + |
paul@45 | 1040 | pcb_left_hole_width / 2, pcb_hole_start_depth, |
paul@45 | 1041 | pcb_left_hole_offset + pcb_left_hole_height]) |
paul@45 | 1042 | rotate([-90, 0, 0]) |
paul@45 | 1043 | cylinder(h=pcb_hole_depth, r=pcb_left_hole_width / 2); |
paul@45 | 1044 | } |
paul@45 | 1045 | |
paul@45 | 1046 | union() { |
paul@45 | 1047 | cube_at(pcb_right_hole_width, 1, pcb_right_hole_height, |
paul@45 | 1048 | -1, 1, 1, |
paul@45 | 1049 | pcb_right_hole_offset_from_centre, 0, pcb_right_hole_offset); |
paul@45 | 1050 | translate([pcb_right_hole_offset_from_centre - |
paul@45 | 1051 | pcb_right_hole_width / 2, pcb_hole_start_depth, pcb_right_hole_offset]) |
paul@45 | 1052 | rotate([-90, 0, 0]) |
paul@45 | 1053 | cylinder(h=pcb_hole_depth, r=pcb_right_hole_width / 2); |
paul@45 | 1054 | translate([pcb_right_hole_offset_from_centre - |
paul@45 | 1055 | pcb_right_hole_width / 2, pcb_hole_start_depth, |
paul@45 | 1056 | pcb_right_hole_offset + pcb_right_hole_height]) |
paul@45 | 1057 | rotate([-90, 0, 0]) |
paul@45 | 1058 | cylinder(h=pcb_hole_depth, r=pcb_right_hole_width / 2); |
paul@45 | 1059 | } |
paul@45 | 1060 | |
paul@45 | 1061 | /* Holes for lugs. */ |
paul@45 | 1062 | |
paul@45 | 1063 | translate([ |
paul@50 | 1064 | -int_connector_width / 2 + pcb_lug_offset_from_inside, |
paul@45 | 1065 | pcb_hole_start_depth, pcb_lug_offset_from_bottom]) |
paul@45 | 1066 | rotate([-90, 0, 0]) |
paul@45 | 1067 | cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius); |
paul@45 | 1068 | |
paul@45 | 1069 | translate([ |
paul@50 | 1070 | int_connector_width / 2 - pcb_lug_offset_from_inside, |
paul@45 | 1071 | pcb_hole_start_depth, pcb_lug_offset_from_bottom]) |
paul@45 | 1072 | rotate([-90, 0, 0]) |
paul@45 | 1073 | cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius); |
paul@45 | 1074 | } |
paul@0 | 1075 | } |
paul@0 | 1076 | |
paul@38 | 1077 | cartridge(); |