Skip to content

Commit 877e613

Browse files
committed
add buttoncap with keystem
1 parent 9ba2dc6 commit 877e613

3 files changed

Lines changed: 113 additions & 15 deletions

File tree

lib/utils.scad

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,52 @@ module load_svg(filename) {
144144
else {
145145
import(filename);
146146
}
147-
}
147+
}
148+
149+
150+
/*
151+
The code below is from keyv2
152+
https://github.com/rsheldiii/KeyV2
153+
154+
which is licensed under GPL
155+
156+
We only need the round cherry key stem
157+
*/
158+
159+
160+
161+
module rounded_cherry_stem(depth, slop, throw) {
162+
difference() {
163+
cylinder(d = $rounded_cherry_stem_d, h = depth);
164+
165+
// inside cross
166+
// translation purely for aesthetic purposes, to get rid of that awful lattice
167+
inside_cherry_cross($stem_inner_slop);
168+
}
169+
}
170+
171+
module inside_cherry_cross(slop) {
172+
// inside cross
173+
// translation purely for aesthetic purposes, to get rid of that awful lattice
174+
translate([0, 0, -SMALLEST_POSSIBLE]) {
175+
linear_extrude(height = $stem_throw) {
176+
square(cherry_cross(slop, extra_vertical)[0], center = true);
177+
square(cherry_cross(slop, extra_vertical)[1], center = true);
178+
}
179+
}
180+
181+
// Guides to assist insertion and mitigate first layer squishing
182+
if ($cherry_bevel) {
183+
for (i = cherry_cross(slop, extra_vertical)) hull() {
184+
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center = true);
185+
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center = true);
186+
}
187+
}
188+
}
189+
190+
function cherry_cross(slop, extra_vertical = 0) = [
191+
// horizontal tine
192+
[4.03 + slop, 1.25 + slop / 3],
193+
// vertical tine
194+
[1.15 + slop / 3, 4.23 + extra_vertical + slop / 3 + SMALLEST_POSSIBLE],
195+
];

src/LiteCase/buttonmount_cherry.scad

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
include <../../variables.scad>
2+
use <../../lib/utils.scad>
3+
4+
15
$fn = $preview ? 20 : 60;
26
z = [0, 0, 1];
37
y = [0, 1, 0];
@@ -12,6 +16,7 @@ z2 = -cz * 1.5;
1216
sizet = [cxy + 2, cxy + 2, 4];
1317
sizef = [cxy + 5, cxy + 5, h];
1418
z4 = -sizef[2] / 2;
19+
SMALLEST_POSSIBLE = 0.01;
1520

1621
if ($preview) import("/home/paulg/Downloads/kailh_low.stl");
1722
module hole() {
@@ -32,22 +37,27 @@ module cable() {
3237
}
3338
}
3439

35-
difference() {
36-
union() {
37-
translate(z4 * z)cube(sizef, center = true);
38-
translate(-4 * z)cube([7, cxy + 16, 8], center = true);
39-
}
40+
module button(detail = true) {
41+
difference() {
42+
union() {
43+
translate(z4 * z)cube(sizef, center = true);
44+
translate(-4 * z)cube([7, cxy + 16, 8], center = true);
45+
}
4046

41-
hole();
42-
#for (i = [-1, 1]) translate((cxy + 8) / 2 * y * i) rubber_ring();
43-
handlebar();
44-
cable();
45-
}
46-
difference() {
47-
translate(-0.1 * z)cube([7, cxy + 16, 0.2], center = true);
48-
hole();
47+
if (detail) {
48+
hole();
49+
for (i = [-1, 1]) translate((cxy + 8) / 2 * y * i) rubber_ring();
50+
handlebar();
51+
cable();
52+
}
53+
}
54+
difference() {
55+
translate(-0.1 * z)cube([7, cxy + 16, 0.2], center = true);
56+
hole();
57+
}
4958
}
5059

60+
button();
5161

5262
module rubber_ring() {
5363
translate(-18.5 * z)
@@ -90,4 +100,33 @@ module bottom(width = cxy, diam = 5) {
90100
}
91101
}
92102

93-
translate(y * 25) bottom();
103+
translate(y * 25) bottom();
104+
module buttoncutter(spacing = .5) {
105+
translate(-(spacing + 3.5) * z)minkowski() {
106+
cube(spacing,center=true);
107+
union() {button(detail = false);
108+
hull() {
109+
linear_extrude(1)translate((-cxy / 2 - 1) * (x + y))square([cxy + 2, cxy + 2]);
110+
translate(z * 2.5)linear_extrude(1)translate((-cxy / 2) * (x + y))square([cxy, cxy]);
111+
}
112+
}
113+
}
114+
}
115+
116+
117+
module buttontop(wall=3) {
118+
translate(-6 * z)rounded_cherry_stem(6, 5, 4);
119+
translate(-6 * z)rounded_cherry_stem(6, 5, 4);
120+
difference() {
121+
hull() {
122+
translate(-z)linear_extrude(1)translate((-cxy / 2 - 1) * (x + y))square([cxy + 2, cxy + 2]);
123+
translate(-5*z)linear_extrude(1)translate((-(cxy+5+wall )/ 2 ) * (x + y))square([cxy + 5+wall, cxy + 5+wall]);
124+
translate(-8*z)linear_extrude(1)translate((-(cxy+5+wall )/ 2 ) * (x + y))square([cxy + 5+wall, cxy + 5+wall]);
125+
126+
}
127+
translate(-z)buttoncutter();
128+
129+
}
130+
}
131+
132+
translate(-30 * y)buttontop();

variables.scad

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,14 @@ logo_generate_templates = false; // set to true to generate 2D template SVGs
301301
logo_name = "OpenBikeSensor"; // name of a folder inside `logo/`
302302
logo_mode = "normal"; // "normal" or "inverted"
303303
logo_part = "main"; // "main" or "highlight"
304+
305+
306+
// Lite case
307+
308+
// Lite handlebar button
309+
SMALLEST_POSSIBLE = .01;
310+
$stem_throw = 4;
311+
$cherry_bevel = false;
312+
$stem_inner_slop = 0.01;
313+
$rounded_cherry_stem_d = 5.5;
314+
extra_vertical = 0.2;

0 commit comments

Comments
 (0)