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
|
/* base */
base_w = 10;
roundness = 0.5; /* should match offset constraint in sovlespace */
wall_thickness = 1.0;
side_dxf = "knob_side.dxf";
/* stem */
stem_wall_thickness = 1.5;
stem_w = 2.4;
stem_h = 6.8;
cut_corners_w = 1.6;
cut_corners_h = 2.0;
/* don't touch */
lots = 1000;
eps = 0.01;
module offset_shell(offx) {
intersection() {
translate([-lots/2, 0, 0])
square([lots, lots]);
offset(r=-offx)
union() {
children();
mirror([0, 1, 0]) children();
}
}
}
module dxf_shell(file, w, d, r) {
intersection() {
translate([0, 0, lots/2])
cube([lots, lots, lots], center=true);
difference() {
minkowski(){
sphere(r=r, $fn=32);
rotate([90, 0, 0])
linear_extrude(height=w - 2*r, center=true)
offset_shell(r)
import(file, $fn=128);
}
translate([0, 0, -eps])
rotate([90, 0, 0])
linear_extrude(height=w-2*d, center=true)
offset_shell(d)
import(file, $fn=128);
}
}
}
module stem() {
difference() {
cube([stem_h + 2*stem_wall_thickness, stem_w + 2*stem_wall_thickness, lots], center=true);
cube([stem_h, stem_w, lots], center=true);
translate([0, 0, -lots/2])
cube([lots, lots, lots], center=true);
translate([-(stem_h+stem_wall_thickness)/2-eps, -(stem_w+stem_wall_thickness)/2-eps, 0])
cube([cut_corners_h, cut_corners_w, lots], center=true);
translate([(stem_h+stem_wall_thickness)/2+eps, -(stem_w+stem_wall_thickness)/2-eps, 0])
cube([cut_corners_h, cut_corners_w, lots], center=true);
translate([-(stem_h+stem_wall_thickness)/2-eps, (stem_w+stem_wall_thickness)/2+eps, 0])
cube([cut_corners_h, cut_corners_w, lots], center=true);
translate([(stem_h+stem_wall_thickness)/2+eps, (stem_w+stem_wall_thickness)/2+eps, 0])
cube([cut_corners_h, cut_corners_w, lots], center=true);
}
}
ridge_w = 0.8;
ridge_f = 0.3;
ridge_h = 3.7;
difference() {
union () {
dxf_shell(side_dxf, base_w, wall_thickness, roundness);
intersection() {
stem();
rotate([90, 0, 0])
linear_extrude(height=base_w, center=true)
import(side_dxf, $fn=128);
}
}
translate([0, -base_w/2 - ridge_w*ridge_f, -eps])
cylinder(d=ridge_w, h=lots, $fn=32);
translate([0, base_w/2 + ridge_w*ridge_f, -eps])
cylinder(d=ridge_w, h=lots, $fn=32);
translate([0, 0, ridge_h])
rotate([90, 0, 0])
cylinder(d=ridge_w, h=lots, center=true, $fn=32);
}
|