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