1.1 --- a/cartridge.scad Mon Jan 20 15:18:32 2014 +0100
1.2 +++ b/cartridge.scad Mon Jan 20 17:23:23 2014 +0100
1.3 @@ -19,10 +19,27 @@
1.4 }
1.5
1.6 /*
1.7 + Justify an object of the given dimensions, according to the given
1.8 + factors (where 1 indicates moving the object to the positive side of an
1.9 + axis, and -1 indicates moving it to the negative side of an axis).
1.10 +
1.11 + NOTE: child should eventually be replaced by children.
1.12 + */
1.13 + module justify(width, depth, height, wdir, ddir, hdir) {
1.14 + translate([
1.15 + wdir * width / 2,
1.16 + ddir * depth / 2,
1.17 + hdir * height / 2])
1.18 + child();
1.19 + }
1.20 +
1.21 + /*
1.22 Make a cuboid of the given dimensions, justifying it according to the given
1.23 - factors (where 1 indicates moving the cuboid to the positive side of the
1.24 - axis, and -1 indicates moving it to the negative side of the axis), and
1.25 - moving it to the specified coordinates.
1.26 + factors, and moving it to the specified coordinates.
1.27 +
1.28 + NOTE: Usage of justify within this module will not work due to recursion
1.29 + NOTE: limitations in openscad, potentially removed in more recent
1.30 + NOTE: releases. Thus, the justify transform is merged in here.
1.31 */
1.32 module cube_at(width, depth, height, wdir, ddir, hdir, x, y, z) {
1.33 translate([
1.34 @@ -316,43 +333,47 @@
1.35
1.36 /* PCB supports. */
1.37
1.38 - translate([-edge_connector_cutout_back_width / 2 +
1.39 - pcb_back_support_width / 2,
1.40 - edge_connector_cutout_back_depth +
1.41 - pcb_back_support_depth / 2,
1.42 - -height / 2 + bottom + bottom_from_base +
1.43 - pcb_back_support_height / 2])
1.44 - union() {
1.45 - cube([pcb_back_support_width, pcb_back_support_depth,
1.46 - pcb_back_support_height], center = true);
1.47 - cube_at(pcb_back_support_bump_width,
1.48 - pcb_back_support_bump_depth,
1.49 - pcb_back_support_left_bump_height,
1.50 - 0, -1, 1,
1.51 - 0,
1.52 - -pcb_back_support_depth / 2,
1.53 - -pcb_back_support_height / 2 +
1.54 - pcb_back_support_left_bump_offset_from_bottom);
1.55 - }
1.56 + translate([-edge_connector_cutout_back_width / 2,
1.57 + edge_connector_cutout_back_depth,
1.58 + -height / 2 + bottom + bottom_from_base])
1.59 + justify(pcb_back_support_width,
1.60 + pcb_back_support_depth,
1.61 + pcb_back_support_height,
1.62 + 1, 1, 1)
1.63 + union() {
1.64 + cube([pcb_back_support_width,
1.65 + pcb_back_support_depth,
1.66 + pcb_back_support_height], center = true);
1.67 + cube_at(pcb_back_support_bump_width,
1.68 + pcb_back_support_bump_depth,
1.69 + pcb_back_support_left_bump_height,
1.70 + 0, -1, 1,
1.71 + 0,
1.72 + -pcb_back_support_depth / 2,
1.73 + -pcb_back_support_height / 2 +
1.74 + pcb_back_support_left_bump_offset_from_bottom);
1.75 + }
1.76
1.77 - translate([edge_connector_cutout_back_width / 2 -
1.78 - pcb_back_support_width / 2,
1.79 - edge_connector_cutout_back_depth +
1.80 - pcb_back_support_depth / 2,
1.81 - -height / 2 + bottom + bottom_from_base +
1.82 - pcb_back_support_height / 2])
1.83 - union() {
1.84 - cube([pcb_back_support_width, pcb_back_support_depth,
1.85 - pcb_back_support_height], center = true);
1.86 - cube_at(pcb_back_support_bump_width,
1.87 - pcb_back_support_bump_depth,
1.88 - pcb_back_support_right_bump_height,
1.89 - 0, -1, 1,
1.90 - 0,
1.91 - -pcb_back_support_depth / 2,
1.92 - -pcb_back_support_height / 2 +
1.93 - pcb_back_support_right_bump_offset_from_bottom);
1.94 - }
1.95 + translate([edge_connector_cutout_back_width / 2,
1.96 + edge_connector_cutout_back_depth,
1.97 + -height / 2 + bottom + bottom_from_base])
1.98 + justify(pcb_back_support_width,
1.99 + pcb_back_support_depth,
1.100 + pcb_back_support_height,
1.101 + -1, 1, 1)
1.102 + union() {
1.103 + cube([pcb_back_support_width,
1.104 + pcb_back_support_depth,
1.105 + pcb_back_support_height], center = true);
1.106 + cube_at(pcb_back_support_bump_width,
1.107 + pcb_back_support_bump_depth,
1.108 + pcb_back_support_right_bump_height,
1.109 + 0, -1, 1,
1.110 + 0,
1.111 + -pcb_back_support_depth / 2,
1.112 + -pcb_back_support_height / 2 +
1.113 + pcb_back_support_right_bump_offset_from_bottom);
1.114 + }
1.115 }
1.116
1.117 /* Label insets. */