summaryrefslogtreecommitdiff
path: root/experimental/spool-holder.scad
blob: 9eaeedfe5e4f18d5606c6578e32b41c5f511bb0f (plain)
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
module truncated_teardrop(height, radius)
{
	rotate([0, 90, 0])
	union()
	{
		cylinder(height, radius, radius);
	
		linear_extrude(height=height)
		polygon([
			[radius*cos(135), radius*sin(135)],
			[-radius*1.1,  radius*0.313],
			[-radius*1.1, -radius*0.313],
			[radius*cos(225), radius*sin(225)],
		]);
	}
}

module twelvegon(radius, z0, z1)
{
	translate([0, 0, z0])
	linear_extrude(height = z1 - z0)
	polygon([
		[radius*cos( 360*1/24),radius*sin( 360*1/24)],
		[radius*cos( 360*3/24),radius*sin( 360*3/24)],
		[radius*cos( 360*5/24),radius*sin( 360*5/24)],
		[radius*cos( 360*7/24),radius*sin( 360*7/24)],
		[radius*cos( 360*9/24),radius*sin( 360*9/24)],
		[radius*cos( 360*11/24),radius*sin( 360*11/24)],
		[radius*cos( 360*13/24),radius*sin( 360*13/24)],
		[radius*cos( 360*15/24),radius*sin( 360*15/24)],
		[radius*cos( 360*17/24),radius*sin( 360*17/24)],
		[radius*cos( 360*19/24),radius*sin( 360*19/24)],
		[radius*cos( 360*21/24),radius*sin( 360*21/24)],
		[radius*cos( 360*23/24),radius*sin( 360*23/24)],
	]);
}

module hub(radius, rod_diameter)
{
	c15 = cos(15);
	inner_corner = (radius*c15 - 10) / c15;
	inner_edge = inner_corner * c15;
	outer_edge = inner_edge + 10;
  cross = outer_edge - max(5, 4+rod_diameter/2);
	triangle = cross - (4+rod_diameter/2);

	difference()
	{
		union()
		{
			// Add material to support the bearing
			cylinder(11, 16, 16);

			// Add material for body
			difference()
			{
				twelvegon(radius, 0, 10);
				twelvegon(inner_corner, 5, 20);
			}

			for ( i = [0:5] )
			{
				// Add material to support the cross brace
				rotate([0,0,i*60])
				rotate([0, 0, 360/12])
				translate([cross, 0, 0])
				cylinder(10, 4+rod_diameter/2, 4+rod_diameter/2);

				// Add material to support the spoke
				rotate([0,0,i*60])
				translate([inner_edge, 0, 8])
				rotate([0, 90, 0])
				cylinder(10, 4+rod_diameter/2, 4+rod_diameter/2);
			}
		}

		// Axel
		translate([0,0,-5])
		cylinder (h = 25, r=9);

		// Bearing
		translate([0,0,3])
		cylinder (h = 25, r=11);

		for ( i = [0:5] )
		{
			// Spoke nut
			rotate([0,0,i*60])
			translate([0,0,-5])
			linear_extrude(height=15)
			polygon([
				[inner_edge, -7],
				[inner_edge, 7],
				[20, 7],
				[20, -7],
			]);
			
			// Triangle gap
			if (triangle > 30)
			{
				rotate([0,0,i*60])
				translate([0,0,-5])
				linear_extrude(height=15)
				polygon([
					[25 * cos(360*4/48), 25 * sin(360*4/48)],
					[triangle * cos(360*2/48), triangle * sin(360*2/48)],
					[triangle * cos(360*6/48), triangle * sin(360*6/48)],
				]);
			}			
	
			// Spoke
			rotate([0,0,i*60])
			translate([17, 0, max(5, 4+rod_diameter/2)])
			truncated_teardrop(radius, 0.2 + rod_diameter/2);
	
			// Cross Brace
			rotate([0,0,i*60])
			rotate([0, 0, 360/12])
			translate([cross, 0, -5])
			cylinder(30, 0.2 + rod_diameter/2, 0.2 + rod_diameter/2);
		}
	}
}

hub(radius=70, rod_diameter=8);