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