forked from crystalhand/dactyl-keyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hotswap code.txt
138 lines (118 loc) · 5.47 KB
/
hotswap code.txt
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
Here is the code I use for the hotswaps The below will need to be in your build file
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;;quality settings;;;;;;;;;;;
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@
(def wall-step 0.2)
(def wall-sphere-n 30) ;;30 for high quality Sphere resolution, lower for faster renders mainly present on case edge top. can effect wall thickness
(def circle_facets 100) ;;100 for high quality
;@@@@@@@@@@@@@@@@@@@@@
;switch hole code;;;;;
;@@@@@@@@@@@@@@@@@@@@@
(def Kalih_features ;;Contains the solder points and the protruding circles
(union
(->> (union
(->> (cylinder 1.65 1.5)(with-fn circle_facets)(translate [0 0 0]));;increased diameter by .02
(difference ;;this is for making the slope for the left hole.
(->> (cylinder 1.65 4)(with-fn circle_facets)(rotate (deg2rad 35) [1 0 0]));;increased diameter by .02
(->>(cube 4 4 4)(translate [0 -2 0])))
(->> (cylinder 1.6 1.5)(with-fn circle_facets)(translate [6.35 2.540 0]))
(->>(difference ;;this is for making the slope for the right hole.
(->> (cylinder 1.6 3.2)(with-fn circle_facets))
(->>(cube 4 4 4)(translate [0 -2 0])))
(rotate (deg2rad 15) [1 0 0])(translate [6.35 2.540 0.5]))
) (translate [-3.17 -1.27 1.65]))
(->> (cube 2.7 1.9 1.8)(translate [6.8 1.5 0])) ;right solder point on kalih socket
(->> (cube 2.7 1.9 1.8)(translate [-6.8 -1.5 0]));;left solder point
)
)
(def kalih_socket
(difference
(union (cube 12 (+ sla_tolerance 6) ( + 1.825 sla_tolerance))
Kalih_features)
(->> (cube 3.7 4 3)(translate [4.1 (- -3.05 (/ sla_tolerance 2)) 0])) ;; (->> (cube 3.2 3 3)(translate [4.1 -2.6 0]))
))
(def kalih_socket_thumbs
(difference
(union (cube 12 (+ sla_tolerance 6.3) ( + 2 sla_tolerance))
Kalih_features)
(->> (cube 3.7 4 3)(translate [4.1 (- -3.05 (/ sla_tolerance 2)) 0])) ;; (->> (cube 3.2 3 3)(translate [4.1 -2.6 0]))
))
(def kalih_tab
(union
(->> (difference
(->>( cube 9 2.7 1.5)(translate [0 2.95 -2.25]) )
(->> (cube 9.1 1 2.5)(translate [0 0.9 -2.45])(rotate (deg2rad 15) [1 0 0])) ;decreased translate y by ;;controls the clip in part of the kalih socket holder overhang
))
(difference
(->>( cube 3.8 2.3 1.)(translate [-3.6 -4.1 -2.0]) ) ;;to prevent cracking decreased cube y from 2.3 to 2
;(->> (cube 4.8 1.8 0.9)(rotate (deg2rad 55) [1 0 0])(translate [-3.6 -3.25 -2.6]))
)))
(def kalih_tab_thumb
(union
(->> (difference
(->>( cube 9 2.7 1.5)(translate [0 2.95 -2.25]) )
(->> (cube 9.1 1 2.5)(translate [0 1.1 -2.45])(rotate (deg2rad 15) [1 0 0])) ;decreased translate y by ;;controls the clip in part of the kalih socket holder overhang
))
(difference
(->>( cube 3.8 2.7 1.)(translate [-3.6 -4. -2.0]) ) ;;to prevent cracking decreased cube y from 2.3 to 2
;(->> (cube 4.8 1.8 0.9)(rotate (deg2rad 55) [1 0 0])(translate [-3.6 -3.25 -2.6]))
)))
(def kalih_cutout
(->>(union
(difference
(union
(->> (cube 11 17.6 3.2)(translate [ 0 -4.5 0])) ;main box that the switch is cut from
(->>(cube 17.4 17.6 1)(translate [ 0.7 -4.5 1.1])) ;bottom cover that covers the remainder of the bottom of the switch hole
kalih_tab
)
#_(->> (cube 11 9.4 3)(translate [ 0 -0.4 0]))
(->> kalih_socket(translate [-0.4 -0.6 -0.71]))
(->> (cylinder (+ (/ sla_tolerance 2) 2.1) 4)(with-fn circle_facets)(translate [0.3 -4.5 0]))
(->>(cube 20 10 5)(translate [0 -13 0])) ;;This cuts out part of the bottom cover. Used to ensure drainage when SLA printing.
))
(translate [-0.7 4.5 -1]))
)
(def kalih_cutout_thumb
(->>(union
(difference
(union
(->> (cube 11 17.6 3.2)(translate [ 0 -4.5 0])) ;main box that the switch is cut from
(->>(cube 17.4 17.6 1)(translate [ 0.7 -4.5 1.1])) ;bottom cover that covers the remainder of the bottom of the switch hole
kalih_tab_thumb
)
#_(->> (cube 11 9.4 3)(translate [ 0 -0.4 0]))
(->> kalih_socket_thumbs(translate [-0.4 -0.6 -0.71]))
(->> (cylinder (+ (/ sla_tolerance 2) 2.1) 4)(with-fn circle_facets)(translate [0.3 -4.5 0]))
(->>(cube 20 10 5)(translate [0 -13 0])) ;;This cuts out part of the bottom cover. Used to ensure drainage when SLA printing.
))
(translate [-0.7 4.5 -1]))
)
(def MX_Clone_hole_hotswap ;;Special hole for hotswap holes because the box has to be a bit bigger so it makes contact with the kalih cutout.
(->>(difference
(union
(->>(cube 17.5, 17.6, 5)(translate [0 0 -0.9])) ;;Main box that everything is cut from
)
(->>(cube 14.8, 13.8, 6)(translate [0 0 -1]) ) ;;Inner square cut out
(->>(cube 14.2, 15., 4.32)(translate [0, 0, -2])) ;;The buttom inner cut out. This modifies the notch height
(->> (cube 3.7,15., 6)(translate [(/ 8.5 2), 0, -1]));Left and right rectangle cut out. Controls the width of notch
(->> (cube 3.7,15., 6)(translate [(/ -8.5 2), 0, -1]))
)(translate [0, 0 4.]))
)
(def hotswap_hole_sla
(->>(union
MX_Clone_hole_hotswap
(->> kalih_cutout (translate [0 0 0]))
)(translate [0 0 0])(rotate (deg2rad 180) [0 0 1]))
)
(def hotswap_hole_sla_thumb
(->>(union
MX_Clone_hole_hotswap
(->> kalih_cutout_thumb (translate [0 0 0]))
)(rotate (deg2rad 180) [0 0 1]))
)
(def temp-single-plate
;(if (== hot_swappable 1) (->> (union (->> MX_Clone_hole(rotate (/ π 2) [0 0 1])) (->> kalih_cutout)(rotate (/ π 2) [0 0 1])))
(if (== hot_swappable 1) (->> hotswap_hole_sla (translate [0 0 -1.6]))
(if (== switch-type 1) cherry-single-plate
(if (== switch-type 2) Matias-single-plate
(if (== switch-type 3) MX_Clone_hole))))