11include < ../../variables.scad>
2+ use < ../../lib/Round- Anything/polyround.scad>
3+
24use < ../../lib/utils.scad>
35
46
@@ -18,7 +20,7 @@ sizef = [cxy + 5, cxy + 5, h];
1820z4 = - sizef[2 ] / 2 ;
1921SMALLEST_POSSIBLE = 0.01 ;
2022
21- if ($ preview) import("/home/paulg/Downloads/kailh_low.stl" );
23+ // if ($preview) import("/home/paulg/Downloads/kailh_low.stl");
2224module hole() {
2325 translate (z1 * z)cube (size, center = true );
2426 translate (z2 * z)cube (sizeb, center = true );
@@ -36,80 +38,60 @@ module cable() {
3638 translate ([4.5 , 0 , - 12 ])rotate ([90 , 0 , 0 ])cylinder (d = 4 , h = 20 );
3739 }
3840}
39- module hookbase() linear_extrude(0.01) hull() {
40- for (i= [- 1 ,1 ])translate ([0 ,i* 3 ,0 ])circle(d= 2.5 );
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+ }
4156}
42- hull (){
43- translate (0.5 * [cxy+ 5 ,0 ,- 17 ])rotate ([0 ,90 ,0 ]) hookbase();
44-
45- translate (0.5 * [cxy+ 10 ,0 ,- 17 ])rotate ([0 ,45 ,0 ]) scale ([sqrt (2 ),1 ,1 ])hookbase();
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);
4666
4767}
68+
69+
70+
4871module button(detail = true) {
4972 difference () {
5073 union () {
5174 translate (z4 * z)cube (sizef, center = true );
52- * if (detail) translate (- 4 * z)cube ([7 , cxy + 16 , 8 ], 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+ }
5379 }
5480
5581 if (detail) {
5682 hole();
57- * for (i = [- 1 , 1 ]) translate ((cxy + 8 ) / 2 * y * i) rubber_ring();
5883 handlebar();
5984 cable();
6085 }
6186 }
62- * if (detail)difference () {
63- translate (- 0.1 * z)cube ([7 , cxy + 16 , 0.2 ], center = true );
64- hole();
65- }
66- }
67-
68- button();
6987
70- module rubber_ring(inner=false) {
71- translate (- 18.5 * z)
72- rotate ([90 , 0 , 0 ])
73- rotate_extrude()
74- translate ([25.4 / 2 + 1.5 + 1 , 0 , 0 ])
75- {
76- hull () {
77- circle(d = 3 );
78- translate ([inner?- 5 :5 , 0 , 0 ])circle(d = 3 );
79- }
80- }
8188}
8289
90+ button();
8391
84- module bottom_shape(diam = 5) {
85- difference () {
86- translate ([0 , 0 , - 7.5 ])cube ([15 , 15 , 15 ], center = true );
87- translate (2 * z)handlebar();
88- for (i = [- 1 , 1 ])rotate ([0 , 20 * i, 0 ])translate ([i * (diam + 1.5 ), 0 , 0 ])rotate_extrude() hull () {
89- translate ([4 , 0 , 0 ]) circle(d = 3 );
90- translate ([4 , 4 , 0 ]) circle(d = 3 );
91- }
92-
93- }
9492
95- }
9693
97- // rotate(-x*90)linear_extrude(cxy-5*3)
98- module bottom(width = cxy, diam = 5) {
99- rotate (- x * 90 )linear_extrude(width - diam) projection(cut = true ) {
100- rotate (x * 90 )bottom_shape(diam);
101- }
102- difference () {
103- bottom_shape(diam);
104- translate (y * (20 + 0.01 ))cube ([40 , 40 , 40 ], center = true );
105- }
106- translate (y * (width - diam))difference () {
107- bottom_shape(diam);
108- translate (- y * (20 + 0.01 ))cube ([40 , 40 , 40 ], center = true );
109- }
110- }
11194
112- translate (y * 25 ) bottom();
11395module buttoncutter(spacing = .5) {
11496 translate (- (spacing + 3.5 ) * z)minkowski () {
11597 cube (spacing, center = true );
@@ -122,21 +104,31 @@ module buttoncutter(spacing = .5) {
122104 }
123105}
124106
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+
125117
126118module buttontop(wall = 3) {
127119 translate (- 6 * z)rounded_cherry_stem(6 , 0.2 , 4 );
128120 translate (- 6 * z)rounded_cherry_stem(6 , 0.2 , 4 );
129121 difference () {
130122 hull () {
131- translate (- z)linear_extrude(1 )translate (( - cxy / 2 - 1 ) * (x + y))square( [cxy + 2 , cxy + 2 ]);
123+ translate (- z)linear_extrude(1 )roundedsquare( [cxy + 3 , cxy + 3 ]);
132124 translate (- 5 * z)linear_extrude(1 )translate ((- (cxy + 5 + wall) / 2 ) * (x + y))square([cxy + 5 + wall, cxy +
133125 5 + wall]);
134126 translate (- 11 * z)linear_extrude(1 )translate ((- (cxy + 5 + wall) / 2 ) * (x + y))square([cxy + 5 + wall, cxy +
135127 5 + wall]);
136128
137129 }
138130 translate (- z)buttoncutter();
139- * for (i = [ - 1 , 1 ]) translate ((cxy + 8 ) / 2 * y * i + z *- 6 ) rubber_ring( true );
131+ translate (- 4 * z)cable( );
140132 }
141133}
142134
0 commit comments