AcornElectron

Changeset

41:bd66a16190db
2014-10-07 Paul Boddie raw files shortlog changelog graph Permitted the configuration of various features.
cartridge.scad (file)
     1.1 --- a/cartridge.scad	Tue Oct 07 00:39:32 2014 +0200
     1.2 +++ b/cartridge.scad	Tue Oct 07 15:20:20 2014 +0200
     1.3 @@ -19,6 +19,13 @@
     1.4  {
     1.5  	$fn = 50;
     1.6  
     1.7 +	/* Configure the generated shapes. */
     1.8 +
     1.9 +	BACK_CAVITY = 1;
    1.10 +	FRONT_LABEL_INSET = 1;
    1.11 +	TOP_LABEL_INSET = 1;
    1.12 +	GROOVE = 1;
    1.13 +
    1.14  	/*
    1.15  	Rounding/fillet radius and additional margin of subtracted
    1.16  	material. The additional margin helps avoid geometry problems.
    1.17 @@ -120,9 +127,13 @@
    1.18  	top_label_depth = front_label_depth;
    1.19  	top_label_offset_from_front = 2.5;
    1.20  
    1.21 -	/* The groove around the sides and top. */
    1.22 +	/*
    1.23 +	The groove around the sides and top. This is extended to allow the
    1.24 +	pieces to fit together, and this extension is generated regardless of
    1.25 +	whether the visible groove is enabled or not.
    1.26 +	*/
    1.27  
    1.28 -	groove_width_exposed = 1.5;
    1.29 +	groove_width_exposed = GROOVE ? 1.5 : 0;
    1.30  	groove_width = groove_width_exposed + groove_width_extra;
    1.31  	groove_depth = 1.0; /* how deep the groove goes into each side */
    1.32  
    1.33 @@ -425,18 +436,20 @@
    1.34  
    1.35  			/* Front label. */
    1.36  
    1.37 -			translate([-front_label_width / 2, -front_depth,
    1.38 -				front_label_offset_from_bottom - height / 2])
    1.39 -				cube([front_label_width, front_label_depth,
    1.40 -					front_label_height]);
    1.41 +			if (FRONT_LABEL_INSET)
    1.42 +				translate([-front_label_width / 2, -front_depth,
    1.43 +					front_label_offset_from_bottom - height / 2])
    1.44 +					cube([front_label_width, front_label_depth,
    1.45 +						front_label_height]);
    1.46  
    1.47 -			/* Top label. */
    1.48 +			/* Top label. See also the back piece. */
    1.49  
    1.50 -			translate([-top_label_width / 2,
    1.51 -				-front_depth + top_label_offset_from_front,
    1.52 -				height / 2 - top_label_depth])
    1.53 -				cube([top_label_width, top_label_height,
    1.54 -					top_label_depth]);
    1.55 +			if (TOP_LABEL_INSET)
    1.56 +				translate([-top_label_width / 2,
    1.57 +					-front_depth + top_label_offset_from_front,
    1.58 +					height / 2 - top_label_depth])
    1.59 +					cube([top_label_width, top_label_height,
    1.60 +						top_label_depth]);
    1.61  		}
    1.62  
    1.63  		/* Inner front edge cavity. */
    1.64 @@ -508,6 +521,11 @@
    1.65  		}
    1.66  	}
    1.67  
    1.68 +	/*
    1.69 +	Place the back piece next to the front, with the internals facing out
    1.70 +	the same way.
    1.71 +	*/
    1.72 +
    1.73  	translate([width * 0.6, 0, 0])
    1.74  	rotate([0, 0, 180])
    1.75  	difference() {
    1.76 @@ -560,13 +578,14 @@
    1.77  
    1.78  		union() {
    1.79  
    1.80 -			/* Top label. */
    1.81 +			/* Top label. See also the front piece. */
    1.82  
    1.83 -			translate([-top_label_width / 2,
    1.84 -				-front_depth + top_label_offset_from_front,
    1.85 -				height / 2 - top_label_depth])
    1.86 -				cube([top_label_width, top_label_height,
    1.87 -					top_label_depth]);
    1.88 +			if (TOP_LABEL_INSET)
    1.89 +				translate([-top_label_width / 2,
    1.90 +					-front_depth + top_label_offset_from_front,
    1.91 +					height / 2 - top_label_depth])
    1.92 +					cube([top_label_width, top_label_height,
    1.93 +						top_label_depth]);
    1.94  		}
    1.95  
    1.96  		/* Top and side grooves, positioned in the back portion. */
    1.97 @@ -599,37 +618,38 @@
    1.98  
    1.99  		/* Back cavity. */
   1.100  
   1.101 -		intersection() {
   1.102 +		if (BACK_CAVITY)
   1.103 +			intersection() {
   1.104  
   1.105 -			/* From the bottom upwards. */
   1.106 +				/* From the bottom upwards. */
   1.107  
   1.108 -			translate([0, back_depth, -height / 2])
   1.109 -				linear_extrude(height = back_cavity_height)
   1.110 -					translate([-int_width / 2, 0, 0])
   1.111 -						polygon([
   1.112 -							[back_cavity_offset_from_inner_left, 0],
   1.113 -							[back_cavity_inner_offset_from_inner_left,
   1.114 -								-back_cavity_depth],
   1.115 -							[back_cavity_inner_offset_from_inner_left +
   1.116 -								back_cavity_inner_width,
   1.117 -								-back_cavity_depth],
   1.118 -							[back_cavity_offset_from_inner_left +
   1.119 -								back_cavity_width, 0]
   1.120 -							]);
   1.121 +				translate([0, back_depth, -height / 2])
   1.122 +					linear_extrude(height = back_cavity_height)
   1.123 +						translate([-int_width / 2, 0, 0])
   1.124 +							polygon([
   1.125 +								[back_cavity_offset_from_inner_left, 0],
   1.126 +								[back_cavity_inner_offset_from_inner_left,
   1.127 +									-back_cavity_depth],
   1.128 +								[back_cavity_inner_offset_from_inner_left +
   1.129 +									back_cavity_inner_width,
   1.130 +									-back_cavity_depth],
   1.131 +								[back_cavity_offset_from_inner_left +
   1.132 +									back_cavity_width, 0]
   1.133 +								]);
   1.134  
   1.135 -			/* From left to right. */
   1.136 +				/* From left to right. */
   1.137  
   1.138 -			translate([back_cavity_width / 2, back_depth, -height / 2])
   1.139 -				rotate([0, -90, 0])
   1.140 -					linear_extrude(height = back_cavity_width)
   1.141 -						polygon([
   1.142 -							[-extra, -back_cavity_depth],
   1.143 -							[back_cavity_inner_height,
   1.144 -								-back_cavity_depth],
   1.145 -							[back_cavity_height, 0],
   1.146 -							[-extra, 0]
   1.147 -							]);
   1.148 -		}
   1.149 +				translate([back_cavity_width / 2, back_depth, -height / 2])
   1.150 +					rotate([0, -90, 0])
   1.151 +						linear_extrude(height = back_cavity_width)
   1.152 +							polygon([
   1.153 +								[-extra, -back_cavity_depth],
   1.154 +								[back_cavity_inner_height,
   1.155 +									-back_cavity_depth],
   1.156 +								[back_cavity_height, 0],
   1.157 +								[-extra, 0]
   1.158 +								]);
   1.159 +			}
   1.160  
   1.161  		/* Inner back cavities. */
   1.162