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