source code for html website at https://zachdecook.com
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
width=85.6;
height=53.98 + 3;

bobbyh = .7;//measured at .6 height and 1.6 at the bubble for a single stalk
// it's also 1.5 wide, but we're not using that measurement here.
bobbyl = 50; // length of bobby pin
bobbyscooch = 10;// how much the bobby pin can scooch up: should be at least 7.

coinThick=1.75+.2;
coinR = 12.13 + .1 + (bobbyh/2) + .1;

thumbSlot = 7-1;
walls=.8;
roundy=.5;
invisit = 1;

$fn = 30;


dollarR=13.254+.1 + .7 + (bobbyh/2);
dollarT=2+.1 + .2;

/**
 * @param Tracks: array of arrays like [ [y,z,thumb,rad,thick], [y,z] ]
 */
module coinCard(tracks)
{
	difference(){
		//Base block
		minkowski(){
			cube([dollarT+2*walls-2*roundy,width-2*roundy,height-2*roundy]);
			translate([roundy,roundy,roundy])sphere(roundy);
		}
		for( track = tracks )
		{
			// Inner slot
			for(i=[1:1:len(track)-1])
			{
				hull()
				{
					#translate([walls,track[i][0],track[i][1]])rotate([0,90,0])
						cylinder(r=track[0][3],h = track[0][4]);
					#translate([walls,track[i-1][0],track[i-1][1]])rotate([0,90,0])
						cylinder(r=track[0][3],h = track[0][4]);
				}
			}
			//thumb slot
			if(track[0][2])
			{
				for(i=[1:1:len(track)-1])
				{
					color(c=[i/(len(track)-1),i%2/(len(track)-1),i%3/(len(track)-1)])hull()
					{
						translate([-invisit,track[i][0],track[i][1]])rotate([0,90,0])cylinder(r=thumbSlot,h = coinThick+invisit);
						translate([-invisit,track[i-1][0],track[i-1][1]])rotate([0,90,0])cylinder(r=thumbSlot,h = coinThick+invisit);
					}
				}
			}
		}
		// cut through the model (easier debugging)
		//translate([-1,0,0])cube([25,45,100]);
	}
}

// dollar coins and quarters
/*translate([-10,0,0])coinCard([
	[ [width-coinR-walls,height-coinR-walls,true,coinR,coinThick], [0,height-coinR-walls] ],
	[ [width-dollarR-walls,dollarR+walls,true,dollarR,dollarT], [0, dollarR+walls] ],
]);*/

pennyR = (19.05/2) + .7;
pennyT = 1.52 + .2;

dimeR = (17.91 /2) + .7 + .1;
dimeT = 1.35 + .2;

nicR = (21.21/2) + .7;
nicT = 1.95 + .2;

angle = 50;
zigZ = cos(angle)*2;//6/5;//sqrt(2);
zigY = sin(angle)*2;//8/5;//sqrt(2);

difference(){
	union(){
		// A nickel in front of the dimes, and pennies
		translate([0,0,0])coinCard([
			[ [width-pennyR-walls,height-pennyR-walls,true,pennyR,pennyT], [0,height-pennyR-walls] ],
			[
				[width-dimeR-walls,
					dimeR+walls+(dimeR*zigZ),true,dimeR,dimeT],
				[width-dimeR-walls - (dimeR*zigY),
					dimeR+walls ],
				[width-dimeR-walls - (dimeR*zigY*2),
					dimeR+walls+(dimeR*zigZ)],
				[width-dimeR-walls - (dimeR*zigY*3),
					dimeR+walls],
				[nicR+walls, height-(pennyR*2)-walls - nicR-walls]
				
			],
			[
				[nicR+walls,
					height-(pennyR*2)-walls-nicR-walls,true,nicR,nicT],
				[0, height-(pennyR*2)-walls - nicR-walls]
			],
		]);
		// dollar coins and quarters
		color("green")translate([dollarT+2*walls + dollarT + 1*walls+.1,0,0])mirror([1,0,0])coinCard([
			[ [width-coinR-walls,height-coinR-walls,true,coinR,coinThick], [0,height-coinR-walls] ],
			[ [width-dollarR-walls,dollarR+walls,true,dollarR,dollarT], [0, dollarR+walls] ],
		]);
	}
	// cut a little hole for us to put our bobbypin through
	#translate([4,bobbyl-bobbyscooch,dollarR*2 + walls-invisit])cube([dollarT,bobbyscooch,2+invisit]);
	#translate([walls,bobbyl-bobbyscooch,height - (pennyR*2) - (walls*2)-invisit])
		cube([dollarT,bobbyscooch,2+invisit]);
	// a spot for the bobby pin to slide next to the dime zig-zag
	#translate([walls,0,height - (pennyR*2) - (walls*2)-1.6-.4])
		cube([dollarT,bobbyl,1.6+.4]);
}

/*translate([20,0,0])coinCard([
	[ [width-pennyR-walls,height-pennyR-walls,true,pennyR,pennyT], [0,height-pennyR-walls] ],
	[[width-pennyR-walls,height-pennyR-walls,false,pennyR,pennyT],[width-pennyR-walls,pennyR+walls]],
	[ [width-pennyR-walls,pennyR+walls,true,pennyR,pennyT], [pennyR+walls,pennyR+walls] ],
]);*/