# HG changeset patch # User Paul Boddie # Date 1390227512 -3600 # Node ID 3ecba6c800b0735b4c62f953432f29bbca9e6a5d # Parent ce3a68ff0b68b16de03be1d02b9d1561d7f3d864 Added a cube_at "macro" to reduce duplication somewhat. Removed the extra material removal in the edge connector cutout regions. Added some comments. diff -r ce3a68ff0b68 -r 3ecba6c800b0 cartridge.scad --- a/cartridge.scad Mon Jan 20 13:53:59 2014 +0100 +++ b/cartridge.scad Mon Jan 20 15:18:32 2014 +0100 @@ -18,6 +18,20 @@ } } + /* + Make a cuboid of the given dimensions, justifying it according to the given + factors (where 1 indicates moving the cuboid to the positive side of the + axis, and -1 indicates moving it to the negative side of the axis), and + moving it to the specified coordinates. + */ + module cube_at(width, depth, height, wdir, ddir, hdir, x, y, z) { + translate([ + x + wdir * width / 2, + y + ddir * depth / 2, + z + hdir * height / 2]) + cube([width, depth, height], center = true); + } + /* Cartridge dimensions. */ width = 89.0; @@ -26,7 +40,7 @@ front_depth = 6.5; back_depth = 11.0; - /* Details. */ + /* Label details. */ front_label_width = 83.0; front_label_height = 46.0; @@ -34,14 +48,22 @@ front_label_offset_from_bottom = 19.5; top_label_width = front_label_width; - top_label_height = 11.5; + top_label_height = 11.5; /* the height as seen from above */ top_label_depth = front_label_depth; top_label_offset_from_front = 2.5; + /* The groove around the sides and top. */ + groove_width = 2.5; /* how much the groove cuts out of the back */ groove_depth = 1.0; /* how deep the groove goes into each side */ + + /* Additional cutting to mate the back and front. */ + top_groove_width = 1.0; top_groove_depth = 2.0; + + /* Space for the back inside the front. */ + inner_top_front_cutout_width = 87.0; inner_top_front_cutout_depth = 1.0; inner_top_front_cutout_offset = 2.0; @@ -136,42 +158,51 @@ translate([0, -front_depth / 2, height / 2 - top / 2]) cube([width, front_depth, top], center = true); difference() { - translate([0, -front_depth / 2, - -height / 2 + bottom / 2 + bottom_from_base]) - cube([width, front_depth, bottom], center = true); - translate([-width / 2 + edge_connector_cutout_front_offset + - edge_connector_cutout_front_width / 2, - -edge_connector_cutout_front_depth / 2, - -height / 2 + bottom / 2 + bottom_from_base]) - cube([edge_connector_cutout_front_width, - edge_connector_cutout_front_depth, - bottom + extra], center = true); - translate([width / 2 - edge_connector_cutout_front_offset - - edge_connector_cutout_front_width / 2, - -edge_connector_cutout_front_depth / 2, - -height / 2 + bottom / 2 + bottom_from_base]) - cube([edge_connector_cutout_front_width, - edge_connector_cutout_front_depth, - bottom + extra], center = true); + + /* Floor of cartridge. */ + + cube_at(width, front_depth, bottom, + 0, -1, 1, + 0, 0, -height / 2 + bottom_from_base); + + /* Left cutout. */ + + cube_at(edge_connector_cutout_front_width, + edge_connector_cutout_front_depth, + bottom, + 1, -1, 1, + -width / 2 + edge_connector_cutout_front_offset, + 0, + -height / 2 + bottom_from_base); + + /* Right cutout. */ + + cube_at(edge_connector_cutout_front_width, + edge_connector_cutout_front_depth, + bottom, + -1, -1, 1, + width / 2 - edge_connector_cutout_front_offset, + 0, + -height / 2 + bottom_from_base); } /* PCB supports. */ - translate([-edge_connector_cutout_back_width / 2 + - pcb_front_support_width / 2, - -pcb_front_support_depth / 2, - -height / 2 + bottom + bottom_from_base + - pcb_front_support_height / 2]) - cube([pcb_front_support_width, pcb_front_support_depth, - pcb_front_support_height], center = true); + cube_at(pcb_front_support_width, + pcb_front_support_depth, + pcb_front_support_height, + 1, -1, 1, + -edge_connector_cutout_back_width / 2, + 0, + -height / 2 + bottom + bottom_from_base); - translate([edge_connector_cutout_back_width / 2 - - pcb_front_support_width / 2, - -pcb_front_support_depth / 2, - -height / 2 + bottom + bottom_from_base + - pcb_front_support_height / 2]) - cube([pcb_front_support_width, pcb_front_support_depth, - pcb_front_support_height], center = true); + cube_at(pcb_front_support_width, + pcb_front_support_depth, + pcb_front_support_height, + -1, -1, 1, + edge_connector_cutout_back_width / 2, + 0, + -height / 2 + bottom + bottom_from_base); } /* Label insets. */ @@ -267,14 +298,20 @@ translate([0, back_depth / 2, height / 2 - top / 2]) cube([width, back_depth, top], center = true); difference() { - translate([0, back_depth / 2, - -height / 2 + bottom / 2 + bottom_from_base]) - cube([width, back_depth, bottom], center = true); - translate([0, edge_connector_cutout_back_depth / 2, - -height / 2 + bottom / 2 + bottom_from_base]) - cube([edge_connector_cutout_back_width, - edge_connector_cutout_back_depth, - bottom + extra], center = true); + + /* Floor of cartridge. */ + + cube_at(width, back_depth, bottom, + 0, 1, 1, + 0, 0, -height / 2 + bottom_from_base); + + /* Edge connector cutout. */ + + cube_at(edge_connector_cutout_back_width, + edge_connector_cutout_back_depth, + bottom, + 0, 1, 1, + 0, 0, -height / 2 + bottom_from_base); } /* PCB supports. */ @@ -288,17 +325,14 @@ union() { cube([pcb_back_support_width, pcb_back_support_depth, pcb_back_support_height], center = true); - translate([0, - -pcb_back_support_depth / 2 - - pcb_back_support_bump_depth / 2, + cube_at(pcb_back_support_bump_width, + pcb_back_support_bump_depth, + pcb_back_support_left_bump_height, + 0, -1, 1, + 0, + -pcb_back_support_depth / 2, -pcb_back_support_height / 2 + - pcb_back_support_left_bump_height / 2 + - pcb_back_support_left_bump_offset_from_bottom - ]) - cube([pcb_back_support_bump_width, - pcb_back_support_bump_depth, - pcb_back_support_left_bump_height], - center = true); + pcb_back_support_left_bump_offset_from_bottom); } translate([edge_connector_cutout_back_width / 2 - @@ -310,17 +344,14 @@ union() { cube([pcb_back_support_width, pcb_back_support_depth, pcb_back_support_height], center = true); - translate([0, - -pcb_back_support_depth / 2 - - pcb_back_support_bump_depth / 2, + cube_at(pcb_back_support_bump_width, + pcb_back_support_bump_depth, + pcb_back_support_right_bump_height, + 0, -1, 1, + 0, + -pcb_back_support_depth / 2, -pcb_back_support_height / 2 + - pcb_back_support_right_bump_height / 2 + - pcb_back_support_right_bump_offset_from_bottom - ]) - cube([pcb_back_support_bump_width, - pcb_back_support_bump_depth, - pcb_back_support_right_bump_height], - center = true); + pcb_back_support_right_bump_offset_from_bottom); } }