1.1 --- a/cartridge.scad Mon Jan 20 13:53:59 2014 +0100
1.2 +++ b/cartridge.scad Mon Jan 20 15:18:32 2014 +0100
1.3 @@ -18,6 +18,20 @@
1.4 }
1.5 }
1.6
1.7 + /*
1.8 + Make a cuboid of the given dimensions, justifying it according to the given
1.9 + factors (where 1 indicates moving the cuboid to the positive side of the
1.10 + axis, and -1 indicates moving it to the negative side of the axis), and
1.11 + moving it to the specified coordinates.
1.12 + */
1.13 + module cube_at(width, depth, height, wdir, ddir, hdir, x, y, z) {
1.14 + translate([
1.15 + x + wdir * width / 2,
1.16 + y + ddir * depth / 2,
1.17 + z + hdir * height / 2])
1.18 + cube([width, depth, height], center = true);
1.19 + }
1.20 +
1.21 /* Cartridge dimensions. */
1.22
1.23 width = 89.0;
1.24 @@ -26,7 +40,7 @@
1.25 front_depth = 6.5;
1.26 back_depth = 11.0;
1.27
1.28 - /* Details. */
1.29 + /* Label details. */
1.30
1.31 front_label_width = 83.0;
1.32 front_label_height = 46.0;
1.33 @@ -34,14 +48,22 @@
1.34 front_label_offset_from_bottom = 19.5;
1.35
1.36 top_label_width = front_label_width;
1.37 - top_label_height = 11.5;
1.38 + top_label_height = 11.5; /* the height as seen from above */
1.39 top_label_depth = front_label_depth;
1.40 top_label_offset_from_front = 2.5;
1.41
1.42 + /* The groove around the sides and top. */
1.43 +
1.44 groove_width = 2.5; /* how much the groove cuts out of the back */
1.45 groove_depth = 1.0; /* how deep the groove goes into each side */
1.46 +
1.47 + /* Additional cutting to mate the back and front. */
1.48 +
1.49 top_groove_width = 1.0;
1.50 top_groove_depth = 2.0;
1.51 +
1.52 + /* Space for the back inside the front. */
1.53 +
1.54 inner_top_front_cutout_width = 87.0;
1.55 inner_top_front_cutout_depth = 1.0;
1.56 inner_top_front_cutout_offset = 2.0;
1.57 @@ -136,42 +158,51 @@
1.58 translate([0, -front_depth / 2, height / 2 - top / 2])
1.59 cube([width, front_depth, top], center = true);
1.60 difference() {
1.61 - translate([0, -front_depth / 2,
1.62 - -height / 2 + bottom / 2 + bottom_from_base])
1.63 - cube([width, front_depth, bottom], center = true);
1.64 - translate([-width / 2 + edge_connector_cutout_front_offset +
1.65 - edge_connector_cutout_front_width / 2,
1.66 - -edge_connector_cutout_front_depth / 2,
1.67 - -height / 2 + bottom / 2 + bottom_from_base])
1.68 - cube([edge_connector_cutout_front_width,
1.69 - edge_connector_cutout_front_depth,
1.70 - bottom + extra], center = true);
1.71 - translate([width / 2 - edge_connector_cutout_front_offset -
1.72 - edge_connector_cutout_front_width / 2,
1.73 - -edge_connector_cutout_front_depth / 2,
1.74 - -height / 2 + bottom / 2 + bottom_from_base])
1.75 - cube([edge_connector_cutout_front_width,
1.76 - edge_connector_cutout_front_depth,
1.77 - bottom + extra], center = true);
1.78 +
1.79 + /* Floor of cartridge. */
1.80 +
1.81 + cube_at(width, front_depth, bottom,
1.82 + 0, -1, 1,
1.83 + 0, 0, -height / 2 + bottom_from_base);
1.84 +
1.85 + /* Left cutout. */
1.86 +
1.87 + cube_at(edge_connector_cutout_front_width,
1.88 + edge_connector_cutout_front_depth,
1.89 + bottom,
1.90 + 1, -1, 1,
1.91 + -width / 2 + edge_connector_cutout_front_offset,
1.92 + 0,
1.93 + -height / 2 + bottom_from_base);
1.94 +
1.95 + /* Right cutout. */
1.96 +
1.97 + cube_at(edge_connector_cutout_front_width,
1.98 + edge_connector_cutout_front_depth,
1.99 + bottom,
1.100 + -1, -1, 1,
1.101 + width / 2 - edge_connector_cutout_front_offset,
1.102 + 0,
1.103 + -height / 2 + bottom_from_base);
1.104 }
1.105
1.106 /* PCB supports. */
1.107
1.108 - translate([-edge_connector_cutout_back_width / 2 +
1.109 - pcb_front_support_width / 2,
1.110 - -pcb_front_support_depth / 2,
1.111 - -height / 2 + bottom + bottom_from_base +
1.112 - pcb_front_support_height / 2])
1.113 - cube([pcb_front_support_width, pcb_front_support_depth,
1.114 - pcb_front_support_height], center = true);
1.115 + cube_at(pcb_front_support_width,
1.116 + pcb_front_support_depth,
1.117 + pcb_front_support_height,
1.118 + 1, -1, 1,
1.119 + -edge_connector_cutout_back_width / 2,
1.120 + 0,
1.121 + -height / 2 + bottom + bottom_from_base);
1.122
1.123 - translate([edge_connector_cutout_back_width / 2 -
1.124 - pcb_front_support_width / 2,
1.125 - -pcb_front_support_depth / 2,
1.126 - -height / 2 + bottom + bottom_from_base +
1.127 - pcb_front_support_height / 2])
1.128 - cube([pcb_front_support_width, pcb_front_support_depth,
1.129 - pcb_front_support_height], center = true);
1.130 + cube_at(pcb_front_support_width,
1.131 + pcb_front_support_depth,
1.132 + pcb_front_support_height,
1.133 + -1, -1, 1,
1.134 + edge_connector_cutout_back_width / 2,
1.135 + 0,
1.136 + -height / 2 + bottom + bottom_from_base);
1.137 }
1.138
1.139 /* Label insets. */
1.140 @@ -267,14 +298,20 @@
1.141 translate([0, back_depth / 2, height / 2 - top / 2])
1.142 cube([width, back_depth, top], center = true);
1.143 difference() {
1.144 - translate([0, back_depth / 2,
1.145 - -height / 2 + bottom / 2 + bottom_from_base])
1.146 - cube([width, back_depth, bottom], center = true);
1.147 - translate([0, edge_connector_cutout_back_depth / 2,
1.148 - -height / 2 + bottom / 2 + bottom_from_base])
1.149 - cube([edge_connector_cutout_back_width,
1.150 - edge_connector_cutout_back_depth,
1.151 - bottom + extra], center = true);
1.152 +
1.153 + /* Floor of cartridge. */
1.154 +
1.155 + cube_at(width, back_depth, bottom,
1.156 + 0, 1, 1,
1.157 + 0, 0, -height / 2 + bottom_from_base);
1.158 +
1.159 + /* Edge connector cutout. */
1.160 +
1.161 + cube_at(edge_connector_cutout_back_width,
1.162 + edge_connector_cutout_back_depth,
1.163 + bottom,
1.164 + 0, 1, 1,
1.165 + 0, 0, -height / 2 + bottom_from_base);
1.166 }
1.167
1.168 /* PCB supports. */
1.169 @@ -288,17 +325,14 @@
1.170 union() {
1.171 cube([pcb_back_support_width, pcb_back_support_depth,
1.172 pcb_back_support_height], center = true);
1.173 - translate([0,
1.174 - -pcb_back_support_depth / 2 -
1.175 - pcb_back_support_bump_depth / 2,
1.176 + cube_at(pcb_back_support_bump_width,
1.177 + pcb_back_support_bump_depth,
1.178 + pcb_back_support_left_bump_height,
1.179 + 0, -1, 1,
1.180 + 0,
1.181 + -pcb_back_support_depth / 2,
1.182 -pcb_back_support_height / 2 +
1.183 - pcb_back_support_left_bump_height / 2 +
1.184 - pcb_back_support_left_bump_offset_from_bottom
1.185 - ])
1.186 - cube([pcb_back_support_bump_width,
1.187 - pcb_back_support_bump_depth,
1.188 - pcb_back_support_left_bump_height],
1.189 - center = true);
1.190 + pcb_back_support_left_bump_offset_from_bottom);
1.191 }
1.192
1.193 translate([edge_connector_cutout_back_width / 2 -
1.194 @@ -310,17 +344,14 @@
1.195 union() {
1.196 cube([pcb_back_support_width, pcb_back_support_depth,
1.197 pcb_back_support_height], center = true);
1.198 - translate([0,
1.199 - -pcb_back_support_depth / 2 -
1.200 - pcb_back_support_bump_depth / 2,
1.201 + cube_at(pcb_back_support_bump_width,
1.202 + pcb_back_support_bump_depth,
1.203 + pcb_back_support_right_bump_height,
1.204 + 0, -1, 1,
1.205 + 0,
1.206 + -pcb_back_support_depth / 2,
1.207 -pcb_back_support_height / 2 +
1.208 - pcb_back_support_right_bump_height / 2 +
1.209 - pcb_back_support_right_bump_offset_from_bottom
1.210 - ])
1.211 - cube([pcb_back_support_bump_width,
1.212 - pcb_back_support_bump_depth,
1.213 - pcb_back_support_right_bump_height],
1.214 - center = true);
1.215 + pcb_back_support_right_bump_offset_from_bottom);
1.216 }
1.217 }
1.218