-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnut-knob.scad
104 lines (77 loc) · 2.53 KB
/
nut-knob.scad
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
//----------------------------------------------------------------------------
$fn = 36;
epsilon = 0.1;
nut_sizes = [
["m4", 7, 3 ],
["m5", 8, 4 ],
["m6", 10, 5 ],
["m8", 13, 6.5],
["m10",17, 8 ],
];
// distance between flats (wrench size)
function nut_width(size) = nut_sizes[search([size], nut_sizes)[0]][1];
function nut_height(size) = nut_sizes[search([size], nut_sizes)[0]][2];
//----------------------------------------------------------------------------
handle_thickness = 6;
//translate([50, 0, 0])
//knob(30, handle_thickness, "m5", roundover = 5);
translate([0, 0, 0])
knob(30, handle_thickness, "m6", roundover = 5);
translate([50, 0, 0])
knob(40, handle_thickness, "m8", roundover = 5);
//----------------------------------------------------------------------------
module knob(handle_diameter, handle_thickness, nut_size, roundover = 0) {
nut_width = nut_width(nut_size);
nut_height = nut_height(nut_size);
shaft_width = nut_width * 2;
shaft_height = nut_height;
nut_socket_depth = nut_height * 0.90;
mirror([0, 0, 1])
difference() {
union() {
handle(handle_diameter, handle_thickness);
translate([0, 0, -shaft_height])
shaft(shaft_width, shaft_height);
if (roundover > 0) {
translate([0, 0, -roundover / 2])
shaft_transition(shaft_width, roundover);
}
}
translate([0, 0, -(shaft_height + epsilon)])
nut_head(nut_width, nut_socket_depth + epsilon);
}
}
//----------------------------------------------------------------------------
module shaft_transition(d, r) {
rotate_extrude()
difference() {
translate([d / 2, 0])
square([r / 2, r / 2]);
translate([d / 2 + r / 2, 0])
circle(d = r);
}
}
//----------------------------------------------------------------------------
module handle(diameter, thickness, shaft_diameter, shaft_length) {
cylinder(d = diameter, h = thickness);
for (i = [0:45:360]) {
rotate([0, 0, i])
translate([diameter / 2.25, 0, 0])
cylinder(d = diameter / 4, h = thickness);
}
}
//----------------------------------------------------------------------------
module shaft(diameter, length) {
cylinder(d = diameter, h = length);
}
//----------------------------------------------------------------------------
module nut_head(width, height) {
side = width / sqrt(3);
for (i = [0, 60, 120]) {
rotate([0, 0, i])
translate([-side / 2, -width / 2, 0])
cube([side, width, height]);
}
}
//----------------------------------------------------------------------------
// vim:ft=openscad