# HG changeset patch # User Paul Boddie # Date 1460126708 -7200 # Node ID dbb43341ce0dd2628cc7aac145ac783274a7205d # Parent 5be3ca52c1b0d97e25567589c8438a0e6488d54b Introduced more parameterisation for a simpler cartridge, making rounding optional for outer edges and connecting edges. diff -r 5be3ca52c1b0 -r dbb43341ce0d cartridge.scad --- a/cartridge.scad Thu Aug 13 19:36:07 2015 +0200 +++ b/cartridge.scad Fri Apr 08 16:45:08 2016 +0200 @@ -1,5 +1,5 @@ /* -Copyright (C) 2014, 2015 Paul Boddie +Copyright (C) 2014, 2015, 2016 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -19,23 +19,45 @@ { $fn = 50; - /* Configure the generated shapes. */ - - BACK_CAVITY = 1; - FRONT_LABEL_INSET = 1; - TOP_LABEL_INSET = 1; - GROOVE = 1; - SHORT_PCB = 0; - - /* Model configurations. */ + /* Model configurations. Do not edit! */ ROM_CARTRIDGE = 0; WIDE_CARTRIDGE = 1; + /* + Configure the generated shapes. + For the absolute simplest shape (for basic 3D printers)... + + BACK_CAVITY = 0; FRONT_LABEL_INSET = 0; TOP_LABEL_INSET = 0; + GROOVE = 0; ROUND_EDGES = 0; ROUND_CONNECTING_EDGES = 0 + + Leave all options enabled for more capable 3D printers. + */ + + /* A cosmetic cut-out to match the necessary interior cavity. */ + BACK_CAVITY = 1; + + /* Optional insets for labels. */ + FRONT_LABEL_INSET = 1; + TOP_LABEL_INSET = 1; + + /* Optional groove between the pieces to match the Electron. */ + GROOVE = 1; + + /* Optional rounding of the external edges. */ + ROUND_EDGES = 1; + + /* Recommended rounding of connection edges. */ + ROUND_CONNECTING_EDGES = 1; + /* Set this to the desired model type. */ MODEL = ROM_CARTRIDGE; + /* Set this where a shorter PCB is to be used. */ + + SHORT_PCB = 0; + /* Options for checking. Some useful combinations... @@ -527,8 +549,9 @@ /* Tapered off for easier connection. */ - translate([0, 0, pcb_lug_depth - pcb_lug_ro]) - fillet_torus(pcb_lug_outer_radius, pcb_lug_rr); + if (ROUND_CONNECTING_EDGES) + translate([0, 0, pcb_lug_depth - pcb_lug_ro]) + fillet_torus(pcb_lug_outer_radius, pcb_lug_rr); } } @@ -749,41 +772,43 @@ /* Fillets to round off the edges. */ union() { + if (ROUND_EDGES) { - /* Top left and right rounding. */ - - translate([payload_left_extent + ro, -front_depth / 2, upper_extent - ro]) - rotate([0, 0, 180]) + /* Top left and right rounding. */ + + translate([payload_left_extent + ro, -front_depth / 2, upper_extent - ro]) + rotate([0, 0, 180]) + rotate([90, 0, 0]) + fillet(rr, front_depth); + translate([payload_right_extent - ro, -front_depth / 2, upper_extent - ro]) rotate([90, 0, 0]) fillet(rr, front_depth); - translate([payload_right_extent - ro, -front_depth / 2, upper_extent - ro]) - rotate([90, 0, 0]) - fillet(rr, front_depth); - /* Top front rounding. */ - - translate([payload_centre, -front_depth + ro, upper_extent - ro]) - rotate([0, 0, 180]) - rotate([0, -90, 0]) - fillet(rr, payload_width); + /* Top front rounding. */ + + translate([payload_centre, -front_depth + ro, upper_extent - ro]) + rotate([0, 0, 180]) + rotate([0, -90, 0]) + fillet(rr, payload_width); - /* Edge rounding. */ - - translate([payload_right_extent - ro, -front_depth + ro, int_payload_lower_extent - bottom - extra]) - rotate([0, 0, 270]) - fillet_justified(rr, payload_height + bottom + extra); + /* Edge rounding. */ + + translate([payload_right_extent - ro, -front_depth + ro, int_payload_lower_extent - bottom - extra]) + rotate([0, 0, 270]) + fillet_justified(rr, payload_height + bottom + extra); - translate([payload_left_extent + ro, -front_depth + ro, int_payload_lower_extent - bottom - extra]) - rotate([0, 0, 180]) - fillet_justified(rr, payload_height + bottom + extra); + translate([payload_left_extent + ro, -front_depth + ro, int_payload_lower_extent - bottom - extra]) + rotate([0, 0, 180]) + fillet_justified(rr, payload_height + bottom + extra); - translate([connector_width / 2 - ro, -front_depth + ro, lower_extent]) - rotate([0, 0, 270]) - fillet_partitioned(rr, connector_height - bottom); + translate([connector_width / 2 - ro, -front_depth + ro, lower_extent]) + rotate([0, 0, 270]) + fillet_partitioned(rr, connector_height - bottom); - translate([-connector_width / 2 + ro, -front_depth + ro, lower_extent]) - rotate([0, 0, 180]) - fillet_partitioned(rr, connector_height - bottom); + translate([-connector_width / 2 + ro, -front_depth + ro, lower_extent]) + rotate([0, 0, 180]) + fillet_partitioned(rr, connector_height - bottom); + } } } @@ -862,10 +887,11 @@ cube_at(back_left - groove_depth, groove_width_extra, inner_payload_front_cutout_height, -1, 1, 1, int_payload_left_extent, -groove_width_extra, int_payload_lower_extent); - translate([int_payload_left_extent - groove_ro, -groove_width_extra + groove_ro, - int_payload_lower_extent]) - rotate([0, 0, -90]) - fillet_justified(groove_rr, inner_payload_front_cutout_height); + if (ROUND_CONNECTING_EDGES) + translate([int_payload_left_extent - groove_ro, -groove_width_extra + groove_ro, + int_payload_lower_extent]) + rotate([0, 0, -90]) + fillet_justified(groove_rr, inner_payload_front_cutout_height); } /* Right side of payload. */ @@ -874,10 +900,11 @@ cube_at(back_right - groove_depth, groove_width_extra, inner_payload_front_cutout_height, 1, 1, 1, int_payload_right_extent, -groove_width_extra, int_payload_lower_extent); - translate([int_payload_right_extent + groove_ro, -groove_width_extra + groove_ro, - int_payload_lower_extent]) - rotate([0, 0, 180]) - fillet_justified(groove_rr, inner_payload_front_cutout_height); + if (ROUND_CONNECTING_EDGES) + translate([int_payload_right_extent + groove_ro, -groove_width_extra + groove_ro, + int_payload_lower_extent]) + rotate([0, 0, 180]) + fillet_justified(groove_rr, inner_payload_front_cutout_height); } /* Left side of connector. */ @@ -886,10 +913,11 @@ cube_at(back_left - groove_depth, groove_width_extra, inner_connector_front_cutout_height, -1, 1, -1, -int_connector_width / 2, -groove_width_extra, int_payload_lower_extent); - translate([-int_connector_width / 2 - groove_ro, -groove_width_extra + groove_ro, - lower_extent]) - rotate([0, 0, -90]) - fillet_partitioned(groove_rr, inner_connector_front_cutout_height + extra); + if (ROUND_CONNECTING_EDGES) + translate([-int_connector_width / 2 - groove_ro, -groove_width_extra + groove_ro, + lower_extent]) + rotate([0, 0, -90]) + fillet_partitioned(groove_rr, inner_connector_front_cutout_height + extra); } /* Right side of connector. */ @@ -898,10 +926,11 @@ cube_at(back_right - groove_depth, groove_width_extra, inner_connector_front_cutout_height, 1, 1, -1, int_connector_width / 2, -groove_width_extra, int_payload_lower_extent); - translate([int_connector_width / 2 + groove_ro, -groove_width_extra + groove_ro, - lower_extent]) - rotate([0, 0, 180]) - fillet_partitioned(groove_rr, inner_connector_front_cutout_height + extra); + if (ROUND_CONNECTING_EDGES) + translate([int_connector_width / 2 + groove_ro, -groove_width_extra + groove_ro, + lower_extent]) + rotate([0, 0, 180]) + fillet_partitioned(groove_rr, inner_connector_front_cutout_height + extra); } /* Top side. */ @@ -910,11 +939,12 @@ cube_at(payload_width - groove_depth * 2, groove_width_extra, top - top_groove_depth, 0, 1, 1, payload_centre, -groove_width_extra, int_payload_upper_extent); - translate([payload_centre, -groove_width_extra + groove_ro, - int_payload_upper_extent + groove_ro]) - rotate([0, 0, 180]) - rotate([0, 90, 0]) - fillet(groove_rr, payload_width - groove_depth * 2); + if (ROUND_CONNECTING_EDGES) + translate([payload_centre, -groove_width_extra + groove_ro, + int_payload_upper_extent + groove_ro]) + rotate([0, 0, 180]) + rotate([0, 90, 0]) + fillet(groove_rr, payload_width - groove_depth * 2); } } @@ -1088,78 +1118,83 @@ /* Fillets to round off the edges. */ union() { + if (ROUND_EDGES) { - /* Top left and right rounding. */ - - translate([payload_left_extent + ro, back_depth / 2, upper_extent - ro]) - rotate([0, 0, 180]) + /* Top left and right rounding. */ + + translate([payload_left_extent + ro, back_depth / 2, upper_extent - ro]) + rotate([0, 0, 180]) + rotate([90, 0, 0]) + fillet(rr, back_depth); + translate([payload_right_extent - ro, back_depth / 2, upper_extent - ro]) rotate([90, 0, 0]) fillet(rr, back_depth); - translate([payload_right_extent - ro, back_depth / 2, upper_extent - ro]) - rotate([90, 0, 0]) - fillet(rr, back_depth); - - /* Top back rounding. */ - - translate([payload_centre, back_depth - ro, upper_extent - ro]) - rotate([0, -90, 0]) - fillet(rr, payload_width); - - /* Outer edge rounding. */ - - translate([payload_right_extent - ro, back_depth - ro, int_payload_lower_extent - bottom - extra]) - fillet_justified(rr, payload_height + bottom + extra); + + /* Top back rounding. */ + + translate([payload_centre, back_depth - ro, upper_extent - ro]) + rotate([0, -90, 0]) + fillet(rr, payload_width); - translate([payload_left_extent + ro, back_depth - ro, int_payload_lower_extent - bottom - extra]) - rotate([0, 0, 90]) + /* Outer edge rounding. */ + + translate([payload_right_extent - ro, back_depth - ro, int_payload_lower_extent - bottom - extra]) fillet_justified(rr, payload_height + bottom + extra); - translate([connector_width / 2 - ro, back_depth - ro, lower_extent]) - fillet_partitioned(rr, connector_height - bottom); + translate([payload_left_extent + ro, back_depth - ro, int_payload_lower_extent - bottom - extra]) + rotate([0, 0, 90]) + fillet_justified(rr, payload_height + bottom + extra); - translate([-connector_width / 2 + ro, back_depth - ro, lower_extent]) - rotate([0, 0, 90]) + translate([connector_width / 2 - ro, back_depth - ro, lower_extent]) fillet_partitioned(rr, connector_height - bottom); - /* - Outer edge rounding of the back extension. This is done as a - separate removal operation rather than occurring when creating the - extension in order to ensure that the edges are actually rounded. + translate([-connector_width / 2 + ro, back_depth - ro, lower_extent]) + rotate([0, 0, 90]) + fillet_partitioned(rr, connector_height - bottom); + } - An extra overlapping measure is employed so that the filleting is - continuous between the payload and connector portions. On the outside - edges, the payload filleting is extended downwards. - */ + if (ROUND_CONNECTING_EDGES) { - translate([payload_left_extent + groove_depth + groove_ro, -groove_width_extra + groove_ro, - int_payload_lower_extent - extra]) - rotate([0, 0, 180]) - fillet_justified(groove_rr, inner_payload_front_cutout_height + extra); + /* + Outer edge rounding of the back extension. This is done as a + separate removal operation rather than occurring when creating the + extension in order to ensure that the edges are actually rounded. - translate([payload_right_extent - groove_depth - groove_ro, -groove_width_extra + groove_ro, - int_payload_lower_extent - extra]) - rotate([0, 0, -90]) - fillet_justified(groove_rr, inner_payload_front_cutout_height + extra); + An extra overlapping measure is employed so that the filleting is + continuous between the payload and connector portions. On the outside + edges, the payload filleting is extended downwards. + */ + + translate([payload_left_extent + groove_depth + groove_ro, -groove_width_extra + groove_ro, + int_payload_lower_extent - extra]) + rotate([0, 0, 180]) + fillet_justified(groove_rr, inner_payload_front_cutout_height + extra); - /* Sides of connector. */ + translate([payload_right_extent - groove_depth - groove_ro, -groove_width_extra + groove_ro, + int_payload_lower_extent - extra]) + rotate([0, 0, -90]) + fillet_justified(groove_rr, inner_payload_front_cutout_height + extra); - translate([-connector_width / 2 + groove_depth + groove_ro, -groove_width_extra + groove_ro, - lower_extent]) - rotate([0, 0, 180]) - fillet_partitioned(groove_rr, inner_connector_front_cutout_height); + /* Sides of connector. */ + + translate([-connector_width / 2 + groove_depth + groove_ro, -groove_width_extra + groove_ro, + lower_extent]) + rotate([0, 0, 180]) + fillet_partitioned(groove_rr, inner_connector_front_cutout_height); - translate([connector_width / 2 - groove_depth - groove_ro, -groove_width_extra + groove_ro, - lower_extent]) - rotate([0, 0, -90]) - fillet_partitioned(groove_rr, inner_connector_front_cutout_height); + translate([connector_width / 2 - groove_depth - groove_ro, -groove_width_extra + groove_ro, + lower_extent]) + rotate([0, 0, -90]) + fillet_partitioned(groove_rr, inner_connector_front_cutout_height); + + /* Top of payload. */ - /* Top of payload. */ - - translate([payload_centre, -groove_width_extra + groove_ro, - int_payload_upper_extent + inner_top_front_cutout_height - groove_ro]) - rotate([0, 0, 180]) - rotate([0, -90, 0]) - fillet(groove_rr, payload_width - groove_depth * 2); + translate([payload_centre, -groove_width_extra + groove_ro, + int_payload_upper_extent + inner_top_front_cutout_height - groove_ro]) + rotate([0, 0, 180]) + rotate([0, -90, 0]) + fillet(groove_rr, payload_width - groove_depth * 2); + } } }