Fix keycaps and add plate generation

This commit is contained in:
Hunter Praska 2020-05-03 01:34:36 -05:00
parent 9cd6573d5d
commit cf7115bf05
No known key found for this signature in database
GPG key ID: 3C9EB5EA0CBC4417
2 changed files with 80 additions and 41 deletions

1
.gitignore vendored
View file

@ -11,3 +11,4 @@
*.stl
*.ai
*.svg
*.dxf

View file

@ -171,6 +171,11 @@
(translate [0 0 (+ 5 plate-thickness)])
(color [240/255 223/255 175/255 1])))})
;; Fill the keyholes instead of placing a a keycap over them
(def keyhole-fill (let [fill (cube keyswitch-height keyswitch-width plate-thickness)]
(->> fill
(translate [0 0 (/ plate-thickness 2)]))))
;;;;;;;;;;;;;;;;;;;;;;;;;
;; Placement Functions ;;
;;;;;;;;;;;;;;;;;;;;;;;;;
@ -192,6 +197,7 @@
(defn offset-for-column [col, row]
(if (and (true? pinky-15u) (= col lastcol) (<= row last-15u-row) (>= row first-15u-row)) 4.7625 0))
(defn apply-key-geometry [translate-fn rotate-x-fn rotate-y-fn column row shape]
(let [column-angle (* β (- centercol column))
placed-shape (->> shape
@ -262,12 +268,28 @@
(key-place column row)))))
(def caps
(apply union
(for [column columns
(conj (for [column columns
row rows
:when (or (.contains [2 3] column)
(not= row lastrow))]
(->> (sa-cap (if (and (true? pinky-15u) (= column lastcol)) 1.5 1))
(key-place column row)))))
:when (or (and (= column 0) (< row 3))
(and (.contains [1 2] column) (< row 4))
(.contains [3 4 5 6] column))]
(->> (sa-cap (if (and (true? pinky-15u) (= column lastcol) (not= row lastrow)) 1.5 1))
(key-place column row)))
(list (key-place 0 0 (sa-cap 1))
(key-place 0 1 (sa-cap 1))
(key-place 0 2 (sa-cap 1))))))
(def caps-fill
(apply union
(conj (for [column columns
row rows
:when (or (and (= column 0) (< row 3))
(and (.contains [1 2] column) (< row 4))
(.contains [3 4 5 6] column))]
(key-place column row keyhole-fill))
(list (key-place 0 0 keyhole-fill)
(key-place 0 1 keyhole-fill)
(key-place 0 2 keyhole-fill)))))
;placement for the innermost column
(def key-holes-inner
@ -486,6 +508,11 @@
(thumb-1x-layout (sa-cap 1))
(thumb-15x-layout (rotate (/ π 2) [0 0 1] (sa-cap 1.5)))))
(def thumbcaps-fill
(union
(thumb-1x-layout keyhole-fill)
(thumb-15x-layout (rotate (/ π 2) [0 0 1] keyhole-fill))))
(def thumb
(union
(thumb-1x-layout (rotate (/ π 2) [0 0 0] single-plate))
@ -1102,15 +1129,10 @@
thumb-type
thumb-connector-type
(difference (union case-walls
screw-insert-outers
)
screw-insert-outers)
usb-holder-space
screw-insert-holes)
; thumbcaps
; caps
)
(translate [0 0 -20] (cube 350 350 40))
))
screw-insert-holes))
(translate [0 0 -20] (cube 350 350 40))))
(spit "things/right.scad"
(write-scad model-right))
@ -1123,16 +1145,38 @@
(union
key-holes
key-holes-inner
pinky-connectors
extra-connectors
connectors
inner-connectors
thumb
thumb-connectors
case-walls
thumbcaps
caps
)))
caps)))
(spit "things/right-plate.scad"
(write-scad
(extrude-linear
{:height 2.6 :center false}
(project
(difference
(union
key-holes
key-holes-inner
pinky-connectors
extra-connectors
connectors
inner-connectors
thumb
thumb-connectors
case-walls
thumbcaps-fill
caps-fill
screw-insert-outers)
(translate [0 0 -10] screw-insert-screw-holes))))))
(spit "things/right-plate-laser.scad"
(write-scad
(cut
(translate [0 0 -0.1]
@ -1142,10 +1186,4 @@
))
;(spit "things/test.scad"
; (write-scad
; ))
(defn -main [dum] 1) ; dummy to make it easier to batch