Fix keycaps and add plate generation

pull/1/head
Hunter Praska 4 years ago
parent 9cd6573d5d
commit cf7115bf05
No known key found for this signature in database
GPG Key ID: 3C9EB5EA0CBC4417

1
.gitignore vendored

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

@ -171,6 +171,11 @@
(translate [0 0 (+ 5 plate-thickness)]) (translate [0 0 (+ 5 plate-thickness)])
(color [240/255 223/255 175/255 1])))}) (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 ;; ;; Placement Functions ;;
;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;
@ -192,6 +197,7 @@
(defn offset-for-column [col, row] (defn offset-for-column [col, row]
(if (and (true? pinky-15u) (= col lastcol) (<= row last-15u-row) (>= row first-15u-row)) 4.7625 0)) (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] (defn apply-key-geometry [translate-fn rotate-x-fn rotate-y-fn column row shape]
(let [column-angle (* β (- centercol column)) (let [column-angle (* β (- centercol column))
placed-shape (->> shape placed-shape (->> shape
@ -262,12 +268,28 @@
(key-place column row))))) (key-place column row)))))
(def caps (def caps
(apply union (apply union
(for [column columns (conj (for [column columns
row rows row rows
:when (or (.contains [2 3] column) :when (or (and (= column 0) (< row 3))
(not= row lastrow))] (and (.contains [1 2] column) (< row 4))
(->> (sa-cap (if (and (true? pinky-15u) (= column lastcol)) 1.5 1)) (.contains [3 4 5 6] column))]
(key-place column row))))) (->> (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 ;placement for the innermost column
(def key-holes-inner (def key-holes-inner
@ -486,6 +508,11 @@
(thumb-1x-layout (sa-cap 1)) (thumb-1x-layout (sa-cap 1))
(thumb-15x-layout (rotate (/ π 2) [0 0 1] (sa-cap 1.5))))) (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 (def thumb
(union (union
(thumb-1x-layout (rotate (/ π 2) [0 0 0] single-plate)) (thumb-1x-layout (rotate (/ π 2) [0 0 0] single-plate))
@ -1092,25 +1119,20 @@
)))) ))))
(def model-right (difference (def model-right (difference
(union (union
key-holes key-holes
key-holes-inner key-holes-inner
pinky-connectors pinky-connectors
extra-connectors extra-connectors
connectors connectors
inner-connectors inner-connectors
thumb-type thumb-type
thumb-connector-type thumb-connector-type
(difference (union case-walls (difference (union case-walls
screw-insert-outers screw-insert-outers)
) usb-holder-space
usb-holder-space screw-insert-holes))
screw-insert-holes) (translate [0 0 -20] (cube 350 350 40))))
; thumbcaps
; caps
)
(translate [0 0 -20] (cube 350 350 40))
))
(spit "things/right.scad" (spit "things/right.scad"
(write-scad model-right)) (write-scad model-right))
@ -1120,19 +1142,41 @@
(spit "things/right-test.scad" (spit "things/right-test.scad"
(write-scad (write-scad
(union (union
key-holes key-holes
key-holes-inner key-holes-inner
connectors pinky-connectors
inner-connectors extra-connectors
thumb connectors
thumb-connectors inner-connectors
case-walls thumb
thumbcaps thumb-connectors
caps case-walls
))) thumbcaps
caps)))
(spit "things/right-plate.scad" (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 (write-scad
(cut (cut
(translate [0 0 -0.1] (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 (defn -main [dum] 1) ; dummy to make it easier to batch

Loading…
Cancel
Save