Skip to content

Commit 27b46e9

Browse files
committed
Merge branch 'obs_lite'
merge obs_lite to the case repo
2 parents f3f7cb1 + c7ed13d commit 27b46e9

File tree

7 files changed

+437
-8
lines changed

7 files changed

+437
-8
lines changed
-4.31 MB
Binary file not shown.

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/HandlebarButton.scad

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
include <../../variables.scad>
2+
use <../../lib/Round-Anything/polyround.scad>
3+
4+
use <../../lib/utils.scad>
5+
6+
7+
$fn = 60;
8+
z = [0, 0, 1];
9+
y = [0, 1, 0];
10+
x = [1, 0, 0];
11+
cz = 1.2;
12+
h = 15;
13+
cxy = 13.7;
14+
size = [cxy, cxy, h];
15+
z1 = -h / 2;
16+
sizeb = [cxy + 1, cxy, cz];
17+
z2 = -cz * 1.5;
18+
sizet = [cxy + 2, cxy + 2, 4];
19+
sizef = [cxy + 5, cxy + 5, h];
20+
z4 = -sizef[2] / 2;
21+
SMALLEST_POSSIBLE = 0.01;
22+
23+
//if ($preview) import("/home/paulg/Downloads/kailh_low.stl");
24+
module hole() {
25+
translate(z1 * z)cube(size, center = true);
26+
translate(z2 * z)cube(sizeb, center = true);
27+
translate(2 * z)cube(sizet, center = true);
28+
}
29+
30+
module handlebar()
31+
{
32+
translate((50) / 2 * y - 18.5 * z)rotate([90, 0, 0])cylinder(d = 25.4, h = 50);
33+
}
34+
35+
module cable() {
36+
hull() {
37+
translate([4.5, 0, -5])rotate([90, 0, 0])cylinder(d = 4, h = 20);
38+
translate([4.5, 0, -12])rotate([90, 0, 0])cylinder(d = 4, h = 20);
39+
}
40+
}
41+
42+
module hookprofile() {
43+
hull()for (i = [-1, 1])translate([0, i * 3])circle(d = 2.5);
44+
}
45+
46+
module support(zoffset) {
47+
hull() {
48+
translate([-1.25, 0, -0.2])linear_extrude(0.2)hookprofile();
49+
translate([2.5, 0, -0.2])linear_extrude(0.2)hookprofile();
50+
}
51+
hull() {
52+
translate([2.5, 0, -0.01])linear_extrude(0.01)hookprofile();
53+
translate([2.5, 0, -zoffset + 2.5])linear_extrude(0.2)hookprofile();
54+
translate([2.2, 0, -zoffset + 2.5])rotate([0, 90, 0])linear_extrude(0.6)hookprofile();
55+
}
56+
}
57+
module hookbase(zoffset) {
58+
translate(-zoffset * z)rotate(-[90, 0, 0]) {
59+
rotate_extrude(angle = 180) translate([2.5, 0]) hookprofile();
60+
hull() {
61+
translate([2.2, 0, 0])rotate([90, 0, 90])linear_extrude(0.6)hookprofile();
62+
translate([2.5, 0, 0])rotate([90, 0, 00])linear_extrude(0.2)hookprofile();
63+
}
64+
}
65+
support(zoffset);
66+
67+
}
68+
69+
70+
71+
module button(detail = true) {
72+
difference() {
73+
union() {
74+
translate(z4 * z)cube(sizef, center = true);
75+
if (detail) {
76+
translate(0.5 * [cxy + 5 + 2.5, 0, 0])hookbase(6);
77+
mirror([1, 0, 0])translate(0.5 * [cxy + 5 + 2.5, 0, 0])hookbase(6);
78+
}
79+
}
80+
81+
if (detail) {
82+
hole();
83+
handlebar();
84+
cable();
85+
}
86+
}
87+
88+
}
89+
90+
button();
91+
92+
93+
94+
95+
module buttoncutter(spacing = .5) {
96+
translate(-(spacing + 3.5) * z)minkowski() {
97+
cube(spacing, center = true);
98+
union() {button(detail = false);
99+
hull() {
100+
linear_extrude(1)translate((-cxy / 2 - 1) * (x + y))square([cxy + 2, cxy + 2]);
101+
translate(z * 2.5)linear_extrude(1)translate((-cxy / 2) * (x + y))square([cxy, cxy]);
102+
}
103+
}
104+
}
105+
}
106+
107+
module roundedsquare(sizes, r = 2) {
108+
points = [[0, 0, r],
109+
[sizes[0], 0, r],
110+
[sizes[0], sizes[1], r],
111+
[0, sizes[1], r]
112+
];
113+
echo(points);
114+
translate(0.5 * [-sizes[0], -sizes[1]])polygon(polyRound(points));
115+
}
116+
117+
118+
module buttontop(wall = 3) {
119+
translate(-6 * z)rounded_cherry_stem(6, 0.2, 4);
120+
translate(-6 * z)rounded_cherry_stem(6, 0.2, 4);
121+
difference() {
122+
hull() {
123+
translate(-z)linear_extrude(1)roundedsquare([cxy + 3, cxy + 3]);
124+
translate(-5 * z)linear_extrude(1)translate((-(cxy + 5 + wall) / 2) * (x + y))square([cxy + 5 + wall, cxy +
125+
5 + wall]);
126+
translate(-11 * z)linear_extrude(1)translate((-(cxy + 5 + wall) / 2) * (x + y))square([cxy + 5 + wall, cxy +
127+
5 + wall]);
128+
129+
}
130+
translate(-z)buttoncutter();
131+
translate(-4*z)cable();
132+
}
133+
}
134+
135+
translate(-30 * y)buttontop();

0 commit comments

Comments
 (0)