paul@22 | 1 | /* |
paul@65 | 2 | Copyright (C) 2014, 2015, 2016 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@65 | 22 | /* Model configurations. Do not edit! */ |
paul@53 | 23 | |
paul@56 | 24 | ROM_CARTRIDGE = 0; |
paul@56 | 25 | WIDE_CARTRIDGE = 1; |
paul@56 | 26 | |
paul@67 | 27 | /* Set this to the desired model type. */ |
paul@67 | 28 | |
paul@67 | 29 | MODEL = ROM_CARTRIDGE; |
paul@67 | 30 | |
paul@65 | 31 | /* |
paul@65 | 32 | Configure the generated shapes. |
paul@65 | 33 | For the absolute simplest shape (for basic 3D printers)... |
paul@65 | 34 | |
paul@67 | 35 | BACK_CONNECTOR_SECTION = 0; |
paul@67 | 36 | FRONT_LABEL_INSET = 0; TOP_LABEL_INSET = 0; |
paul@68 | 37 | GROOVE = 0; ROUND_EDGES = 0; ROUND_CONNECTING_EDGES = 0; |
paul@65 | 38 | |
paul@65 | 39 | Leave all options enabled for more capable 3D printers. |
paul@65 | 40 | */ |
paul@65 | 41 | |
paul@67 | 42 | /* The back part of the connecting section of the cartridge. */ |
paul@67 | 43 | BACK_CONNECTOR_SECTION = 1; |
paul@67 | 44 | |
paul@66 | 45 | /* A necessary exterior cavity to let the cartridge fit inside the slot. */ |
paul@65 | 46 | BACK_CAVITY = 1; |
paul@65 | 47 | |
paul@65 | 48 | /* Optional insets for labels. */ |
paul@65 | 49 | FRONT_LABEL_INSET = 1; |
paul@65 | 50 | TOP_LABEL_INSET = 1; |
paul@65 | 51 | |
paul@65 | 52 | /* Optional groove between the pieces to match the Electron. */ |
paul@65 | 53 | GROOVE = 1; |
paul@65 | 54 | |
paul@65 | 55 | /* Optional rounding of the external edges. */ |
paul@65 | 56 | ROUND_EDGES = 1; |
paul@65 | 57 | |
paul@65 | 58 | /* Recommended rounding of connection edges. */ |
paul@65 | 59 | ROUND_CONNECTING_EDGES = 1; |
paul@65 | 60 | |
paul@65 | 61 | /* Set this where a shorter PCB is to be used. */ |
paul@65 | 62 | |
paul@65 | 63 | SHORT_PCB = 0; |
paul@65 | 64 | |
paul@45 | 65 | /* |
paul@45 | 66 | Options for checking. Some useful combinations... |
paul@45 | 67 | |
paul@45 | 68 | Check feature alignment: APART = 0; BACK_SURFACE = 0; FRONT_SURFACE = 0; |
paul@45 | 69 | Check PCB alignment: PCB = 1; BACK_SURFACE = 0; |
paul@45 | 70 | */ |
paul@45 | 71 | |
paul@43 | 72 | BACK = 1; BACK_SURFACE = 1; |
paul@43 | 73 | FRONT = 1; FRONT_SURFACE = 1; |
paul@63 | 74 | TOP_SURFACE = 1; |
paul@45 | 75 | |
paul@45 | 76 | /* For printing: APART = 1; PCB = 0; */ |
paul@45 | 77 | |
paul@43 | 78 | APART = 1; |
paul@70 | 79 | SPACE_APART = 10; |
paul@45 | 80 | PCB = 0; |
paul@43 | 81 | |
paul@68 | 82 | /* To check overlaps: INTERSECT = 1; CLOSED = 1; */ |
paul@68 | 83 | |
paul@68 | 84 | INTERSECT = 0; |
paul@68 | 85 | CLOSED = 0; |
paul@68 | 86 | |
paul@48 | 87 | /* To save time (before printing): FILLET = 0; */ |
paul@48 | 88 | |
paul@48 | 89 | FILLET = 1; |
paul@48 | 90 | |
paul@22 | 91 | /* |
paul@22 | 92 | Rounding/fillet radius and additional margin of subtracted |
paul@22 | 93 | material. The additional margin helps avoid geometry problems. |
paul@22 | 94 | */ |
paul@3 | 95 | |
paul@23 | 96 | rr = 2; |
paul@3 | 97 | ro = rr; |
paul@3 | 98 | extra = 0.1; |
paul@3 | 99 | |
paul@47 | 100 | groove_rr = 0.2; |
paul@46 | 101 | groove_ro = groove_rr; |
paul@46 | 102 | |
paul@47 | 103 | pcb_lug_rr = 0.5; |
paul@47 | 104 | pcb_lug_ro = pcb_lug_rr; |
paul@47 | 105 | |
paul@47 | 106 | /* A fillet performs rounding using a quarter segment of a cylinder. */ |
paul@47 | 107 | |
paul@0 | 108 | module fillet(r, h) { |
paul@48 | 109 | if (FILLET) |
paul@48 | 110 | translate([0, 0, -h/2]) |
paul@48 | 111 | difference() { |
paul@48 | 112 | cube([r + extra, r + extra, h + extra]); |
paul@48 | 113 | cylinder(r = r, h = h); |
paul@48 | 114 | } |
paul@48 | 115 | } |
paul@48 | 116 | |
paul@50 | 117 | /* A fillet justified using the axes. */ |
paul@50 | 118 | |
paul@48 | 119 | module fillet_justified(r, h) { |
paul@48 | 120 | if (FILLET) |
paul@0 | 121 | difference() { |
paul@12 | 122 | cube([r + extra, r + extra, h + extra]); |
paul@0 | 123 | cylinder(r = r, h = h); |
paul@0 | 124 | } |
paul@0 | 125 | } |
paul@0 | 126 | |
paul@50 | 127 | /* A justified fillet with the extra material below the y-axis. */ |
paul@50 | 128 | |
paul@50 | 129 | module fillet_partitioned(r, h) { |
paul@50 | 130 | if (FILLET) |
paul@50 | 131 | difference() { |
paul@50 | 132 | translate([0, 0, -extra]) |
paul@50 | 133 | cube([r + extra, r + extra, h + extra]); |
paul@50 | 134 | cylinder(r = r, h = h); |
paul@50 | 135 | } |
paul@50 | 136 | } |
paul@50 | 137 | |
paul@47 | 138 | module fillet_torus(radius, rounding) { |
paul@48 | 139 | if (FILLET) |
paul@48 | 140 | difference() { |
paul@48 | 141 | cube_at((radius + extra) * 2, (radius + extra) * 2, rounding + extra, |
paul@48 | 142 | 0, 0, 1, |
paul@48 | 143 | 0, 0, 0); |
paul@48 | 144 | union() { |
paul@48 | 145 | rotate_extrude(convexity = 10) |
paul@48 | 146 | translate([radius - rounding, 0, 0]) |
paul@48 | 147 | circle(r = rounding); |
paul@48 | 148 | cylinder(r = radius - rounding, h = rounding); |
paul@48 | 149 | } |
paul@47 | 150 | } |
paul@47 | 151 | } |
paul@47 | 152 | |
paul@20 | 153 | /* |
paul@21 | 154 | Justify an object of the given dimensions, according to the given |
paul@21 | 155 | factors (where 1 indicates moving the object to the positive side of an |
paul@21 | 156 | axis, and -1 indicates moving it to the negative side of an axis). |
paul@21 | 157 | |
paul@21 | 158 | NOTE: child should eventually be replaced by children. |
paul@21 | 159 | */ |
paul@21 | 160 | module justify(width, depth, height, wdir, ddir, hdir) { |
paul@21 | 161 | translate([ |
paul@21 | 162 | wdir * width / 2, |
paul@21 | 163 | ddir * depth / 2, |
paul@21 | 164 | hdir * height / 2]) |
paul@21 | 165 | child(); |
paul@21 | 166 | } |
paul@21 | 167 | |
paul@21 | 168 | /* |
paul@20 | 169 | Make a cuboid of the given dimensions, justifying it according to the given |
paul@21 | 170 | factors, and moving it to the specified coordinates. |
paul@21 | 171 | |
paul@21 | 172 | NOTE: Usage of justify within this module will not work due to recursion |
paul@21 | 173 | NOTE: limitations in openscad, potentially removed in more recent |
paul@21 | 174 | NOTE: releases. Thus, the justify transform is merged in here. |
paul@20 | 175 | */ |
paul@20 | 176 | module cube_at(width, depth, height, wdir, ddir, hdir, x, y, z) { |
paul@20 | 177 | translate([ |
paul@20 | 178 | x + wdir * width / 2, |
paul@20 | 179 | y + ddir * depth / 2, |
paul@20 | 180 | z + hdir * height / 2]) |
paul@20 | 181 | cube([width, depth, height], center = true); |
paul@20 | 182 | } |
paul@20 | 183 | |
paul@56 | 184 | /* Model widths. */ |
paul@56 | 185 | |
paul@56 | 186 | ROM_CARTRIDGE_int_payload_width = 86.0; |
paul@56 | 187 | WIDE_CARTRIDGE_int_payload_width = 140.0; |
paul@56 | 188 | |
paul@38 | 189 | /* Internal dimensions. */ |
paul@0 | 190 | |
paul@56 | 191 | /* internal width in the payload section */ |
paul@56 | 192 | int_payload_width = |
paul@56 | 193 | MODEL == ROM_CARTRIDGE ? ROM_CARTRIDGE_int_payload_width : |
paul@56 | 194 | MODEL == WIDE_CARTRIDGE ? WIDE_CARTRIDGE_int_payload_width : |
paul@56 | 195 | ROM_CARTRIDGE_int_payload_width; |
paul@56 | 196 | |
paul@50 | 197 | int_connector_width = 86.0; /* limited to the Plus 1 socket dimensions */ |
paul@61 | 198 | int_payload_depth = 14.0; /* maximum depth in the payload section */ |
paul@61 | 199 | int_connector_depth = 11.5; /* maximum depth in the connector section */ |
paul@42 | 200 | int_payload_height = 50.8; /* space between the top and the floor */ |
paul@42 | 201 | int_connector_height = 13.5; /* vertical offset of bottom/floor of payload area */ |
paul@0 | 202 | |
paul@24 | 203 | /* Side thicknesses. */ |
paul@24 | 204 | |
paul@24 | 205 | front = 2; |
paul@60 | 206 | payload_back = 1; /* in the payload area the thickness is reduced */ |
paul@49 | 207 | connector_back = 3.5; /* the back cavity requires a thicker back wall */ |
paul@24 | 208 | top = 3; |
paul@42 | 209 | side = 2; /* increased from 1.5 for 3D printing reliability */ |
paul@42 | 210 | bottom = 1; /* thickness of floor of payload area */ |
paul@34 | 211 | |
paul@38 | 212 | /* How much extra depth the back provides for mating with the front. */ |
paul@38 | 213 | |
paul@60 | 214 | groove_width_extra = 2.0; /* the depth of the groove accommodating the front rim */ |
paul@42 | 215 | front_back_overlap = 1.0; |
paul@42 | 216 | groove_width_overlap = front_back_overlap + groove_width_extra; |
paul@38 | 217 | |
paul@39 | 218 | /* Division of pieces into front and back, defining the extents. */ |
paul@38 | 219 | |
paul@39 | 220 | int_front_depth = 4.5; |
paul@39 | 221 | front_depth = int_front_depth + front; |
paul@49 | 222 | int_payload_back_depth = int_payload_depth - int_front_depth + front_back_overlap; |
paul@49 | 223 | int_connector_back_depth = int_connector_depth - int_front_depth + front_back_overlap; |
paul@49 | 224 | back_depth = int_payload_back_depth + payload_back; |
paul@38 | 225 | |
paul@38 | 226 | /* Cartridge dimensions. */ |
paul@38 | 227 | |
paul@50 | 228 | payload_width = int_payload_width + side + side; |
paul@70 | 229 | payload_height = top + int_payload_height; |
paul@70 | 230 | |
paul@50 | 231 | connector_width = int_connector_width + side + side; |
paul@49 | 232 | connector_height = bottom + int_connector_height; |
paul@70 | 233 | |
paul@49 | 234 | height = payload_height + bottom + int_connector_height; |
paul@49 | 235 | depth = int_payload_depth + front + payload_back; |
paul@70 | 236 | |
paul@54 | 237 | upper_extent = height / 2; |
paul@54 | 238 | lower_extent = -upper_extent; |
paul@54 | 239 | int_payload_upper_extent = upper_extent - top; |
paul@54 | 240 | int_payload_lower_extent = lower_extent + int_connector_height + bottom; |
paul@38 | 241 | |
paul@70 | 242 | /* Connector extents. */ |
paul@70 | 243 | |
paul@70 | 244 | int_connector_right_extent = int_connector_width / 2; |
paul@70 | 245 | int_connector_left_extent = -int_connector_right_extent; |
paul@70 | 246 | connector_left_extent = int_connector_left_extent - side; |
paul@70 | 247 | connector_right_extent = int_connector_right_extent + side; |
paul@70 | 248 | |
paul@51 | 249 | /* Where the payload is wider than the connector, the payload expands to the left. */ |
paul@51 | 250 | |
paul@70 | 251 | int_payload_right_extent = int_connector_right_extent; |
paul@51 | 252 | int_payload_left_extent = int_payload_right_extent - int_payload_width; |
paul@51 | 253 | payload_left_extent = int_payload_left_extent - side; |
paul@51 | 254 | payload_right_extent = int_payload_right_extent + side; |
paul@51 | 255 | payload_centre = (payload_left_extent + payload_right_extent) / 2; |
paul@51 | 256 | |
paul@38 | 257 | /* Cartridge surfaces. */ |
paul@38 | 258 | |
paul@34 | 259 | front_side = side; |
paul@29 | 260 | front_left = front_side; |
paul@29 | 261 | front_right = front_side; |
paul@34 | 262 | back_side = side; |
paul@29 | 263 | back_left = back_side; |
paul@29 | 264 | back_right = back_side; |
paul@24 | 265 | |
paul@20 | 266 | /* Label details. */ |
paul@1 | 267 | |
paul@50 | 268 | front_label_width = payload_width - side - side - 3.0; |
paul@1 | 269 | front_label_height = 46.0; |
paul@1 | 270 | front_label_depth = 1.0; |
paul@1 | 271 | front_label_offset_from_bottom = 19.5; |
paul@51 | 272 | front_label_centre = payload_centre; |
paul@51 | 273 | front_label_left_extent = front_label_centre - front_label_width / 2; |
paul@3 | 274 | |
paul@1 | 275 | top_label_width = front_label_width; |
paul@20 | 276 | top_label_height = 11.5; /* the height as seen from above */ |
paul@1 | 277 | top_label_depth = front_label_depth; |
paul@1 | 278 | top_label_offset_from_front = 2.5; |
paul@51 | 279 | top_label_centre = payload_centre; |
paul@51 | 280 | top_label_left_extent = top_label_centre - front_label_width / 2; |
paul@3 | 281 | |
paul@41 | 282 | /* |
paul@41 | 283 | The groove around the sides and top. This is extended to allow the |
paul@41 | 284 | pieces to fit together, and this extension is generated regardless of |
paul@41 | 285 | whether the visible groove is enabled or not. |
paul@41 | 286 | */ |
paul@20 | 287 | |
paul@41 | 288 | groove_width_exposed = GROOVE ? 1.5 : 0; |
paul@46 | 289 | groove_width_normal = groove_width_exposed + front_back_overlap; |
paul@8 | 290 | groove_depth = 1.0; /* how deep the groove goes into each side */ |
paul@20 | 291 | |
paul@20 | 292 | /* Additional cutting to mate the back and front. */ |
paul@20 | 293 | |
paul@42 | 294 | top_groove_width = groove_width_overlap; |
paul@8 | 295 | top_groove_depth = 2.0; |
paul@20 | 296 | |
paul@29 | 297 | /* |
paul@29 | 298 | Space for the inner edge of the back inside the front. |
paul@29 | 299 | Offsets are measured from the outside surfaces. |
paul@29 | 300 | */ |
paul@20 | 301 | |
paul@50 | 302 | inner_top_front_cutout_width = int_payload_width; |
paul@30 | 303 | inner_top_front_cutout_depth = top_groove_width; |
paul@30 | 304 | inner_top_front_cutout_height = top - top_groove_depth; |
paul@28 | 305 | |
paul@50 | 306 | inner_payload_front_cutout_height = payload_height - top_groove_depth; |
paul@50 | 307 | inner_payload_front_cutout_width = front_side - groove_depth; |
paul@50 | 308 | inner_payload_front_cutout_depth = groove_width_overlap; |
paul@50 | 309 | |
paul@50 | 310 | inner_connector_front_cutout_height = connector_height; |
paul@50 | 311 | inner_connector_front_cutout_width = front_side - groove_depth; |
paul@50 | 312 | inner_connector_front_cutout_depth = groove_width_overlap; |
paul@1 | 313 | |
paul@35 | 314 | /* |
paul@35 | 315 | The back cavity is the indented part at the bottom of the back of the |
paul@55 | 316 | cartridge. It appears to be mechanically necessary, making sure that |
paul@55 | 317 | cartridges cannot be plugged in the wrong way round. |
paul@35 | 318 | */ |
paul@35 | 319 | |
paul@4 | 320 | back_cavity_width = 68.0; |
paul@4 | 321 | back_cavity_inner_width = 65.0; |
paul@40 | 322 | back_cavity_offset_from_inner_left = 9.0; |
paul@40 | 323 | back_cavity_inner_offset_from_inner_left = 10.5; |
paul@4 | 324 | back_cavity_height = 13.5; |
paul@4 | 325 | back_cavity_inner_height = 12.0; |
paul@4 | 326 | back_cavity_depth = 1.5; |
paul@4 | 327 | |
paul@39 | 328 | /* |
paul@60 | 329 | The effect of the cavity on the inside of the case. In principle, the |
paul@60 | 330 | interior of the case could be straight since the plastic guides of the |
paul@60 | 331 | Plus 1 socket are outside the case. |
paul@39 | 332 | */ |
paul@35 | 333 | |
paul@6 | 334 | inner_back_slope_depth = 2.5; |
paul@40 | 335 | inner_back_slope_width = inner_back_slope_depth; |
paul@40 | 336 | inner_back_slope_max_offset = 10.5; |
paul@40 | 337 | inner_back_slope_min_offset = inner_back_slope_max_offset - inner_back_slope_width; |
paul@5 | 338 | |
paul@40 | 339 | /* The tapering off of the inner back edge. */ |
paul@40 | 340 | |
paul@5 | 341 | inner_back_edge_width = 69.0; |
paul@5 | 342 | inner_back_edge_height = 3.0; |
paul@5 | 343 | inner_back_edge_depth = 1.5; |
paul@5 | 344 | |
paul@40 | 345 | /* The tapering off of the inner front edge. */ |
paul@40 | 346 | |
paul@50 | 347 | inner_front_edge_width = connector_width - front_side * 2; |
paul@7 | 348 | inner_front_edge_height = 3.0; |
paul@7 | 349 | inner_front_edge_depth = 1.5; |
paul@7 | 350 | |
paul@39 | 351 | /* |
paul@39 | 352 | The cutout in the floor of the back of the cartridge that accommodates |
paul@39 | 353 | the edge connector. |
paul@39 | 354 | */ |
paul@39 | 355 | |
paul@8 | 356 | edge_connector_cutout_back_depth = 3.0; |
paul@23 | 357 | edge_connector_cutout_back_width = 57.5; |
paul@8 | 358 | |
paul@17 | 359 | /* |
paul@49 | 360 | The cutouts in the floor of the front of the cartridge that produce a |
paul@49 | 361 | kind of tab that guides the edge connector into place in the back cutout. |
paul@49 | 362 | */ |
paul@49 | 363 | |
paul@49 | 364 | edge_connector_cutout_front_depth = front_back_overlap; |
paul@50 | 365 | edge_connector_cutout_front_width = (int_connector_width - edge_connector_cutout_back_width) / 2; |
paul@49 | 366 | |
paul@49 | 367 | /* |
paul@17 | 368 | Edge connectors are themselves 0.05" or approximately 1.27mm in |
paul@17 | 369 | thickness according to the Acorn Electron Cartridge Interface Specification |
paul@17 | 370 | (Acorn Support Application Group Note 014). |
paul@17 | 371 | */ |
paul@17 | 372 | |
paul@33 | 373 | /* Extra internal features. Depths include front and back surfaces. */ |
paul@14 | 374 | |
paul@23 | 375 | pcb_back_support_width = 1.2; |
paul@14 | 376 | pcb_back_support_depth = back_depth - |
paul@14 | 377 | edge_connector_cutout_back_depth; |
paul@38 | 378 | pcb_back_support_height = height - int_connector_height - top - bottom; |
paul@14 | 379 | |
paul@23 | 380 | pcb_front_support_width = 1.2; |
paul@44 | 381 | pcb_front_support_depth = int_front_depth; |
paul@15 | 382 | pcb_front_support_height = pcb_back_support_height; |
paul@15 | 383 | |
paul@16 | 384 | /* |
paul@45 | 385 | Features measured from the Stardot Dual ROM Adaptor cartridge board |
paul@37 | 386 | dimensions diagram. Offsets are from inside the bottom "floor". |
paul@16 | 387 | */ |
paul@16 | 388 | |
paul@16 | 389 | pcb_back_support_bump_width = pcb_front_support_width; |
paul@18 | 390 | pcb_back_support_bump_depth = 1.5; |
paul@23 | 391 | pcb_back_support_left_bump_height = 13.2; |
paul@23 | 392 | pcb_back_support_right_bump_height = 10.7; |
paul@23 | 393 | pcb_back_support_left_bump_offset_from_bottom = 15.1; |
paul@23 | 394 | pcb_back_support_right_bump_offset_from_bottom = 17.6; |
paul@57 | 395 | |
paul@57 | 396 | /* Configured by SHORT_PCB. */ |
paul@27 | 397 | pcb_back_support_top_bump_height = 3.8; |
paul@16 | 398 | |
paul@24 | 399 | /* Move the PCB support towards the centre. */ |
paul@35 | 400 | pcb_support_margin = 1.75; |
paul@37 | 401 | pcb_support_offset_from_centre = edge_connector_cutout_back_width / 2 |
paul@37 | 402 | - pcb_support_margin; |
paul@24 | 403 | |
paul@60 | 404 | /* |
paul@60 | 405 | The PCB lugs protrude through the holes in the PCB. By extending both |
paul@60 | 406 | the front and back lugs by the depth of the back support bump, they |
paul@60 | 407 | overlap by that amount. The "mating" depth is defined as that amount |
paul@60 | 408 | plus an additional amount for adhesion. |
paul@60 | 409 | */ |
paul@60 | 410 | |
paul@60 | 411 | pcb_lug_mating_depth = pcb_back_support_bump_depth + 1.0; |
paul@60 | 412 | |
paul@25 | 413 | pcb_lug_depth = pcb_back_support_depth + |
paul@60 | 414 | pcb_lug_mating_depth; |
paul@25 | 415 | pcb_lug_inner_radius = 1.0; |
paul@25 | 416 | pcb_lug_outer_radius = 5.5 / 2; |
paul@25 | 417 | pcb_lug_offset_from_bottom = 14.35; |
paul@45 | 418 | pcb_lug_offset_from_inside = 5.55; |
paul@25 | 419 | |
paul@60 | 420 | /* |
paul@60 | 421 | The cross detail on the back lug is intended to resist the front lug, |
paul@60 | 422 | and thus starts at the point that the front lug ends. |
paul@60 | 423 | */ |
paul@60 | 424 | |
paul@25 | 425 | pcb_lug_cross_width = 6.7; |
paul@60 | 426 | pcb_lug_cross_depth = pcb_back_support_depth + pcb_back_support_bump_depth - |
paul@60 | 427 | pcb_lug_mating_depth; |
paul@25 | 428 | pcb_lug_cross_height = 1.4; |
paul@25 | 429 | |
paul@60 | 430 | pcb_front_lug_depth = pcb_front_support_depth + |
paul@60 | 431 | pcb_lug_mating_depth; |
paul@33 | 432 | pcb_front_lug_inner_radius = pcb_lug_outer_radius; |
paul@33 | 433 | pcb_front_lug_outer_radius = pow( |
paul@33 | 434 | pow(pcb_lug_cross_width / 2, 2) + |
paul@33 | 435 | pow(pcb_lug_cross_height / 2, 2), |
paul@33 | 436 | 0.5); |
paul@33 | 437 | |
paul@56 | 438 | wide_pcb_lug_offset_from_inside = 6.0; |
paul@56 | 439 | wide_pcb_lug_offset_from_bottom = 6.0; |
paul@56 | 440 | |
paul@56 | 441 | /* PCBs for checking. */ |
paul@56 | 442 | |
paul@56 | 443 | pcb_width = 84.85; pcb_height = 62.5; pcb_depth = 1; |
paul@56 | 444 | edge_connector_width = 56.5; edge_connector_height = 11.85; |
paul@56 | 445 | |
paul@56 | 446 | /* |
paul@56 | 447 | The rectangular part of the narrow left and right holes is smaller |
paul@56 | 448 | than the "bump" in the case, but the circular parts make the overall |
paul@56 | 449 | hole larger than the "bump". An extra depth is used for holes to avoid |
paul@56 | 450 | surface definition problems. |
paul@56 | 451 | */ |
paul@56 | 452 | |
paul@56 | 453 | pcb_hole_margin = 0.55; |
paul@56 | 454 | pcb_hole_width = 2.2; |
paul@56 | 455 | pcb_hole_extra_depth = 0.1; |
paul@56 | 456 | pcb_lug_hole_radius = 3.75; |
paul@56 | 457 | |
paul@56 | 458 | pcb_left_hole_offset = pcb_back_support_left_bump_offset_from_bottom + pcb_hole_margin; |
paul@56 | 459 | pcb_left_hole_height = pcb_back_support_left_bump_height - pcb_hole_margin * 2; |
paul@58 | 460 | pcb_left_hole_offset_from_centre = -(pcb_support_offset_from_centre + |
paul@58 | 461 | pcb_back_support_width / 2 - pcb_hole_width / 2); |
paul@56 | 462 | |
paul@56 | 463 | pcb_right_hole_offset = pcb_back_support_right_bump_offset_from_bottom + pcb_hole_margin; |
paul@56 | 464 | pcb_right_hole_height = pcb_back_support_right_bump_height - pcb_hole_margin * 2; |
paul@56 | 465 | pcb_right_hole_offset_from_centre = -pcb_left_hole_offset_from_centre; |
paul@56 | 466 | |
paul@56 | 467 | pcb_hole_depth = pcb_depth + 2 * pcb_hole_extra_depth; |
paul@62 | 468 | pcb_hole_start_depth = edge_connector_cutout_back_depth + pcb_hole_extra_depth; |
paul@56 | 469 | |
paul@56 | 470 | wide_pcb_width = 138.0; wide_pcb_height = pcb_height; wide_pcb_depth = pcb_depth; |
paul@56 | 471 | wide_pcb_hole_depth = pcb_hole_depth; |
paul@56 | 472 | wide_pcb_hole_start_depth = pcb_hole_start_depth; |
paul@56 | 473 | |
paul@56 | 474 | wide_pcb_lug_hole_radius = 4.0; |
paul@56 | 475 | |
paul@63 | 476 | /* An example feature for use with PCB testing. */ |
paul@63 | 477 | |
paul@63 | 478 | feature_width = 15.0; feature_depth = 7.0; feature_height = 40.0; |
paul@63 | 479 | feature_height_offset = 10.0; |
paul@63 | 480 | |
paul@25 | 481 | /* Repeated constructs. */ |
paul@25 | 482 | |
paul@26 | 483 | module pcb_support(xdir, bump_height, bump_offset) { |
paul@35 | 484 | |
paul@35 | 485 | /* |
paul@35 | 486 | Translate the support in the stated direction. |
paul@35 | 487 | Since the support is already justified in the direction, the translation |
paul@35 | 488 | moves the inner edge of the support to alignment with the end of the |
paul@35 | 489 | edge connector cutout and then back by the PCB support margin. |
paul@35 | 490 | */ |
paul@35 | 491 | |
paul@25 | 492 | translate([xdir * |
paul@37 | 493 | pcb_support_offset_from_centre, |
paul@25 | 494 | edge_connector_cutout_back_depth, |
paul@45 | 495 | int_payload_lower_extent]) |
paul@25 | 496 | justify(pcb_back_support_width, |
paul@25 | 497 | pcb_back_support_depth, |
paul@25 | 498 | pcb_back_support_height, |
paul@25 | 499 | xdir, 1, 1) |
paul@25 | 500 | union() { |
paul@27 | 501 | |
paul@27 | 502 | /* Underlying support strut. */ |
paul@27 | 503 | |
paul@25 | 504 | cube([pcb_back_support_width, |
paul@25 | 505 | pcb_back_support_depth, |
paul@25 | 506 | pcb_back_support_height], center = true); |
paul@27 | 507 | |
paul@27 | 508 | /* Middle bump. */ |
paul@27 | 509 | |
paul@25 | 510 | cube_at(pcb_back_support_bump_width, |
paul@25 | 511 | pcb_back_support_bump_depth, |
paul@26 | 512 | bump_height, |
paul@25 | 513 | 0, -1, 1, |
paul@25 | 514 | 0, |
paul@25 | 515 | -pcb_back_support_depth / 2, |
paul@26 | 516 | -pcb_back_support_height / 2 + bump_offset); |
paul@27 | 517 | |
paul@27 | 518 | /* Top bump. */ |
paul@27 | 519 | |
paul@57 | 520 | if (SHORT_PCB) |
paul@57 | 521 | cube_at(pcb_back_support_bump_width, |
paul@57 | 522 | pcb_back_support_bump_depth, |
paul@57 | 523 | pcb_back_support_top_bump_height, |
paul@57 | 524 | 0, -1, 1, |
paul@57 | 525 | 0, |
paul@57 | 526 | -pcb_back_support_depth / 2, |
paul@57 | 527 | pcb_back_support_height / 2 - |
paul@57 | 528 | pcb_back_support_top_bump_height); |
paul@25 | 529 | } |
paul@25 | 530 | } |
paul@25 | 531 | |
paul@25 | 532 | module pcb_lug(xdir) { |
paul@56 | 533 | pcb_lug_explicit(xdir, int_connector_width / 2 - pcb_lug_offset_from_inside, |
paul@56 | 534 | pcb_lug_offset_from_bottom); |
paul@56 | 535 | } |
paul@56 | 536 | |
paul@56 | 537 | module pcb_lug_wide(xdir) { |
paul@56 | 538 | pcb_lug_explicit(xdir, int_payload_width / 2 - wide_pcb_lug_offset_from_inside, |
paul@56 | 539 | wide_pcb_lug_offset_from_bottom); |
paul@56 | 540 | pcb_lug_explicit(xdir, int_payload_width / 2 - wide_pcb_lug_offset_from_inside, |
paul@56 | 541 | wide_pcb_height - edge_connector_height - wide_pcb_lug_offset_from_bottom); |
paul@56 | 542 | } |
paul@56 | 543 | |
paul@56 | 544 | module pcb_lug_explicit(xdir, pcb_lug_offset_from_centre, pcb_lug_offset_from_bottom) { |
paul@56 | 545 | translate([payload_centre + xdir * pcb_lug_offset_from_centre, |
paul@25 | 546 | back_depth, |
paul@45 | 547 | int_payload_lower_extent + pcb_lug_offset_from_bottom |
paul@25 | 548 | ]) |
paul@25 | 549 | rotate([90, 0, 0]) |
paul@25 | 550 | difference() { |
paul@56 | 551 | |
paul@56 | 552 | /* Cylinder with cross. */ |
paul@56 | 553 | |
paul@25 | 554 | union() { |
paul@25 | 555 | cylinder(h=pcb_lug_depth, r=pcb_lug_outer_radius); |
paul@25 | 556 | cube_at(pcb_lug_cross_width, |
paul@25 | 557 | pcb_lug_cross_height, pcb_lug_cross_depth, |
paul@25 | 558 | 0, 0, 1, |
paul@25 | 559 | 0, 0, 0); |
paul@25 | 560 | cube_at(pcb_lug_cross_height, |
paul@25 | 561 | pcb_lug_cross_width, pcb_lug_cross_depth, |
paul@25 | 562 | 0, 0, 1, |
paul@25 | 563 | 0, 0, 0); |
paul@25 | 564 | } |
paul@56 | 565 | |
paul@56 | 566 | /* Hollowed out by a cylinder. */ |
paul@56 | 567 | |
paul@25 | 568 | cylinder(h=pcb_lug_depth, r=pcb_lug_inner_radius); |
paul@56 | 569 | |
paul@56 | 570 | /* Tapered off for easier connection. */ |
paul@56 | 571 | |
paul@65 | 572 | if (ROUND_CONNECTING_EDGES) |
paul@65 | 573 | translate([0, 0, pcb_lug_depth - pcb_lug_ro]) |
paul@65 | 574 | fillet_torus(pcb_lug_outer_radius, pcb_lug_rr); |
paul@25 | 575 | } |
paul@25 | 576 | } |
paul@25 | 577 | |
paul@33 | 578 | module pcb_front_lug(xdir) { |
paul@56 | 579 | pcb_front_lug_explicit(xdir, int_connector_width / 2 - pcb_lug_offset_from_inside, |
paul@56 | 580 | pcb_lug_offset_from_bottom); |
paul@56 | 581 | } |
paul@56 | 582 | |
paul@56 | 583 | module pcb_front_lug_wide(xdir) { |
paul@56 | 584 | pcb_front_lug_explicit(xdir, int_payload_width / 2 - wide_pcb_lug_offset_from_inside, |
paul@56 | 585 | wide_pcb_lug_offset_from_bottom); |
paul@56 | 586 | pcb_front_lug_explicit(xdir, int_payload_width / 2 - wide_pcb_lug_offset_from_inside, |
paul@56 | 587 | wide_pcb_height - edge_connector_height - wide_pcb_lug_offset_from_bottom); |
paul@56 | 588 | } |
paul@56 | 589 | |
paul@56 | 590 | module pcb_front_lug_explicit(xdir, pcb_lug_offset_from_centre, pcb_lug_offset_from_bottom) { |
paul@56 | 591 | translate([payload_centre + xdir * pcb_lug_offset_from_centre, |
paul@39 | 592 | -int_front_depth + pcb_front_lug_depth, |
paul@45 | 593 | int_payload_lower_extent + pcb_lug_offset_from_bottom |
paul@33 | 594 | ]) |
paul@33 | 595 | rotate([90, 0, 0]) |
paul@33 | 596 | difference() { |
paul@33 | 597 | cylinder(h=pcb_front_lug_depth, |
paul@33 | 598 | r=pcb_front_lug_outer_radius); |
paul@33 | 599 | cylinder(h=pcb_front_lug_depth, |
paul@33 | 600 | r=pcb_front_lug_inner_radius); |
paul@33 | 601 | } |
paul@33 | 602 | } |
paul@33 | 603 | |
paul@25 | 604 | /* The actual shapes. */ |
paul@25 | 605 | |
paul@68 | 606 | module front_piece(front_displacement, front_displacement_together) { |
paul@68 | 607 | if (FRONT) |
paul@68 | 608 | translate([front_displacement, front_displacement_together, 0]) |
paul@56 | 609 | difference() { |
paul@56 | 610 | |
paul@56 | 611 | /* The cartridge surfaces. */ |
paul@43 | 612 | |
paul@56 | 613 | union() { |
paul@56 | 614 | |
paul@68 | 615 | /* Front portion. */ |
paul@56 | 616 | |
paul@68 | 617 | if (FRONT_SURFACE) { |
paul@56 | 618 | |
paul@56 | 619 | /* Surfaces surrounding the payload. */ |
paul@43 | 620 | |
paul@68 | 621 | cube_at(payload_width, front, payload_height, |
paul@68 | 622 | 0, -1, 1, |
paul@68 | 623 | payload_centre, -int_front_depth, int_payload_lower_extent); |
paul@43 | 624 | |
paul@68 | 625 | cube_at(front_left, front_depth, payload_height, |
paul@68 | 626 | -1, -1, 1, |
paul@56 | 627 | int_payload_left_extent, 0, int_payload_lower_extent); |
paul@49 | 628 | |
paul@68 | 629 | cube_at(front_right, front_depth, payload_height, |
paul@68 | 630 | 1, -1, 1, |
paul@56 | 631 | int_payload_right_extent, 0, int_payload_lower_extent); |
paul@56 | 632 | |
paul@56 | 633 | /* Surfaces surrounding the connector. */ |
paul@50 | 634 | |
paul@68 | 635 | cube_at(connector_width, front, connector_height, |
paul@68 | 636 | 0, -1, -1, |
paul@68 | 637 | 0, -int_front_depth, int_payload_lower_extent); |
paul@49 | 638 | |
paul@68 | 639 | cube_at(front_left, front_depth, connector_height, |
paul@68 | 640 | -1, -1, -1, |
paul@70 | 641 | int_connector_left_extent, 0, int_payload_lower_extent); |
paul@56 | 642 | |
paul@68 | 643 | cube_at(front_right, front_depth, connector_height, |
paul@68 | 644 | 1, -1, -1, |
paul@70 | 645 | int_connector_right_extent, 0, int_payload_lower_extent); |
paul@49 | 646 | |
paul@68 | 647 | /* Top surface for the front piece. */ |
paul@56 | 648 | |
paul@63 | 649 | if (TOP_SURFACE) |
paul@68 | 650 | cube_at(payload_width, front_depth, top, |
paul@68 | 651 | 0, -1, 1, |
paul@63 | 652 | payload_centre, 0, int_payload_upper_extent); |
paul@56 | 653 | } |
paul@46 | 654 | |
paul@46 | 655 | difference() { |
paul@56 | 656 | |
paul@56 | 657 | /* Floor of cartridge. */ |
paul@56 | 658 | |
paul@70 | 659 | if (payload_width > connector_width) { |
paul@70 | 660 | cube_at(payload_width, front_depth, bottom, |
paul@70 | 661 | 1, -1, 1, |
paul@70 | 662 | payload_left_extent, 0, lower_extent + int_connector_height); |
paul@70 | 663 | } else { |
paul@70 | 664 | cube_at(int_connector_width, int_front_depth, bottom, |
paul@70 | 665 | 0, -1, 1, |
paul@70 | 666 | 0, 0, lower_extent + int_connector_height); |
paul@70 | 667 | } |
paul@46 | 668 | |
paul@68 | 669 | /* Left cutout. */ |
paul@68 | 670 | |
paul@68 | 671 | cube_at(edge_connector_cutout_front_width, |
paul@68 | 672 | edge_connector_cutout_front_depth, |
paul@68 | 673 | bottom, |
paul@68 | 674 | 1, -1, 1, |
paul@70 | 675 | int_connector_left_extent, |
paul@68 | 676 | 0, |
paul@68 | 677 | lower_extent + int_connector_height); |
paul@50 | 678 | |
paul@68 | 679 | /* Right cutout. */ |
paul@68 | 680 | |
paul@68 | 681 | cube_at(edge_connector_cutout_front_width, |
paul@68 | 682 | edge_connector_cutout_front_depth, |
paul@56 | 683 | bottom, |
paul@68 | 684 | -1, -1, 1, |
paul@70 | 685 | int_connector_right_extent, |
paul@68 | 686 | 0, |
paul@68 | 687 | lower_extent + int_connector_height); |
paul@50 | 688 | } |
paul@50 | 689 | |
paul@56 | 690 | /* PCB supports. */ |
paul@50 | 691 | |
paul@56 | 692 | if (MODEL == ROM_CARTRIDGE) { |
paul@68 | 693 | cube_at(pcb_front_support_width, |
paul@68 | 694 | pcb_front_support_depth, |
paul@68 | 695 | pcb_front_support_height, |
paul@68 | 696 | -1, -1, 1, |
paul@68 | 697 | -pcb_support_offset_from_centre, |
paul@68 | 698 | 0, |
paul@68 | 699 | int_payload_lower_extent); |
paul@68 | 700 | |
paul@68 | 701 | cube_at(pcb_front_support_width, |
paul@68 | 702 | pcb_front_support_depth, |
paul@68 | 703 | pcb_front_support_height, |
paul@68 | 704 | 1, -1, 1, |
paul@68 | 705 | pcb_support_offset_from_centre, |
paul@68 | 706 | 0, |
paul@68 | 707 | int_payload_lower_extent); |
paul@56 | 708 | |
paul@56 | 709 | /* Circular "lugs" to hold PCBs in place. */ |
paul@56 | 710 | |
paul@68 | 711 | pcb_front_lug(-1); |
paul@68 | 712 | pcb_front_lug(1); |
paul@46 | 713 | } |
paul@46 | 714 | |
paul@56 | 715 | if (MODEL == WIDE_CARTRIDGE) { |
paul@50 | 716 | |
paul@68 | 717 | pcb_front_lug_wide(-1); |
paul@68 | 718 | pcb_front_lug_wide(1); |
paul@46 | 719 | } |
paul@43 | 720 | } |
paul@10 | 721 | |
paul@56 | 722 | /* Label insets. */ |
paul@8 | 723 | |
paul@56 | 724 | union() { |
paul@56 | 725 | |
paul@68 | 726 | /* Front label. */ |
paul@68 | 727 | |
paul@68 | 728 | if (FRONT_LABEL_INSET) |
paul@68 | 729 | translate([front_label_left_extent, -front_depth, |
paul@68 | 730 | lower_extent + front_label_offset_from_bottom]) |
paul@68 | 731 | cube([front_label_width, front_label_depth, |
paul@68 | 732 | front_label_height]); |
paul@68 | 733 | |
paul@68 | 734 | /* Top label. See also the back piece. */ |
paul@8 | 735 | |
paul@56 | 736 | if (TOP_LABEL_INSET) |
paul@56 | 737 | translate([top_label_left_extent, |
paul@56 | 738 | -front_depth + top_label_offset_from_front, |
paul@56 | 739 | upper_extent - top_label_depth]) |
paul@56 | 740 | cube([top_label_width, top_label_height, |
paul@56 | 741 | top_label_depth]); |
paul@56 | 742 | } |
paul@56 | 743 | |
paul@68 | 744 | /* Inner front edge cavity. */ |
paul@43 | 745 | |
paul@68 | 746 | translate([inner_front_edge_width / 2, -int_front_depth, lower_extent]) |
paul@68 | 747 | rotate([0, -90, 0]) |
paul@68 | 748 | linear_extrude(height = inner_front_edge_width) |
paul@68 | 749 | polygon([ |
paul@68 | 750 | [-extra, -inner_front_edge_depth], |
paul@68 | 751 | [0, -inner_front_edge_depth], |
paul@68 | 752 | [inner_front_edge_height, 0], |
paul@68 | 753 | [-extra, 0], |
paul@68 | 754 | ]); |
paul@56 | 755 | |
paul@70 | 756 | /* Inner grooves for the top and sides of the back portion. */ |
paul@56 | 757 | |
paul@68 | 758 | cube_at(inner_top_front_cutout_width, |
paul@68 | 759 | inner_top_front_cutout_depth, |
paul@68 | 760 | inner_top_front_cutout_height, |
paul@68 | 761 | 1, -1, 1, |
paul@68 | 762 | int_payload_left_extent, 0, int_payload_upper_extent); |
paul@56 | 763 | |
paul@68 | 764 | cube_at(inner_payload_front_cutout_width, |
paul@68 | 765 | inner_payload_front_cutout_depth, |
paul@68 | 766 | inner_payload_front_cutout_height, |
paul@68 | 767 | 1, -1, 1, |
paul@68 | 768 | int_payload_right_extent, 0, int_payload_lower_extent); |
paul@56 | 769 | |
paul@68 | 770 | cube_at(inner_payload_front_cutout_width, |
paul@68 | 771 | inner_payload_front_cutout_depth, |
paul@68 | 772 | inner_payload_front_cutout_height, |
paul@68 | 773 | -1, -1, 1, |
paul@68 | 774 | int_payload_left_extent, 0, int_payload_lower_extent); |
paul@43 | 775 | |
paul@69 | 776 | /* Cutout to accept the back connector sides (or the floor of the back piece). */ |
paul@56 | 777 | |
paul@69 | 778 | cube_at(inner_connector_front_cutout_width, |
paul@70 | 779 | BACK_CONNECTOR_SECTION ? inner_connector_front_cutout_depth : edge_connector_cutout_front_depth, |
paul@69 | 780 | BACK_CONNECTOR_SECTION ? inner_connector_front_cutout_height : bottom, |
paul@69 | 781 | 1, -1, -1, |
paul@70 | 782 | int_connector_right_extent, 0, int_payload_lower_extent); |
paul@52 | 783 | |
paul@69 | 784 | cube_at(inner_connector_front_cutout_width, |
paul@70 | 785 | BACK_CONNECTOR_SECTION ? inner_connector_front_cutout_depth : edge_connector_cutout_front_depth, |
paul@69 | 786 | BACK_CONNECTOR_SECTION ? inner_connector_front_cutout_height : bottom, |
paul@69 | 787 | -1, -1, -1, |
paul@70 | 788 | int_connector_left_extent, 0, int_payload_lower_extent); |
paul@56 | 789 | |
paul@56 | 790 | /* Fillets to round off the edges. */ |
paul@56 | 791 | |
paul@56 | 792 | union() { |
paul@65 | 793 | if (ROUND_EDGES) { |
paul@42 | 794 | |
paul@65 | 795 | /* Top left and right rounding. */ |
paul@65 | 796 | |
paul@68 | 797 | translate([payload_left_extent + ro, -front_depth / 2, upper_extent - ro]) |
paul@65 | 798 | rotate([0, 0, 180]) |
paul@65 | 799 | rotate([90, 0, 0]) |
paul@68 | 800 | fillet(rr, front_depth); |
paul@68 | 801 | translate([payload_right_extent - ro, -front_depth / 2, upper_extent - ro]) |
paul@56 | 802 | rotate([90, 0, 0]) |
paul@68 | 803 | fillet(rr, front_depth); |
paul@68 | 804 | |
paul@68 | 805 | /* Top front rounding. */ |
paul@65 | 806 | |
paul@68 | 807 | translate([payload_centre, -front_depth + ro, upper_extent - ro]) |
paul@68 | 808 | rotate([0, 0, 180]) |
paul@68 | 809 | rotate([0, -90, 0]) |
paul@68 | 810 | fillet(rr, payload_width); |
paul@56 | 811 | |
paul@68 | 812 | /* Edge rounding. */ |
paul@65 | 813 | |
paul@68 | 814 | translate([payload_right_extent - ro, -front_depth + ro, int_payload_lower_extent - bottom - extra]) |
paul@68 | 815 | rotate([0, 0, 270]) |
paul@65 | 816 | fillet_justified(rr, payload_height + bottom + extra); |
paul@56 | 817 | |
paul@68 | 818 | translate([payload_left_extent + ro, -front_depth + ro, int_payload_lower_extent - bottom - extra]) |
paul@68 | 819 | rotate([0, 0, 180]) |
paul@68 | 820 | fillet_justified(rr, payload_height + bottom + extra); |
paul@68 | 821 | |
paul@70 | 822 | translate([connector_right_extent - ro, -front_depth + ro, lower_extent]) |
paul@68 | 823 | rotate([0, 0, 270]) |
paul@67 | 824 | fillet_partitioned(rr, connector_height - bottom); |
paul@20 | 825 | |
paul@70 | 826 | translate([connector_left_extent + ro, -front_depth + ro, lower_extent]) |
paul@65 | 827 | rotate([0, 0, 180]) |
paul@68 | 828 | fillet_partitioned(rr, connector_height - bottom); |
paul@65 | 829 | } |
paul@53 | 830 | } |
paul@43 | 831 | } |
paul@68 | 832 | } |
paul@20 | 833 | |
paul@68 | 834 | module back_piece(back_displacement, back_rotation) { |
paul@68 | 835 | if (BACK) |
paul@68 | 836 | translate([back_displacement, 0, 0]) |
paul@68 | 837 | rotate([0, 0, back_rotation]) { |
paul@68 | 838 | difference() { |
paul@68 | 839 | |
paul@68 | 840 | /* The cartridge surfaces. */ |
paul@68 | 841 | |
paul@68 | 842 | union() { |
paul@68 | 843 | |
paul@68 | 844 | /* Back portion. */ |
paul@68 | 845 | |
paul@68 | 846 | if (BACK_SURFACE) { |
paul@68 | 847 | |
paul@68 | 848 | /* Surfaces surrounding the payload. */ |
paul@68 | 849 | |
paul@68 | 850 | /* Payload section of back surface. */ |
paul@68 | 851 | |
paul@68 | 852 | cube_at(payload_width, payload_back, payload_height, |
paul@68 | 853 | 0, 1, 1, |
paul@68 | 854 | payload_centre, int_payload_back_depth, int_payload_lower_extent); |
paul@68 | 855 | |
paul@68 | 856 | cube_at(back_left, back_depth, payload_height, |
paul@68 | 857 | -1, 1, 1, |
paul@68 | 858 | int_payload_left_extent, 0, int_payload_lower_extent); |
paul@68 | 859 | |
paul@68 | 860 | cube_at(back_right, back_depth, payload_height, |
paul@68 | 861 | 1, 1, 1, |
paul@68 | 862 | int_payload_right_extent, 0, int_payload_lower_extent); |
paul@68 | 863 | |
paul@68 | 864 | /* Surfaces surrounding the connector. */ |
paul@43 | 865 | |
paul@68 | 866 | /* Connector section of back surface overlapping the floor. */ |
paul@68 | 867 | |
paul@68 | 868 | if (BACK_CONNECTOR_SECTION) { |
paul@68 | 869 | cube_at(connector_width, connector_back, connector_height, |
paul@68 | 870 | 0, 1, -1, |
paul@68 | 871 | 0, int_connector_back_depth, int_payload_lower_extent); |
paul@68 | 872 | |
paul@68 | 873 | cube_at(back_left, back_depth, connector_height, |
paul@68 | 874 | -1, 1, -1, |
paul@70 | 875 | int_connector_left_extent, 0, int_payload_lower_extent); |
paul@68 | 876 | |
paul@68 | 877 | cube_at(back_right, back_depth, connector_height, |
paul@68 | 878 | 1, 1, -1, |
paul@70 | 879 | int_connector_right_extent, 0, int_payload_lower_extent); |
paul@68 | 880 | } |
paul@68 | 881 | |
paul@68 | 882 | /* Top of back piece. */ |
paul@68 | 883 | |
paul@68 | 884 | if (TOP_SURFACE) |
paul@68 | 885 | cube_at(payload_width, back_depth, top, |
paul@68 | 886 | 0, 1, 1, |
paul@68 | 887 | payload_centre, 0, int_payload_upper_extent); |
paul@68 | 888 | |
paul@68 | 889 | /* |
paul@68 | 890 | The extension of the back to connect with the front. Here, the inside |
paul@68 | 891 | edges are rounded. The outside edges are rounded later. |
paul@68 | 892 | |
paul@68 | 893 | An extra overlapping measure is employed so that the filleting is |
paul@68 | 894 | continuous between the payload and connector portions. On the inside |
paul@68 | 895 | edges, the connector filleting is extended upwards. |
paul@68 | 896 | */ |
paul@68 | 897 | |
paul@68 | 898 | /* Left side of payload. */ |
paul@20 | 899 | |
paul@68 | 900 | difference() { |
paul@68 | 901 | cube_at(back_left - groove_depth, groove_width_extra, inner_payload_front_cutout_height, |
paul@68 | 902 | -1, 1, 1, |
paul@68 | 903 | int_payload_left_extent, -groove_width_extra, int_payload_lower_extent); |
paul@68 | 904 | if (ROUND_CONNECTING_EDGES) |
paul@68 | 905 | translate([int_payload_left_extent - groove_ro, -groove_width_extra + groove_ro, |
paul@68 | 906 | int_payload_lower_extent]) |
paul@68 | 907 | rotate([0, 0, -90]) |
paul@68 | 908 | fillet_justified(groove_rr, inner_payload_front_cutout_height); |
paul@68 | 909 | } |
paul@68 | 910 | |
paul@68 | 911 | /* Right side of payload. */ |
paul@68 | 912 | |
paul@68 | 913 | difference() { |
paul@68 | 914 | cube_at(back_right - groove_depth, groove_width_extra, inner_payload_front_cutout_height, |
paul@68 | 915 | 1, 1, 1, |
paul@68 | 916 | int_payload_right_extent, -groove_width_extra, int_payload_lower_extent); |
paul@68 | 917 | if (ROUND_CONNECTING_EDGES) |
paul@68 | 918 | translate([int_payload_right_extent + groove_ro, -groove_width_extra + groove_ro, |
paul@68 | 919 | int_payload_lower_extent]) |
paul@68 | 920 | rotate([0, 0, 180]) |
paul@68 | 921 | fillet_justified(groove_rr, inner_payload_front_cutout_height); |
paul@68 | 922 | } |
paul@68 | 923 | |
paul@68 | 924 | if (BACK_CONNECTOR_SECTION) { |
paul@68 | 925 | |
paul@70 | 926 | /* Left side of connector (or floor extension). */ |
paul@63 | 927 | |
paul@68 | 928 | difference() { |
paul@68 | 929 | cube_at(back_left - groove_depth, groove_width_extra, |
paul@68 | 930 | inner_connector_front_cutout_height, |
paul@68 | 931 | -1, 1, -1, |
paul@70 | 932 | int_connector_left_extent, -groove_width_extra, int_payload_lower_extent); |
paul@68 | 933 | if (ROUND_CONNECTING_EDGES) |
paul@70 | 934 | translate([int_connector_left_extent - groove_ro, |
paul@68 | 935 | -groove_width_extra + groove_ro, |
paul@68 | 936 | lower_extent]) |
paul@68 | 937 | rotate([0, 0, -90]) |
paul@68 | 938 | fillet_partitioned(groove_rr, |
paul@68 | 939 | inner_connector_front_cutout_height + extra); |
paul@68 | 940 | } |
paul@68 | 941 | |
paul@70 | 942 | /* Right side of connector (or floor extension). */ |
paul@63 | 943 | |
paul@68 | 944 | difference() { |
paul@68 | 945 | cube_at(back_right - groove_depth, groove_width_extra, |
paul@68 | 946 | inner_connector_front_cutout_height, |
paul@68 | 947 | 1, 1, -1, |
paul@70 | 948 | int_connector_right_extent, -groove_width_extra, int_payload_lower_extent); |
paul@68 | 949 | if (ROUND_CONNECTING_EDGES) |
paul@70 | 950 | translate([int_connector_right_extent + groove_ro, |
paul@68 | 951 | -groove_width_extra + groove_ro, |
paul@68 | 952 | lower_extent]) |
paul@68 | 953 | rotate([0, 0, 180]) |
paul@68 | 954 | fillet_partitioned(groove_rr, |
paul@68 | 955 | inner_connector_front_cutout_height + extra); |
paul@68 | 956 | } |
paul@68 | 957 | } |
paul@68 | 958 | |
paul@68 | 959 | /* Top side. */ |
paul@68 | 960 | |
paul@68 | 961 | difference() { |
paul@68 | 962 | cube_at(payload_width - groove_depth * 2, groove_width_extra, top - top_groove_depth, |
paul@68 | 963 | 0, 1, 1, |
paul@68 | 964 | payload_centre, -groove_width_extra, int_payload_upper_extent); |
paul@68 | 965 | if (ROUND_CONNECTING_EDGES) |
paul@68 | 966 | translate([payload_centre, -groove_width_extra + groove_ro, |
paul@68 | 967 | int_payload_upper_extent + groove_ro]) |
paul@68 | 968 | rotate([0, 0, 180]) |
paul@68 | 969 | rotate([0, 90, 0]) |
paul@68 | 970 | fillet(groove_rr, payload_width - groove_depth * 2); |
paul@68 | 971 | } |
paul@56 | 972 | } |
paul@14 | 973 | |
paul@68 | 974 | difference() { |
paul@68 | 975 | |
paul@68 | 976 | /* Floor of cartridge. */ |
paul@68 | 977 | |
paul@70 | 978 | if (payload_width > connector_width) { |
paul@70 | 979 | |
paul@70 | 980 | difference() { |
paul@70 | 981 | cube_at(payload_width, back_depth, bottom, |
paul@70 | 982 | 1, 1, 1, |
paul@70 | 983 | payload_left_extent, 0, lower_extent + int_connector_height); |
paul@70 | 984 | |
paul@70 | 985 | /* Cut out the floor to provide a tab. */ |
paul@70 | 986 | |
paul@70 | 987 | cube_at(payload_width - connector_width + groove_depth, |
paul@70 | 988 | edge_connector_cutout_front_depth, bottom, |
paul@70 | 989 | 1, 1, 1, |
paul@70 | 990 | payload_left_extent, 0, lower_extent + int_connector_height); |
paul@70 | 991 | } |
paul@70 | 992 | |
paul@70 | 993 | } else { |
paul@70 | 994 | cube_at(connector_width, back_depth, bottom, |
paul@70 | 995 | 0, 1, 1, |
paul@70 | 996 | 0, 0, lower_extent + int_connector_height); |
paul@70 | 997 | } |
paul@1 | 998 | |
paul@68 | 999 | /* Edge connector cutout. */ |
paul@68 | 1000 | |
paul@68 | 1001 | cube_at(edge_connector_cutout_back_width, |
paul@68 | 1002 | edge_connector_cutout_back_depth, |
paul@68 | 1003 | bottom, |
paul@68 | 1004 | 0, 1, 1, |
paul@68 | 1005 | 0, 0, lower_extent + int_connector_height); |
paul@56 | 1006 | } |
paul@8 | 1007 | |
paul@68 | 1008 | /* PCB supports. */ |
paul@68 | 1009 | |
paul@68 | 1010 | if (MODEL == ROM_CARTRIDGE) { |
paul@68 | 1011 | pcb_support(-1, pcb_back_support_left_bump_height, |
paul@68 | 1012 | pcb_back_support_left_bump_offset_from_bottom); |
paul@68 | 1013 | pcb_support(1, pcb_back_support_right_bump_height, |
paul@68 | 1014 | pcb_back_support_right_bump_offset_from_bottom); |
paul@68 | 1015 | |
paul@68 | 1016 | /* Circular "lugs" to hold PCBs in place. */ |
paul@68 | 1017 | |
paul@68 | 1018 | pcb_lug(-1); |
paul@68 | 1019 | pcb_lug(1); |
paul@56 | 1020 | } |
paul@4 | 1021 | |
paul@68 | 1022 | if (MODEL == WIDE_CARTRIDGE) { |
paul@68 | 1023 | |
paul@68 | 1024 | pcb_lug_wide(1); |
paul@68 | 1025 | pcb_lug_wide(-1); |
paul@68 | 1026 | } |
paul@68 | 1027 | } |
paul@68 | 1028 | |
paul@68 | 1029 | /* Label insets. */ |
paul@68 | 1030 | |
paul@68 | 1031 | union() { |
paul@68 | 1032 | |
paul@68 | 1033 | /* Top label. See also the front piece. */ |
paul@4 | 1034 | |
paul@68 | 1035 | if (TOP_LABEL_INSET) |
paul@68 | 1036 | translate([top_label_left_extent, |
paul@68 | 1037 | -front_depth + top_label_offset_from_front, |
paul@68 | 1038 | upper_extent - top_label_depth]) |
paul@68 | 1039 | cube([top_label_width, top_label_height, |
paul@68 | 1040 | top_label_depth]); |
paul@68 | 1041 | } |
paul@68 | 1042 | |
paul@68 | 1043 | /* Top and side grooves, positioned in the back portion. */ |
paul@68 | 1044 | |
paul@68 | 1045 | union() { |
paul@68 | 1046 | |
paul@70 | 1047 | /* |
paul@70 | 1048 | Grooves are separated to permit a discontinuity with the |
paul@70 | 1049 | wide cartridge and for control over the back section. |
paul@70 | 1050 | */ |
paul@68 | 1051 | |
paul@70 | 1052 | cube_at(groove_depth, groove_width_normal, payload_height + bottom, |
paul@70 | 1053 | 1, 1, -1, |
paul@70 | 1054 | payload_left_extent, 0, upper_extent); |
paul@70 | 1055 | |
paul@70 | 1056 | if (BACK_CONNECTOR_SECTION) |
paul@70 | 1057 | cube_at(groove_depth, groove_width_normal, connector_height, |
paul@70 | 1058 | 1, 1, 1, |
paul@70 | 1059 | connector_left_extent, 0, lower_extent); |
paul@68 | 1060 | |
paul@68 | 1061 | /* Right groove. */ |
paul@56 | 1062 | |
paul@68 | 1063 | cube_at(groove_depth, groove_width_normal, height, |
paul@68 | 1064 | -1, 1, 0, |
paul@68 | 1065 | payload_right_extent, 0, 0); |
paul@68 | 1066 | |
paul@70 | 1067 | if (BACK_CONNECTOR_SECTION) |
paul@70 | 1068 | cube_at(groove_depth, groove_width_normal, connector_height, |
paul@70 | 1069 | -1, 1, 1, |
paul@70 | 1070 | connector_right_extent, 0, lower_extent); |
paul@70 | 1071 | |
paul@68 | 1072 | /* Top grooves. */ |
paul@68 | 1073 | |
paul@68 | 1074 | cube_at(payload_width, groove_width_normal, groove_depth, |
paul@68 | 1075 | 0, 1, -1, |
paul@68 | 1076 | payload_centre, 0, upper_extent); |
paul@68 | 1077 | |
paul@68 | 1078 | cube_at(payload_width, top_groove_width, top_groove_depth, |
paul@68 | 1079 | 0, 1, -1, |
paul@68 | 1080 | payload_centre, -groove_width_extra, upper_extent); |
paul@56 | 1081 | } |
paul@68 | 1082 | |
paul@68 | 1083 | if (BACK_CONNECTOR_SECTION) { |
paul@68 | 1084 | |
paul@68 | 1085 | /* Back cavity. */ |
paul@68 | 1086 | |
paul@68 | 1087 | if (BACK_CAVITY) |
paul@68 | 1088 | intersection() { |
paul@68 | 1089 | |
paul@68 | 1090 | /* From the bottom upwards. */ |
paul@68 | 1091 | |
paul@68 | 1092 | translate([0, back_depth, lower_extent]) |
paul@68 | 1093 | linear_extrude(height = back_cavity_height) |
paul@70 | 1094 | translate([int_connector_left_extent, 0, 0]) |
paul@68 | 1095 | polygon([ |
paul@68 | 1096 | [back_cavity_offset_from_inner_left, 0], |
paul@68 | 1097 | [back_cavity_inner_offset_from_inner_left, |
paul@68 | 1098 | -back_cavity_depth], |
paul@68 | 1099 | [back_cavity_inner_offset_from_inner_left + |
paul@68 | 1100 | back_cavity_inner_width, |
paul@68 | 1101 | -back_cavity_depth], |
paul@68 | 1102 | [back_cavity_offset_from_inner_left + |
paul@68 | 1103 | back_cavity_width, 0] |
paul@68 | 1104 | ]); |
paul@68 | 1105 | |
paul@68 | 1106 | /* From left to right. */ |
paul@2 | 1107 | |
paul@68 | 1108 | translate([back_cavity_width / 2, back_depth, lower_extent]) |
paul@68 | 1109 | rotate([0, -90, 0]) |
paul@68 | 1110 | linear_extrude(height = back_cavity_width) |
paul@68 | 1111 | polygon([ |
paul@68 | 1112 | [-extra, -back_cavity_depth], |
paul@68 | 1113 | [back_cavity_inner_height, |
paul@68 | 1114 | -back_cavity_depth], |
paul@68 | 1115 | [back_cavity_height, 0], |
paul@68 | 1116 | [-extra, 0] |
paul@68 | 1117 | ]); |
paul@68 | 1118 | } |
paul@68 | 1119 | |
paul@68 | 1120 | /* Inner back cavities. */ |
paul@5 | 1121 | |
paul@68 | 1122 | translate([0, int_connector_back_depth, lower_extent]) |
paul@68 | 1123 | linear_extrude(height = int_connector_height) |
paul@70 | 1124 | translate([int_connector_left_extent, 0, 0]) |
paul@68 | 1125 | polygon([ |
paul@68 | 1126 | [0, 0], |
paul@68 | 1127 | [inner_back_slope_max_offset, 0], |
paul@68 | 1128 | [inner_back_slope_min_offset, |
paul@68 | 1129 | inner_back_slope_depth], |
paul@68 | 1130 | [0, inner_back_slope_depth] |
paul@68 | 1131 | ]); |
paul@68 | 1132 | |
paul@68 | 1133 | translate([0, int_connector_back_depth, lower_extent]) |
paul@68 | 1134 | linear_extrude(height = int_connector_height) |
paul@70 | 1135 | translate([int_connector_right_extent, 0, 0]) |
paul@68 | 1136 | polygon([ |
paul@68 | 1137 | [0, 0], |
paul@68 | 1138 | [-inner_back_slope_max_offset, 0], |
paul@68 | 1139 | [-inner_back_slope_min_offset, |
paul@68 | 1140 | inner_back_slope_depth], |
paul@68 | 1141 | [0, inner_back_slope_depth] |
paul@68 | 1142 | ]); |
paul@68 | 1143 | |
paul@68 | 1144 | /* Inner back edge cavity. */ |
paul@5 | 1145 | |
paul@68 | 1146 | translate([inner_back_edge_width / 2, |
paul@68 | 1147 | int_connector_back_depth + inner_back_edge_depth, lower_extent]) |
paul@68 | 1148 | rotate([0, -90, 0]) |
paul@68 | 1149 | linear_extrude(height = inner_back_edge_width) |
paul@68 | 1150 | polygon([ |
paul@68 | 1151 | [-extra, -inner_back_edge_depth], |
paul@68 | 1152 | [inner_back_edge_height, -inner_back_edge_depth], |
paul@68 | 1153 | [0, 0], |
paul@68 | 1154 | [-extra, 0] |
paul@68 | 1155 | ]); |
paul@68 | 1156 | } |
paul@68 | 1157 | |
paul@68 | 1158 | /* Fillets to round off the edges. */ |
paul@68 | 1159 | |
paul@68 | 1160 | union() { |
paul@68 | 1161 | if (ROUND_EDGES) { |
paul@63 | 1162 | |
paul@68 | 1163 | /* Top left and right rounding. */ |
paul@68 | 1164 | |
paul@68 | 1165 | translate([payload_left_extent + ro, back_depth / 2, upper_extent - ro]) |
paul@68 | 1166 | rotate([0, 0, 180]) |
paul@68 | 1167 | rotate([90, 0, 0]) |
paul@68 | 1168 | fillet(rr, back_depth); |
paul@68 | 1169 | translate([payload_right_extent - ro, back_depth / 2, upper_extent - ro]) |
paul@68 | 1170 | rotate([90, 0, 0]) |
paul@68 | 1171 | fillet(rr, back_depth); |
paul@68 | 1172 | |
paul@68 | 1173 | /* Top back rounding. */ |
paul@68 | 1174 | |
paul@68 | 1175 | translate([payload_centre, back_depth - ro, upper_extent - ro]) |
paul@68 | 1176 | rotate([0, -90, 0]) |
paul@68 | 1177 | fillet(rr, payload_width); |
paul@63 | 1178 | |
paul@68 | 1179 | /* Outer edge rounding. */ |
paul@68 | 1180 | |
paul@68 | 1181 | translate([payload_right_extent - ro, back_depth - ro, int_payload_lower_extent - bottom - extra]) |
paul@68 | 1182 | fillet_justified(rr, payload_height + bottom + extra); |
paul@68 | 1183 | |
paul@68 | 1184 | translate([payload_left_extent + ro, back_depth - ro, int_payload_lower_extent - bottom - extra]) |
paul@68 | 1185 | rotate([0, 0, 90]) |
paul@68 | 1186 | fillet_justified(rr, payload_height + bottom + extra); |
paul@68 | 1187 | |
paul@68 | 1188 | if (BACK_CONNECTOR_SECTION) { |
paul@70 | 1189 | translate([connector_right_extent - ro, back_depth - ro, lower_extent]) |
paul@68 | 1190 | fillet_partitioned(rr, connector_height - bottom); |
paul@68 | 1191 | |
paul@70 | 1192 | translate([connector_left_extent + ro, back_depth - ro, lower_extent]) |
paul@68 | 1193 | rotate([0, 0, 90]) |
paul@68 | 1194 | fillet_partitioned(rr, connector_height - bottom); |
paul@68 | 1195 | } |
paul@56 | 1196 | } |
paul@5 | 1197 | |
paul@68 | 1198 | if (ROUND_CONNECTING_EDGES) { |
paul@68 | 1199 | |
paul@68 | 1200 | /* |
paul@68 | 1201 | Outer edge rounding of the back extension. This is done as a |
paul@68 | 1202 | separate removal operation rather than occurring when creating the |
paul@68 | 1203 | extension in order to ensure that the edges are actually rounded. |
paul@68 | 1204 | |
paul@68 | 1205 | An extra overlapping measure is employed so that the filleting is |
paul@68 | 1206 | continuous between the payload and connector portions. On the outside |
paul@68 | 1207 | edges, the payload filleting is extended downwards. |
paul@68 | 1208 | */ |
paul@68 | 1209 | |
paul@68 | 1210 | translate([payload_left_extent + groove_depth + groove_ro, -groove_width_extra + groove_ro, |
paul@68 | 1211 | int_payload_lower_extent - extra]) |
paul@68 | 1212 | rotate([0, 0, 180]) |
paul@68 | 1213 | fillet_justified(groove_rr, inner_payload_front_cutout_height + extra); |
paul@68 | 1214 | |
paul@68 | 1215 | translate([payload_right_extent - groove_depth - groove_ro, -groove_width_extra + groove_ro, |
paul@68 | 1216 | int_payload_lower_extent - extra]) |
paul@68 | 1217 | rotate([0, 0, -90]) |
paul@68 | 1218 | fillet_justified(groove_rr, inner_payload_front_cutout_height + extra); |
paul@68 | 1219 | |
paul@68 | 1220 | /* Sides of connector. */ |
paul@68 | 1221 | |
paul@70 | 1222 | translate([connector_left_extent + groove_depth + groove_ro, -groove_width_extra + groove_ro, |
paul@68 | 1223 | lower_extent]) |
paul@68 | 1224 | rotate([0, 0, 180]) |
paul@68 | 1225 | fillet_partitioned(groove_rr, inner_connector_front_cutout_height); |
paul@68 | 1226 | |
paul@70 | 1227 | translate([connector_right_extent - groove_depth - groove_ro, -groove_width_extra + groove_ro, |
paul@68 | 1228 | lower_extent]) |
paul@68 | 1229 | rotate([0, 0, -90]) |
paul@68 | 1230 | fillet_partitioned(groove_rr, inner_connector_front_cutout_height); |
paul@68 | 1231 | |
paul@68 | 1232 | /* Top of payload. */ |
paul@43 | 1233 | |
paul@68 | 1234 | translate([payload_centre, -groove_width_extra + groove_ro, |
paul@68 | 1235 | int_payload_upper_extent + inner_top_front_cutout_height - groove_ro]) |
paul@68 | 1236 | rotate([0, 0, 180]) |
paul@68 | 1237 | rotate([0, -90, 0]) |
paul@68 | 1238 | fillet(groove_rr, payload_width - groove_depth * 2); |
paul@68 | 1239 | } |
paul@68 | 1240 | } |
paul@68 | 1241 | } |
paul@68 | 1242 | |
paul@68 | 1243 | /* PCBs for checking. */ |
paul@68 | 1244 | |
paul@68 | 1245 | if (PCB) if (MODEL == ROM_CARTRIDGE) { |
paul@68 | 1246 | translate([0, 0, int_payload_lower_extent]) |
paul@68 | 1247 | difference() { |
paul@68 | 1248 | |
paul@68 | 1249 | /* Mock PCB. */ |
paul@43 | 1250 | |
paul@68 | 1251 | union() { |
paul@68 | 1252 | cube_at(pcb_width, pcb_depth, |
paul@68 | 1253 | pcb_height - edge_connector_height, |
paul@68 | 1254 | 0, -1, 1, |
paul@68 | 1255 | 0, edge_connector_cutout_back_depth, 0); |
paul@68 | 1256 | cube_at(edge_connector_width, pcb_depth, |
paul@68 | 1257 | edge_connector_height, |
paul@68 | 1258 | 0, -1, -1, |
paul@68 | 1259 | 0, edge_connector_cutout_back_depth, 0); |
paul@68 | 1260 | |
paul@68 | 1261 | /* Feature. */ |
paul@68 | 1262 | |
paul@68 | 1263 | cube_at(feature_width, feature_depth, feature_height, |
paul@68 | 1264 | 0, 1, 1, |
paul@68 | 1265 | 0, edge_connector_cutout_back_depth, feature_height_offset); |
paul@68 | 1266 | } |
paul@68 | 1267 | |
paul@68 | 1268 | /* Holes for mounting. */ |
paul@68 | 1269 | |
paul@68 | 1270 | union() { |
paul@68 | 1271 | cube_at(pcb_hole_width, pcb_hole_depth, pcb_left_hole_height, |
paul@68 | 1272 | -1, -1, 1, |
paul@68 | 1273 | pcb_left_hole_offset_from_centre, pcb_hole_start_depth, |
paul@68 | 1274 | pcb_left_hole_offset); |
paul@68 | 1275 | translate([pcb_left_hole_offset_from_centre - |
paul@68 | 1276 | pcb_hole_width / 2, pcb_hole_start_depth, pcb_left_hole_offset]) |
paul@68 | 1277 | rotate([90, 0, 0]) |
paul@68 | 1278 | cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2); |
paul@68 | 1279 | translate([pcb_left_hole_offset_from_centre - |
paul@68 | 1280 | pcb_hole_width / 2, pcb_hole_start_depth, |
paul@68 | 1281 | pcb_left_hole_offset + pcb_left_hole_height]) |
paul@68 | 1282 | rotate([90, 0, 0]) |
paul@68 | 1283 | cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2); |
paul@68 | 1284 | } |
paul@50 | 1285 | |
paul@68 | 1286 | union() { |
paul@68 | 1287 | cube_at(pcb_hole_width, pcb_hole_depth, pcb_right_hole_height, |
paul@68 | 1288 | 1, -1, 1, |
paul@68 | 1289 | pcb_right_hole_offset_from_centre, pcb_hole_start_depth, |
paul@68 | 1290 | pcb_right_hole_offset); |
paul@68 | 1291 | translate([pcb_right_hole_offset_from_centre + |
paul@68 | 1292 | pcb_hole_width / 2, pcb_hole_start_depth, pcb_right_hole_offset]) |
paul@68 | 1293 | rotate([90, 0, 0]) |
paul@68 | 1294 | cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2); |
paul@68 | 1295 | translate([pcb_right_hole_offset_from_centre + |
paul@68 | 1296 | pcb_hole_width / 2, pcb_hole_start_depth, |
paul@68 | 1297 | pcb_right_hole_offset + pcb_right_hole_height]) |
paul@68 | 1298 | rotate([90, 0, 0]) |
paul@68 | 1299 | cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2); |
paul@68 | 1300 | } |
paul@68 | 1301 | |
paul@68 | 1302 | /* Holes for lugs. */ |
paul@68 | 1303 | |
paul@68 | 1304 | translate([ |
paul@70 | 1305 | int_connector_left_extent + pcb_lug_offset_from_inside, |
paul@68 | 1306 | pcb_hole_start_depth, pcb_lug_offset_from_bottom]) |
paul@68 | 1307 | rotate([90, 0, 0]) |
paul@68 | 1308 | cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius); |
paul@68 | 1309 | |
paul@68 | 1310 | translate([ |
paul@70 | 1311 | int_connector_right_extent - pcb_lug_offset_from_inside, |
paul@68 | 1312 | pcb_hole_start_depth, pcb_lug_offset_from_bottom]) |
paul@68 | 1313 | rotate([90, 0, 0]) |
paul@68 | 1314 | cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius); |
paul@68 | 1315 | } |
paul@68 | 1316 | } |
paul@68 | 1317 | |
paul@68 | 1318 | if (PCB) if (MODEL == WIDE_CARTRIDGE) { |
paul@68 | 1319 | translate([0, 0, int_payload_lower_extent]) |
paul@68 | 1320 | difference() { |
paul@68 | 1321 | |
paul@68 | 1322 | /* Mock PCB. */ |
paul@68 | 1323 | |
paul@68 | 1324 | union() { |
paul@68 | 1325 | cube_at(wide_pcb_width, wide_pcb_depth, |
paul@68 | 1326 | wide_pcb_height - edge_connector_height, |
paul@68 | 1327 | 0, -1, 1, |
paul@68 | 1328 | payload_centre, edge_connector_cutout_back_depth, 0); |
paul@68 | 1329 | cube_at(edge_connector_width, wide_pcb_depth, |
paul@68 | 1330 | edge_connector_height, |
paul@68 | 1331 | 0, -1, -1, |
paul@68 | 1332 | 0, edge_connector_cutout_back_depth, 0); |
paul@68 | 1333 | |
paul@68 | 1334 | /* Feature. */ |
paul@50 | 1335 | |
paul@68 | 1336 | cube_at(feature_width, feature_depth, feature_height, |
paul@68 | 1337 | 0, 1, 1, |
paul@68 | 1338 | 0, edge_connector_cutout_back_depth, feature_height_offset); |
paul@68 | 1339 | } |
paul@68 | 1340 | |
paul@68 | 1341 | /* Holes for lugs. */ |
paul@68 | 1342 | |
paul@68 | 1343 | translate([ |
paul@68 | 1344 | payload_centre + int_payload_width / 2 - wide_pcb_lug_offset_from_inside , |
paul@68 | 1345 | wide_pcb_hole_start_depth, |
paul@68 | 1346 | wide_pcb_height - edge_connector_height - wide_pcb_lug_offset_from_bottom]) |
paul@68 | 1347 | rotate([90, 0, 0]) |
paul@68 | 1348 | cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius); |
paul@68 | 1349 | |
paul@68 | 1350 | translate([ |
paul@68 | 1351 | payload_centre - int_payload_width / 2 + wide_pcb_lug_offset_from_inside , |
paul@68 | 1352 | wide_pcb_hole_start_depth, |
paul@68 | 1353 | wide_pcb_height - edge_connector_height - wide_pcb_lug_offset_from_bottom]) |
paul@68 | 1354 | rotate([90, 0, 0]) |
paul@68 | 1355 | cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius); |
paul@68 | 1356 | |
paul@68 | 1357 | translate([ |
paul@68 | 1358 | payload_centre + int_payload_width / 2 - wide_pcb_lug_offset_from_inside , |
paul@68 | 1359 | wide_pcb_hole_start_depth, |
paul@68 | 1360 | wide_pcb_lug_offset_from_bottom]) |
paul@68 | 1361 | rotate([90, 0, 0]) |
paul@68 | 1362 | cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius); |
paul@68 | 1363 | |
paul@68 | 1364 | translate([ |
paul@68 | 1365 | payload_centre - int_payload_width / 2 + wide_pcb_lug_offset_from_inside , |
paul@68 | 1366 | wide_pcb_hole_start_depth, |
paul@68 | 1367 | wide_pcb_lug_offset_from_bottom]) |
paul@68 | 1368 | rotate([90, 0, 0]) |
paul@68 | 1369 | cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius); |
paul@68 | 1370 | } |
paul@68 | 1371 | } |
paul@43 | 1372 | } |
paul@68 | 1373 | } |
paul@68 | 1374 | |
paul@68 | 1375 | /* |
paul@68 | 1376 | Place the back piece next to the front, with the internals facing out |
paul@68 | 1377 | the same way, if APART is defined. |
paul@68 | 1378 | */ |
paul@68 | 1379 | |
paul@70 | 1380 | front_displacement_together = CLOSED ? front_back_overlap : front_back_overlap - SPACE_APART; |
paul@68 | 1381 | front_displacement = APART ? -connector_width * 0.6 : 0; |
paul@68 | 1382 | back_displacement = APART ? connector_width * 0.6 : 0; |
paul@68 | 1383 | back_rotation = APART ? 180 : 0; |
paul@68 | 1384 | |
paul@68 | 1385 | if (INTERSECT) { |
paul@68 | 1386 | intersection() { |
paul@68 | 1387 | front_piece(0, front_displacement_together); |
paul@68 | 1388 | back_piece(0, 0); |
paul@0 | 1389 | } |
paul@68 | 1390 | } else { |
paul@68 | 1391 | front_piece(front_displacement, front_displacement_together); |
paul@68 | 1392 | back_piece(back_displacement, back_rotation); |
paul@68 | 1393 | } |
paul@0 | 1394 | } |
paul@0 | 1395 | |
paul@38 | 1396 | cartridge(); |