# HG changeset patch # User Paul Boddie # Date 1412688020 -7200 # Node ID bd66a16190dbc4c8df96b8849d41f568007af89f # Parent cf96720ec877ff66ced2e2cc999b93e13cb1c95d Permitted the configuration of various features. diff -r cf96720ec877 -r bd66a16190db cartridge.scad --- a/cartridge.scad Tue Oct 07 00:39:32 2014 +0200 +++ b/cartridge.scad Tue Oct 07 15:20:20 2014 +0200 @@ -19,6 +19,13 @@ { $fn = 50; + /* Configure the generated shapes. */ + + BACK_CAVITY = 1; + FRONT_LABEL_INSET = 1; + TOP_LABEL_INSET = 1; + GROOVE = 1; + /* Rounding/fillet radius and additional margin of subtracted material. The additional margin helps avoid geometry problems. @@ -120,9 +127,13 @@ top_label_depth = front_label_depth; top_label_offset_from_front = 2.5; - /* The groove around the sides and top. */ + /* + The groove around the sides and top. This is extended to allow the + pieces to fit together, and this extension is generated regardless of + whether the visible groove is enabled or not. + */ - groove_width_exposed = 1.5; + groove_width_exposed = GROOVE ? 1.5 : 0; groove_width = groove_width_exposed + groove_width_extra; groove_depth = 1.0; /* how deep the groove goes into each side */ @@ -425,18 +436,20 @@ /* Front label. */ - translate([-front_label_width / 2, -front_depth, - front_label_offset_from_bottom - height / 2]) - cube([front_label_width, front_label_depth, - front_label_height]); + if (FRONT_LABEL_INSET) + translate([-front_label_width / 2, -front_depth, + front_label_offset_from_bottom - height / 2]) + cube([front_label_width, front_label_depth, + front_label_height]); - /* Top label. */ + /* Top label. See also the back piece. */ - translate([-top_label_width / 2, - -front_depth + top_label_offset_from_front, - height / 2 - top_label_depth]) - cube([top_label_width, top_label_height, - top_label_depth]); + if (TOP_LABEL_INSET) + translate([-top_label_width / 2, + -front_depth + top_label_offset_from_front, + height / 2 - top_label_depth]) + cube([top_label_width, top_label_height, + top_label_depth]); } /* Inner front edge cavity. */ @@ -508,6 +521,11 @@ } } + /* + Place the back piece next to the front, with the internals facing out + the same way. + */ + translate([width * 0.6, 0, 0]) rotate([0, 0, 180]) difference() { @@ -560,13 +578,14 @@ union() { - /* Top label. */ + /* Top label. See also the front piece. */ - translate([-top_label_width / 2, - -front_depth + top_label_offset_from_front, - height / 2 - top_label_depth]) - cube([top_label_width, top_label_height, - top_label_depth]); + if (TOP_LABEL_INSET) + translate([-top_label_width / 2, + -front_depth + top_label_offset_from_front, + height / 2 - top_label_depth]) + cube([top_label_width, top_label_height, + top_label_depth]); } /* Top and side grooves, positioned in the back portion. */ @@ -599,37 +618,38 @@ /* Back cavity. */ - intersection() { + if (BACK_CAVITY) + intersection() { - /* From the bottom upwards. */ + /* From the bottom upwards. */ - translate([0, back_depth, -height / 2]) - linear_extrude(height = back_cavity_height) - translate([-int_width / 2, 0, 0]) - polygon([ - [back_cavity_offset_from_inner_left, 0], - [back_cavity_inner_offset_from_inner_left, - -back_cavity_depth], - [back_cavity_inner_offset_from_inner_left + - back_cavity_inner_width, - -back_cavity_depth], - [back_cavity_offset_from_inner_left + - back_cavity_width, 0] - ]); + translate([0, back_depth, -height / 2]) + linear_extrude(height = back_cavity_height) + translate([-int_width / 2, 0, 0]) + polygon([ + [back_cavity_offset_from_inner_left, 0], + [back_cavity_inner_offset_from_inner_left, + -back_cavity_depth], + [back_cavity_inner_offset_from_inner_left + + back_cavity_inner_width, + -back_cavity_depth], + [back_cavity_offset_from_inner_left + + back_cavity_width, 0] + ]); - /* From left to right. */ + /* From left to right. */ - translate([back_cavity_width / 2, back_depth, -height / 2]) - rotate([0, -90, 0]) - linear_extrude(height = back_cavity_width) - polygon([ - [-extra, -back_cavity_depth], - [back_cavity_inner_height, - -back_cavity_depth], - [back_cavity_height, 0], - [-extra, 0] - ]); - } + translate([back_cavity_width / 2, back_depth, -height / 2]) + rotate([0, -90, 0]) + linear_extrude(height = back_cavity_width) + polygon([ + [-extra, -back_cavity_depth], + [back_cavity_inner_height, + -back_cavity_depth], + [back_cavity_height, 0], + [-extra, 0] + ]); + } /* Inner back cavities. */