# HG changeset patch # User Paul Boddie # Date 1418320082 -3600 # Node ID ed7b8c2c11bb82c46f3ebd0ba0c01ef15f549364 # Parent 2f5c52a0703d7fc9d7b203a871169273ff53e6af Added a ROM cartridge mode setting and tidied the PCB generation. diff -r 2f5c52a0703d -r ed7b8c2c11bb cartridge.scad --- a/cartridge.scad Sun Dec 07 00:49:12 2014 +0100 +++ b/cartridge.scad Thu Dec 11 18:48:02 2014 +0100 @@ -26,6 +26,10 @@ TOP_LABEL_INSET = 1; GROOVE = 1; + /* Model configurations. */ + + ROM_CARTRIDGE = 1; + /* Options for checking. Some useful combinations... @@ -535,26 +539,28 @@ /* PCB supports. */ - cube_at(pcb_front_support_width, - pcb_front_support_depth, - pcb_front_support_height, - -1, -1, 1, - -pcb_support_offset_from_centre, - 0, - int_payload_lower_extent); + if (ROM_CARTRIDGE) { + cube_at(pcb_front_support_width, + pcb_front_support_depth, + pcb_front_support_height, + -1, -1, 1, + -pcb_support_offset_from_centre, + 0, + int_payload_lower_extent); - cube_at(pcb_front_support_width, - pcb_front_support_depth, - pcb_front_support_height, - 1, -1, 1, - pcb_support_offset_from_centre, - 0, - int_payload_lower_extent); + cube_at(pcb_front_support_width, + pcb_front_support_depth, + pcb_front_support_height, + 1, -1, 1, + pcb_support_offset_from_centre, + 0, + int_payload_lower_extent); - /* Circular "lugs" to hold PCBs in place. */ + /* Circular "lugs" to hold PCBs in place. */ - pcb_front_lug(-1); - pcb_front_lug(1); + pcb_front_lug(-1); + pcb_front_lug(1); + } } /* Label insets. */ @@ -829,15 +835,17 @@ /* PCB supports. */ - pcb_support(-1, pcb_back_support_left_bump_height, - pcb_back_support_left_bump_offset_from_bottom); - pcb_support(1, pcb_back_support_right_bump_height, - pcb_back_support_right_bump_offset_from_bottom); + if (ROM_CARTRIDGE) { + pcb_support(-1, pcb_back_support_left_bump_height, + pcb_back_support_left_bump_offset_from_bottom); + pcb_support(1, pcb_back_support_right_bump_height, + pcb_back_support_right_bump_offset_from_bottom); - /* Circular "lugs" to hold PCBs in place. */ + /* Circular "lugs" to hold PCBs in place. */ - pcb_lug(-1); - pcb_lug(1); + pcb_lug(-1); + pcb_lug(1); + } } /* Label insets. */ @@ -1037,26 +1045,33 @@ edge_connector_width = 56.5; edge_connector_height = 11.85; pcb_position_y = int_payload_lower_extent; - pcb_left_hole_offset = pcb_back_support_left_bump_offset_from_bottom - + 0.55; - pcb_left_hole_width = 2.2; - pcb_left_hole_height = pcb_back_support_left_bump_height - 0.55 * 2; + /* + The rectangular part of the narrow left and right holes is smaller + than the "bump" in the case, but the circular parts make the overall + hole larger than the "bump". An extra depth is used for holes to avoid + surface definition problems. + */ + + pcb_hole_margin = 0.55; + pcb_hole_width = 2.2; + pcb_hole_extra_depth = 0.1; + pcb_lug_hole_radius = 3.75; + + pcb_left_hole_offset = pcb_back_support_left_bump_offset_from_bottom + pcb_hole_margin; + pcb_left_hole_height = pcb_back_support_left_bump_height - pcb_hole_margin * 2; pcb_left_hole_offset_from_centre = pcb_support_offset_from_centre + - pcb_back_support_width / 2 - pcb_left_hole_width / 2; + pcb_back_support_width / 2 - pcb_hole_width / 2; - pcb_right_hole_offset = pcb_back_support_right_bump_offset_from_bottom - + 0.55; - pcb_right_hole_width = pcb_left_hole_width; - pcb_right_hole_height = pcb_back_support_right_bump_height - 0.55 * 2; + pcb_right_hole_offset = pcb_back_support_right_bump_offset_from_bottom + pcb_hole_margin; + pcb_right_hole_height = pcb_back_support_right_bump_height - pcb_hole_margin * 2; pcb_right_hole_offset_from_centre = -pcb_left_hole_offset_from_centre; - pcb_hole_depth = pcb_depth + 0.2; - pcb_hole_start_depth = -0.1; - pcb_lug_hole_radius = 3.75; + pcb_hole_depth = pcb_depth + 2 * pcb_hole_extra_depth; + pcb_hole_start_depth = -pcb_hole_extra_depth; - if (PCB) + if (PCB) if (ROM_CARTRIDGE) { translate([back_displacement, 0, 0]) - translate([0, 0, pcb_position_y]) + translate([0, 0, pcb_position_y]) difference() { /* Mock PCB. */ @@ -1075,33 +1090,33 @@ /* Holes for mounting. */ union() { - cube_at(pcb_left_hole_width, 1, pcb_left_hole_height, + cube_at(pcb_hole_width, 1, pcb_left_hole_height, 1, 1, 1, pcb_left_hole_offset_from_centre, 0, pcb_left_hole_offset); translate([pcb_left_hole_offset_from_centre + - pcb_left_hole_width / 2, pcb_hole_start_depth, pcb_left_hole_offset]) + pcb_hole_width / 2, pcb_hole_start_depth, pcb_left_hole_offset]) rotate([-90, 0, 0]) - cylinder(h=pcb_hole_depth, r=pcb_left_hole_width / 2); + cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2); translate([pcb_left_hole_offset_from_centre + - pcb_left_hole_width / 2, pcb_hole_start_depth, + pcb_hole_width / 2, pcb_hole_start_depth, pcb_left_hole_offset + pcb_left_hole_height]) rotate([-90, 0, 0]) - cylinder(h=pcb_hole_depth, r=pcb_left_hole_width / 2); + cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2); } union() { - cube_at(pcb_right_hole_width, 1, pcb_right_hole_height, + cube_at(pcb_hole_width, 1, pcb_right_hole_height, -1, 1, 1, pcb_right_hole_offset_from_centre, 0, pcb_right_hole_offset); translate([pcb_right_hole_offset_from_centre - - pcb_right_hole_width / 2, pcb_hole_start_depth, pcb_right_hole_offset]) + pcb_hole_width / 2, pcb_hole_start_depth, pcb_right_hole_offset]) rotate([-90, 0, 0]) - cylinder(h=pcb_hole_depth, r=pcb_right_hole_width / 2); + cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2); translate([pcb_right_hole_offset_from_centre - - pcb_right_hole_width / 2, pcb_hole_start_depth, + pcb_hole_width / 2, pcb_hole_start_depth, pcb_right_hole_offset + pcb_right_hole_height]) rotate([-90, 0, 0]) - cylinder(h=pcb_hole_depth, r=pcb_right_hole_width / 2); + cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2); } /* Holes for lugs. */ @@ -1118,6 +1133,7 @@ rotate([-90, 0, 0]) cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius); } + } } cartridge();