1.1 --- a/cartridge.scad Sun Apr 10 19:02:37 2016 +0200
1.2 +++ b/cartridge.scad Mon Apr 11 12:52:23 2016 +0200
1.3 @@ -76,6 +76,7 @@
1.4 /* For printing: APART = 1; PCB = 0; */
1.5
1.6 APART = 1;
1.7 + SPACE_APART = 10;
1.8 PCB = 0;
1.9
1.10 /* To check overlaps: INTERSECT = 1; CLOSED = 1; */
1.11 @@ -225,19 +226,29 @@
1.12 /* Cartridge dimensions. */
1.13
1.14 payload_width = int_payload_width + side + side;
1.15 + payload_height = top + int_payload_height;
1.16 +
1.17 connector_width = int_connector_width + side + side;
1.18 - payload_height = top + int_payload_height;
1.19 connector_height = bottom + int_connector_height;
1.20 +
1.21 height = payload_height + bottom + int_connector_height;
1.22 depth = int_payload_depth + front + payload_back;
1.23 +
1.24 upper_extent = height / 2;
1.25 lower_extent = -upper_extent;
1.26 int_payload_upper_extent = upper_extent - top;
1.27 int_payload_lower_extent = lower_extent + int_connector_height + bottom;
1.28
1.29 + /* Connector extents. */
1.30 +
1.31 + int_connector_right_extent = int_connector_width / 2;
1.32 + int_connector_left_extent = -int_connector_right_extent;
1.33 + connector_left_extent = int_connector_left_extent - side;
1.34 + connector_right_extent = int_connector_right_extent + side;
1.35 +
1.36 /* Where the payload is wider than the connector, the payload expands to the left. */
1.37
1.38 - int_payload_right_extent = int_connector_width / 2;
1.39 + int_payload_right_extent = int_connector_right_extent;
1.40 int_payload_left_extent = int_payload_right_extent - int_payload_width;
1.41 payload_left_extent = int_payload_left_extent - side;
1.42 payload_right_extent = int_payload_right_extent + side;
1.43 @@ -627,11 +638,11 @@
1.44
1.45 cube_at(front_left, front_depth, connector_height,
1.46 -1, -1, -1,
1.47 - -int_connector_width / 2, 0, int_payload_lower_extent);
1.48 + int_connector_left_extent, 0, int_payload_lower_extent);
1.49
1.50 cube_at(front_right, front_depth, connector_height,
1.51 1, -1, -1,
1.52 - int_connector_width / 2, 0, int_payload_lower_extent);
1.53 + int_connector_right_extent, 0, int_payload_lower_extent);
1.54
1.55 /* Top surface for the front piece. */
1.56
1.57 @@ -645,9 +656,15 @@
1.58
1.59 /* Floor of cartridge. */
1.60
1.61 - cube_at(int_connector_width, int_front_depth, bottom,
1.62 - 0, -1, 1,
1.63 - 0, 0, lower_extent + int_connector_height);
1.64 + if (payload_width > connector_width) {
1.65 + cube_at(payload_width, front_depth, bottom,
1.66 + 1, -1, 1,
1.67 + payload_left_extent, 0, lower_extent + int_connector_height);
1.68 + } else {
1.69 + cube_at(int_connector_width, int_front_depth, bottom,
1.70 + 0, -1, 1,
1.71 + 0, 0, lower_extent + int_connector_height);
1.72 + }
1.73
1.74 /* Left cutout. */
1.75
1.76 @@ -655,7 +672,7 @@
1.77 edge_connector_cutout_front_depth,
1.78 bottom,
1.79 1, -1, 1,
1.80 - -int_connector_width / 2,
1.81 + int_connector_left_extent,
1.82 0,
1.83 lower_extent + int_connector_height);
1.84
1.85 @@ -665,20 +682,11 @@
1.86 edge_connector_cutout_front_depth,
1.87 bottom,
1.88 -1, -1, 1,
1.89 - int_connector_width / 2,
1.90 + int_connector_right_extent,
1.91 0,
1.92 lower_extent + int_connector_height);
1.93 }
1.94
1.95 - /* Extended floor. */
1.96 -
1.97 - if (payload_width > connector_width) {
1.98 -
1.99 - cube_at(payload_width - connector_width, front_depth, bottom,
1.100 - 1, -1, 1,
1.101 - payload_left_extent, 0, lower_extent + int_connector_height);
1.102 - }
1.103 -
1.104 /* PCB supports. */
1.105
1.106 if (MODEL == ROM_CARTRIDGE) {
1.107 @@ -745,7 +753,7 @@
1.108 [-extra, 0],
1.109 ]);
1.110
1.111 - /* Inner top cutout for the top and sides of the back portion. */
1.112 + /* Inner grooves for the top and sides of the back portion. */
1.113
1.114 cube_at(inner_top_front_cutout_width,
1.115 inner_top_front_cutout_depth,
1.116 @@ -768,16 +776,16 @@
1.117 /* Cutout to accept the back connector sides (or the floor of the back piece). */
1.118
1.119 cube_at(inner_connector_front_cutout_width,
1.120 - inner_connector_front_cutout_depth,
1.121 + BACK_CONNECTOR_SECTION ? inner_connector_front_cutout_depth : edge_connector_cutout_front_depth,
1.122 BACK_CONNECTOR_SECTION ? inner_connector_front_cutout_height : bottom,
1.123 1, -1, -1,
1.124 - int_connector_width / 2, 0, int_payload_lower_extent);
1.125 + int_connector_right_extent, 0, int_payload_lower_extent);
1.126
1.127 cube_at(inner_connector_front_cutout_width,
1.128 - inner_connector_front_cutout_depth,
1.129 + BACK_CONNECTOR_SECTION ? inner_connector_front_cutout_depth : edge_connector_cutout_front_depth,
1.130 BACK_CONNECTOR_SECTION ? inner_connector_front_cutout_height : bottom,
1.131 -1, -1, -1,
1.132 - -int_connector_width / 2, 0, int_payload_lower_extent);
1.133 + int_connector_left_extent, 0, int_payload_lower_extent);
1.134
1.135 /* Fillets to round off the edges. */
1.136
1.137 @@ -811,11 +819,11 @@
1.138 rotate([0, 0, 180])
1.139 fillet_justified(rr, payload_height + bottom + extra);
1.140
1.141 - translate([connector_width / 2 - ro, -front_depth + ro, lower_extent])
1.142 + translate([connector_right_extent - ro, -front_depth + ro, lower_extent])
1.143 rotate([0, 0, 270])
1.144 fillet_partitioned(rr, connector_height - bottom);
1.145
1.146 - translate([-connector_width / 2 + ro, -front_depth + ro, lower_extent])
1.147 + translate([connector_left_extent + ro, -front_depth + ro, lower_extent])
1.148 rotate([0, 0, 180])
1.149 fillet_partitioned(rr, connector_height - bottom);
1.150 }
1.151 @@ -864,11 +872,11 @@
1.152
1.153 cube_at(back_left, back_depth, connector_height,
1.154 -1, 1, -1,
1.155 - -int_connector_width / 2, 0, int_payload_lower_extent);
1.156 + int_connector_left_extent, 0, int_payload_lower_extent);
1.157
1.158 cube_at(back_right, back_depth, connector_height,
1.159 1, 1, -1,
1.160 - int_connector_width / 2, 0, int_payload_lower_extent);
1.161 + int_connector_right_extent, 0, int_payload_lower_extent);
1.162 }
1.163
1.164 /* Top of back piece. */
1.165 @@ -915,15 +923,15 @@
1.166
1.167 if (BACK_CONNECTOR_SECTION) {
1.168
1.169 - /* Left side of connector. */
1.170 + /* Left side of connector (or floor extension). */
1.171
1.172 difference() {
1.173 cube_at(back_left - groove_depth, groove_width_extra,
1.174 inner_connector_front_cutout_height,
1.175 -1, 1, -1,
1.176 - -int_connector_width / 2, -groove_width_extra, int_payload_lower_extent);
1.177 + int_connector_left_extent, -groove_width_extra, int_payload_lower_extent);
1.178 if (ROUND_CONNECTING_EDGES)
1.179 - translate([-int_connector_width / 2 - groove_ro,
1.180 + translate([int_connector_left_extent - groove_ro,
1.181 -groove_width_extra + groove_ro,
1.182 lower_extent])
1.183 rotate([0, 0, -90])
1.184 @@ -931,15 +939,15 @@
1.185 inner_connector_front_cutout_height + extra);
1.186 }
1.187
1.188 - /* Right side of connector. */
1.189 + /* Right side of connector (or floor extension). */
1.190
1.191 difference() {
1.192 cube_at(back_right - groove_depth, groove_width_extra,
1.193 inner_connector_front_cutout_height,
1.194 1, 1, -1,
1.195 - int_connector_width / 2, -groove_width_extra, int_payload_lower_extent);
1.196 + int_connector_right_extent, -groove_width_extra, int_payload_lower_extent);
1.197 if (ROUND_CONNECTING_EDGES)
1.198 - translate([int_connector_width / 2 + groove_ro,
1.199 + translate([int_connector_right_extent + groove_ro,
1.200 -groove_width_extra + groove_ro,
1.201 lower_extent])
1.202 rotate([0, 0, 180])
1.203 @@ -967,9 +975,26 @@
1.204
1.205 /* Floor of cartridge. */
1.206
1.207 - cube_at(connector_width, back_depth, bottom,
1.208 - 0, 1, 1,
1.209 - 0, 0, lower_extent + int_connector_height);
1.210 + if (payload_width > connector_width) {
1.211 +
1.212 + difference() {
1.213 + cube_at(payload_width, back_depth, bottom,
1.214 + 1, 1, 1,
1.215 + payload_left_extent, 0, lower_extent + int_connector_height);
1.216 +
1.217 + /* Cut out the floor to provide a tab. */
1.218 +
1.219 + cube_at(payload_width - connector_width + groove_depth,
1.220 + edge_connector_cutout_front_depth, bottom,
1.221 + 1, 1, 1,
1.222 + payload_left_extent, 0, lower_extent + int_connector_height);
1.223 + }
1.224 +
1.225 + } else {
1.226 + cube_at(connector_width, back_depth, bottom,
1.227 + 0, 1, 1,
1.228 + 0, 0, lower_extent + int_connector_height);
1.229 + }
1.230
1.231 /* Edge connector cutout. */
1.232
1.233 @@ -980,22 +1005,6 @@
1.234 0, 0, lower_extent + int_connector_height);
1.235 }
1.236
1.237 - /* Extended floor. */
1.238 -
1.239 - if (payload_width > connector_width) {
1.240 -
1.241 - difference() {
1.242 -
1.243 - cube_at(payload_width - connector_width, back_depth, bottom,
1.244 - 1, 1, 1,
1.245 - payload_left_extent, 0, lower_extent + int_connector_height);
1.246 -
1.247 - cube_at(payload_width - connector_width, edge_connector_cutout_front_depth, bottom,
1.248 - 1, 1, 1,
1.249 - payload_left_extent, 0, lower_extent + int_connector_height);
1.250 - }
1.251 - }
1.252 -
1.253 /* PCB supports. */
1.254
1.255 if (MODEL == ROM_CARTRIDGE) {
1.256 @@ -1035,11 +1044,19 @@
1.257
1.258 union() {
1.259
1.260 - /* Left groove. */
1.261 + /*
1.262 + Grooves are separated to permit a discontinuity with the
1.263 + wide cartridge and for control over the back section.
1.264 + */
1.265
1.266 - cube_at(groove_depth, groove_width_normal, height,
1.267 - 1, 1, 0,
1.268 - payload_left_extent, 0, 0);
1.269 + cube_at(groove_depth, groove_width_normal, payload_height + bottom,
1.270 + 1, 1, -1,
1.271 + payload_left_extent, 0, upper_extent);
1.272 +
1.273 + if (BACK_CONNECTOR_SECTION)
1.274 + cube_at(groove_depth, groove_width_normal, connector_height,
1.275 + 1, 1, 1,
1.276 + connector_left_extent, 0, lower_extent);
1.277
1.278 /* Right groove. */
1.279
1.280 @@ -1047,6 +1064,11 @@
1.281 -1, 1, 0,
1.282 payload_right_extent, 0, 0);
1.283
1.284 + if (BACK_CONNECTOR_SECTION)
1.285 + cube_at(groove_depth, groove_width_normal, connector_height,
1.286 + -1, 1, 1,
1.287 + connector_right_extent, 0, lower_extent);
1.288 +
1.289 /* Top grooves. */
1.290
1.291 cube_at(payload_width, groove_width_normal, groove_depth,
1.292 @@ -1069,7 +1091,7 @@
1.293
1.294 translate([0, back_depth, lower_extent])
1.295 linear_extrude(height = back_cavity_height)
1.296 - translate([-int_connector_width / 2, 0, 0])
1.297 + translate([int_connector_left_extent, 0, 0])
1.298 polygon([
1.299 [back_cavity_offset_from_inner_left, 0],
1.300 [back_cavity_inner_offset_from_inner_left,
1.301 @@ -1099,7 +1121,7 @@
1.302
1.303 translate([0, int_connector_back_depth, lower_extent])
1.304 linear_extrude(height = int_connector_height)
1.305 - translate([-int_connector_width / 2, 0, 0])
1.306 + translate([int_connector_left_extent, 0, 0])
1.307 polygon([
1.308 [0, 0],
1.309 [inner_back_slope_max_offset, 0],
1.310 @@ -1110,7 +1132,7 @@
1.311
1.312 translate([0, int_connector_back_depth, lower_extent])
1.313 linear_extrude(height = int_connector_height)
1.314 - translate([int_connector_width / 2, 0, 0])
1.315 + translate([int_connector_right_extent, 0, 0])
1.316 polygon([
1.317 [0, 0],
1.318 [-inner_back_slope_max_offset, 0],
1.319 @@ -1164,10 +1186,10 @@
1.320 fillet_justified(rr, payload_height + bottom + extra);
1.321
1.322 if (BACK_CONNECTOR_SECTION) {
1.323 - translate([connector_width / 2 - ro, back_depth - ro, lower_extent])
1.324 + translate([connector_right_extent - ro, back_depth - ro, lower_extent])
1.325 fillet_partitioned(rr, connector_height - bottom);
1.326
1.327 - translate([-connector_width / 2 + ro, back_depth - ro, lower_extent])
1.328 + translate([connector_left_extent + ro, back_depth - ro, lower_extent])
1.329 rotate([0, 0, 90])
1.330 fillet_partitioned(rr, connector_height - bottom);
1.331 }
1.332 @@ -1197,12 +1219,12 @@
1.333
1.334 /* Sides of connector. */
1.335
1.336 - translate([-connector_width / 2 + groove_depth + groove_ro, -groove_width_extra + groove_ro,
1.337 + translate([connector_left_extent + groove_depth + groove_ro, -groove_width_extra + groove_ro,
1.338 lower_extent])
1.339 rotate([0, 0, 180])
1.340 fillet_partitioned(groove_rr, inner_connector_front_cutout_height);
1.341
1.342 - translate([connector_width / 2 - groove_depth - groove_ro, -groove_width_extra + groove_ro,
1.343 + translate([connector_right_extent - groove_depth - groove_ro, -groove_width_extra + groove_ro,
1.344 lower_extent])
1.345 rotate([0, 0, -90])
1.346 fillet_partitioned(groove_rr, inner_connector_front_cutout_height);
1.347 @@ -1280,13 +1302,13 @@
1.348 /* Holes for lugs. */
1.349
1.350 translate([
1.351 - -int_connector_width / 2 + pcb_lug_offset_from_inside,
1.352 + int_connector_left_extent + pcb_lug_offset_from_inside,
1.353 pcb_hole_start_depth, pcb_lug_offset_from_bottom])
1.354 rotate([90, 0, 0])
1.355 cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius);
1.356
1.357 translate([
1.358 - int_connector_width / 2 - pcb_lug_offset_from_inside,
1.359 + int_connector_right_extent - pcb_lug_offset_from_inside,
1.360 pcb_hole_start_depth, pcb_lug_offset_from_bottom])
1.361 rotate([90, 0, 0])
1.362 cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius);
1.363 @@ -1355,7 +1377,7 @@
1.364 the same way, if APART is defined.
1.365 */
1.366
1.367 - front_displacement_together = CLOSED ? front_back_overlap : 0;
1.368 + front_displacement_together = CLOSED ? front_back_overlap : front_back_overlap - SPACE_APART;
1.369 front_displacement = APART ? -connector_width * 0.6 : 0;
1.370 back_displacement = APART ? connector_width * 0.6 : 0;
1.371 back_rotation = APART ? 180 : 0;