Merge pull request #1 from huntiep/master

merge branch 'master' of https://github.com/huntiep/dactyl-manuform
This commit is contained in:
carbonfet 2020-07-26 21:57:03 -04:00 committed by GitHub
commit 66e6ec7d15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 150 additions and 117 deletions

1
.gitignore vendored
View file

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

View file

@ -32,17 +32,15 @@
(def column-style :standard) (def column-style :standard)
(if (true? inner-column) (defn column-offset [column]
(defn column-offset [column] (cond (if inner-column
(<= column 1) [0 -2 0] (cond (<= column 1) [0 -2 0]
(= column 3) [0 2.82 -4.5] (= column 3) [0 2.82 -4.5]
(>= column 5) [0 -12 5.64] ; original [0 -5.8 5.64] (>= column 5) [0 -12 5.64] ; original [0 -5.8 5.64]
:else [0 0 0])) :else [0 0 0])
(defn column-offset [column] (cond (cond (= column 2) [0 2.82 -4.5]
(= column 2) [0 2.82 -4.5] (>= column 4) [0 -12 5.64] ; original [0 -5.8 5.64]
(>= column 4) [0 -12 5.64] ; original [0 -5.8 5.64] :else [0 0 0])))
:else [0 0 0]))
)
(def thumb-offsets [6 -3 7]) (def thumb-offsets [6 -3 7])
@ -76,8 +74,8 @@
(def lastrow (dec nrows)) (def lastrow (dec nrows))
(def cornerrow (dec lastrow)) (def cornerrow (dec lastrow))
(def lastcol (dec ncols)) (def lastcol (dec ncols))
(if (true? extra-row) (def extra-cornerrow lastrow) (def extra-cornerrow cornerrow)) (def extra-cornerrow (if extra-row lastrow cornerrow))
(if (true? inner-column) (def innercol-offset 1) (def innercol-offset 0)) (def innercol-offset (if inner-column 1 0))
;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;
;; Switch Hole ;; ;; Switch Hole ;;
@ -171,6 +169,10 @@
(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 (->> (cube keyswitch-height keyswitch-width plate-thickness)
(translate [0 0 (/ plate-thickness 2)])))
;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;
;; Placement Functions ;; ;; Placement Functions ;;
;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;
@ -191,7 +193,13 @@
(def column-x-delta (+ -1 (- (* column-radius (Math/sin β))))) (def column-x-delta (+ -1 (- (* column-radius (Math/sin β)))))
(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 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
@ -253,25 +261,41 @@
(for [column columns (for [column columns
row rows row rows
:when (or (.contains [(+ innercol-offset 2) (+ innercol-offset 3)] column) :when (or (.contains [(+ innercol-offset 2) (+ innercol-offset 3)] column)
(and (.contains [(+ innercol-offset 4) (+ innercol-offset 5)] column) (true? extra-row) (= ncols (+ innercol-offset 6))) (and (.contains [(+ innercol-offset 4) (+ innercol-offset 5)] column) extra-row (= ncols (+ innercol-offset 6)))
(and (.contains [(+ innercol-offset 4)] column) (true? extra-row) (= ncols (+ innercol-offset 5))) (and (.contains [(+ innercol-offset 4)] column) extra-row (= ncols (+ innercol-offset 5)))
(and (true? inner-column) (not= row cornerrow)(= column 0)) (and inner-column (not= row cornerrow)(= column 0))
(not= row lastrow))] (not= row lastrow))]
(->> single-plate (->> single-plate
; (rotate (/ π 2) [0 0 1]) ; (rotate (/ π 2) [0 0 1])
(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 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
(if (true? inner-column) (if inner-column
(apply union (apply union
(for [row innerrows] (for [row innerrows]
(->> single-plate (->> single-plate
@ -295,7 +319,7 @@
(def web-post-br (translate [(- (/ mount-width 2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post)) (def web-post-br (translate [(- (/ mount-width 2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post))
; wide posts for 1.5u keys in the main cluster ; wide posts for 1.5u keys in the main cluster
(if (true? pinky-15u) (if pinky-15u
(do (def wide-post-tr (translate [(- (/ mount-width 1.2) post-adj) (- (/ mount-height 2) post-adj) 0] web-post)) (do (def wide-post-tr (translate [(- (/ mount-width 1.2) post-adj) (- (/ mount-height 2) post-adj) 0] web-post))
(def wide-post-tl (translate [(+ (/ mount-width -1.2) post-adj) (- (/ mount-height 2) post-adj) 0] web-post)) (def wide-post-tl (translate [(+ (/ mount-width -1.2) post-adj) (- (/ mount-height 2) post-adj) 0] web-post))
(def wide-post-bl (translate [(+ (/ mount-width -1.2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post)) (def wide-post-bl (translate [(+ (/ mount-width -1.2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post))
@ -341,7 +365,7 @@
(key-place (inc column) (inc row) web-post-tl)))))) (key-place (inc column) (inc row) web-post-tl))))))
(def inner-connectors (def inner-connectors
(if (true? inner-column) (if inner-column
(apply union (apply union
(concat (concat
;; Row connections ;; Row connections
@ -371,7 +395,7 @@
(key-place (inc column) (inc row) web-post-tl))))))) (key-place (inc column) (inc row) web-post-tl)))))))
(def extra-connectors (def extra-connectors
(if (true? extra-row) (if extra-row
(apply union (apply union
(concat (concat
(for [column (range 3 ncols) (for [column (range 3 ncols)
@ -486,6 +510,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))
@ -563,7 +592,7 @@
(key-place (+ innercol-offset 2) lastrow web-post-tr) (key-place (+ innercol-offset 2) lastrow web-post-tr)
(key-place (+ innercol-offset 2) cornerrow web-post-br) (key-place (+ innercol-offset 2) cornerrow web-post-br)
(key-place (+ innercol-offset 3) cornerrow web-post-bl)) (key-place (+ innercol-offset 3) cornerrow web-post-bl))
(if (true? extra-row) (if extra-row
(union (union
(triangle-hulls (triangle-hulls
(key-place (+ innercol-offset 3) lastrow web-post-tr) (key-place (+ innercol-offset 3) lastrow web-post-tr)
@ -641,6 +670,11 @@
(minithumb-1x-layout (sa-cap 1)) (minithumb-1x-layout (sa-cap 1))
(minithumb-15x-layout (rotate (/ π 2) [0 0 1] (sa-cap 1))))) (minithumb-15x-layout (rotate (/ π 2) [0 0 1] (sa-cap 1)))))
(def minithumbcaps-fill
(union
(minithumb-1x-layout keyhole-fill)
(minithumb-15x-layout (rotate (/ π 2) [0 0 1] keyhole-fill))))
(def minithumb (def minithumb
(union (union
(minithumb-1x-layout single-plate) (minithumb-1x-layout single-plate)
@ -717,7 +751,7 @@
(key-place (+ innercol-offset 2) lastrow web-post-tr) (key-place (+ innercol-offset 2) lastrow web-post-tr)
(key-place (+ innercol-offset 2) cornerrow web-post-br) (key-place (+ innercol-offset 2) cornerrow web-post-br)
(key-place (+ innercol-offset 3) cornerrow web-post-bl)) (key-place (+ innercol-offset 3) cornerrow web-post-bl))
(if (true? extra-row) (if extra-row
(union (union
(triangle-hulls (triangle-hulls
(key-place (+ innercol-offset 3) lastrow web-post-tr) (key-place (+ innercol-offset 3) lastrow web-post-tr)
@ -803,6 +837,11 @@
(newthumb-1x-layout (sa-cap 1)) (newthumb-1x-layout (sa-cap 1))
(newthumb-15x-layout (rotate (/ π 2) [0 0 1] (sa-cap 1.5))))) (newthumb-15x-layout (rotate (/ π 2) [0 0 1] (sa-cap 1.5)))))
(def newthumbcaps-fill
(union
(newthumb-1x-layout keyhole-fill)
(newthumb-15x-layout (rotate (/ π 2) [0 0 1] keyhole-fill))))
(def newthumb (def newthumb
(union (union
(newthumb-1x-layout single-plate) (newthumb-1x-layout single-plate)
@ -888,7 +927,7 @@
(key-place (+ innercol-offset 2) lastrow web-post-tr) (key-place (+ innercol-offset 2) lastrow web-post-tr)
(key-place (+ innercol-offset 2) cornerrow web-post-br) (key-place (+ innercol-offset 2) cornerrow web-post-br)
(key-place (+ innercol-offset 3) cornerrow web-post-bl)) (key-place (+ innercol-offset 3) cornerrow web-post-bl))
(if (true? extra-row) (if extra-row
(union (union
(triangle-hulls (triangle-hulls
(key-place (+ innercol-offset 3) lastrow web-post-tr) (key-place (+ innercol-offset 3) lastrow web-post-tr)
@ -912,23 +951,23 @@
;switching connectors, switchplates, etc. depending on thumb-style used ;switching connectors, switchplates, etc. depending on thumb-style used
(cond (when (= thumb-style "default")
(= thumb-style "default") (when true (def thumb-type thumb)
(def thumb-type thumb) (def thumb-connector-type thumb-connectors)
(def thumb-connector-type thumb-connectors) (def thumbcaps-type thumbcaps)
(def thumbcaps-type thumbcaps))) (def thumbcaps-fill-type thumbcaps-fill))
(cond (when (= thumb-style "new")
(= thumb-style "new") (when true (def thumb-type newthumb)
(def thumb-type newthumb) (def thumb-connector-type newthumb-connectors)
(def thumb-connector-type newthumb-connectors) (def thumbcaps-type newthumbcaps)
(def thumbcaps-type newthumbcaps))) (def thumbcaps-fill-type newthumbcaps-fill))
(cond (when (= thumb-style "mini")
(= thumb-style "mini") (when true (def thumb-type minithumb)
(def thumb-type minithumb) (def thumb-connector-type minithumb-connectors)
(def thumb-connector-type minithumb-connectors) (def thumbcaps-type minithumbcaps)
(def thumbcaps-type minithumbcaps))) (def thumbcaps-fill-type minithumbcaps-fill))
;;;;;;;;;; ;;;;;;;;;;
;; Case ;; ;; Case ;;
@ -977,7 +1016,7 @@
(partial key-place x2 y2) dx2 dy2 post2)) (partial key-place x2 y2) dx2 dy2 post2))
(def right-wall (def right-wall
(if (true? pinky-15u) (if pinky-15u
(union (union
; corner between the right wall and back wall ; corner between the right wall and back wall
(if (> first-15u-row 0) (if (> first-15u-row 0)
@ -1010,7 +1049,7 @@
(key-wall-brace lastcol (inc y) 1 0 web-post-tr lastcol (inc y) 1 0 web-post-br)))) (key-wall-brace lastcol (inc y) 1 0 web-post-tr lastcol (inc y) 1 0 web-post-br))))
) )
(union (key-wall-brace lastcol 0 0 1 web-post-tr lastcol 0 1 0 web-post-tr) (union (key-wall-brace lastcol 0 0 1 web-post-tr lastcol 0 1 0 web-post-tr)
(if (true? extra-row) (if extra-row
(union (for [y (range 0 (inc lastrow))] (key-wall-brace lastcol y 1 0 web-post-tr lastcol y 1 0 web-post-br)) (union (for [y (range 0 (inc lastrow))] (key-wall-brace lastcol y 1 0 web-post-tr lastcol y 1 0 web-post-br))
(for [y (range 1 (inc lastrow))] (key-wall-brace lastcol (dec y) 1 0 web-post-br lastcol y 1 0 web-post-tr))) (for [y (range 1 (inc lastrow))] (key-wall-brace lastcol (dec y) 1 0 web-post-br lastcol y 1 0 web-post-tr)))
(union (for [y (range 0 lastrow)] (key-wall-brace lastcol y 1 0 web-post-tr lastcol y 1 0 web-post-br)) (union (for [y (range 0 lastrow)] (key-wall-brace lastcol y 1 0 web-post-tr lastcol y 1 0 web-post-br))
@ -1065,7 +1104,7 @@
(newthumb-bl-place (translate (wall-locate3 -0.3 1) thumb-post-tr)) (newthumb-bl-place (translate (wall-locate3 -0.3 1) thumb-post-tr))
(newthumb-ml-place thumb-post-tl)) (newthumb-ml-place thumb-post-tl))
; connectors below the inner column to the thumb & second column ; connectors below the inner column to the thumb & second column
(if (true? inner-column) (if inner-column
(union (union
(hull (hull
(key-place 0 (dec cornerrow) web-post-bl) (key-place 0 (dec cornerrow) web-post-bl)
@ -1130,7 +1169,7 @@
(minithumb-bl-place (translate (wall-locate3 -0.3 1) web-post-tr)) (minithumb-bl-place (translate (wall-locate3 -0.3 1) web-post-tr))
(minithumb-tl-place web-post-tl)) (minithumb-tl-place web-post-tl))
; connectors below the inner column to the thumb & second column ; connectors below the inner column to the thumb & second column
(if (true? inner-column) (if inner-column
(union (union
(hull (hull
(key-place 0 (dec cornerrow) web-post-bl) (key-place 0 (dec cornerrow) web-post-bl)
@ -1192,7 +1231,7 @@
(key-place 0 (- cornerrow innercol-offset) (translate (wall-locate1 0 0) web-post-bl)) (key-place 0 (- cornerrow innercol-offset) (translate (wall-locate1 0 0) web-post-bl))
(thumb-tl-place thumb-post-tl)) (thumb-tl-place thumb-post-tl))
; connectors below the inner column to the thumb & second column ; connectors below the inner column to the thumb & second column
(if (true? inner-column) (if inner-column
(union (union
(hull (hull
(key-place 0 (dec cornerrow) web-post-bl) (key-place 0 (dec cornerrow) web-post-bl)
@ -1218,17 +1257,11 @@
(thumb-tl-place thumb-post-tl)))) (thumb-tl-place thumb-post-tl))))
;switching walls depending on thumb-style used ;switching walls depending on thumb-style used
(cond (def thumb-wall-type
(= thumb-style "default") (when true (case thumb-style
(def thumb-wall-type default-thumb-wall))) "default" default-thumb-wall
"new" new-thumb-wall
(cond "mini" mini-thumb-wall))
(= thumb-style "new") (when true
(def thumb-wall-type new-thumb-wall)))
(cond
(= thumb-style "mini") (when true
(def thumb-wall-type mini-thumb-wall)))
(def case-walls (def case-walls
(union (union
@ -1260,19 +1293,19 @@
)) ))
; Offsets for the controller/trrs holder cutout ; Offsets for the controller/trrs holder cutout
(case nrows (def holder-offset
4 (def holder-offset -3.5) (case nrows
5 (def holder-offset 0) 4 -3.5
6 (def holder-offset 3.2)) 5 0
6 (if inner-column
3.2
2.2)))
(if (and (false? inner-column) (= nrows 6)) (def notch-offset
(def holder-offset (- holder-offset 1)) (case nrows
) 4 3.15
5 0
(case nrows 6 -5.07))
4 (def notch-offset 3.15)
5 (def notch-offset 0)
6 (def notch-offset -5.07))
; Cutout for controller/trrs jack holder ; Cutout for controller/trrs jack holder
(def usb-holder-ref (key-position 0 0 (map - (wall-locate2 0 -1) [0 (/ mount-height 2) 0]))) (def usb-holder-ref (key-position 0 0 (map - (wall-locate2 0 -1) [0 (/ mount-height 2) 0])))
@ -1321,7 +1354,7 @@
; Connectors between outer column and right wall when 1.5u keys are used ; Connectors between outer column and right wall when 1.5u keys are used
(def pinky-connectors (def pinky-connectors
(if (true? pinky-15u) (if pinky-15u
(apply union (apply union
(concat (concat
;; Row connections ;; Row connections
@ -1362,26 +1395,21 @@
)))) ))))
(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 usb-holder-notch
usb-holder-notch screw-insert-holes))
screw-insert-holes) (translate [0 0 -20] (cube 350 350 40))))
; thumbcaps-type
; 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))
@ -1390,33 +1418,37 @@
(write-scad (mirror [-1 0 0] model-right))) (write-scad (mirror [-1 0 0] model-right)))
(spit "things/right-test.scad" (spit "things/right-test.scad"
(write-scad (write-scad (union model-right
(union thumbcaps-type
key-holes caps)))
key-holes-inner
connectors
inner-connectors
thumb
thumb-connectors
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-type
thumb-connector-type
case-walls
thumbcaps-fill-type
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]
(difference (union case-walls (difference (union case-walls
screw-insert-outers) screw-insert-outers)
(translate [0 0 -10] screw-insert-screw-holes)))) (translate [0 0 -10] screw-insert-screw-holes))))))
))
;(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