summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Short <tshort.rlists@gmail.com>2017-03-16 22:03:07 -0400
committerGitHub <noreply@github.com>2017-03-16 22:03:07 -0400
commit29edd64d8851afa25e53607736e1371c8399f107 (patch)
treea92a14359a6072167b6608f0188c2e493b963be6 /src
parenta9cbe36abdf88e8f5270dd11af309821fcf3a90f (diff)
Left wall (#4)
* Add screw insert to hold the teensy * Allow wider wall spacings for more internal room * Fix the clunky thumb connections * Enable the teensy holder for all styles
Diffstat (limited to 'src')
-rw-r--r--src/dactyl_keyboard/dactyl.clj279
1 files changed, 178 insertions, 101 deletions
diff --git a/src/dactyl_keyboard/dactyl.clj b/src/dactyl_keyboard/dactyl.clj
index 358ee24..2cdd862 100644
--- a/src/dactyl_keyboard/dactyl.clj
+++ b/src/dactyl_keyboard/dactyl.clj
@@ -22,12 +22,12 @@
(def centercol 3) ; controls left-right tilt / tenting (higher number is more tenting)
(def orthographic-x (> nrows 5)) ; for larger number of rows don't curve them in as much
; (def orthographic-x true) ; controls curvature of rows
-(def maltron-style false) ; use fixed angles for columns
+(def maltron-style false) ; use fixed angles for columns
(def maltron-angles [(deg2rad 10) (deg2rad 10) 0 0 0 (deg2rad -15) (deg2rad -15)]) ; starting point: http://patentimages.storage.googleapis.com/EP0219944A2/imgf0002.png
(defn column-offset [column] (cond
(= 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]))
(def thumb-offsets [6 -3 7])
@@ -35,8 +35,11 @@
(def keyboard-z-offset 9) ; controls height; original=24
(def extra-width 2.5) ; extra space between the base of keys; original= 2
-(def extra-height 1.0) ; origin= 1/2
+(def extra-height 1.0) ; original= 0.5
+(def wall-z-offset -15) ; length of the first downward-sloping part of the wall (negative)
+(def wall-xy-offset 5) ; offset in the x and/or y direction for the first downward-sloping part of the wall (negative)
+(def wall-thickness 2) ; wall thickness parameter; originally 5
;;;;;;;;;;;;;;;;;;;;;;;
;; General variables ;;
@@ -214,7 +217,7 @@
(map + [0 0 keyboard-z-offset]))))
; (pr (rotate-around-y π [10 0 1]))
-(pr (key-position 1 cornerrow [(/ mount-width 2) (- (/ mount-height 2)) 0]))
+; (pr (key-position 1 cornerrow [(/ mount-width 2) (- (/ mount-height 2)) 0]))
;;;;;;;;;;;;;;;;;;;;
;; Web Connectors ;;
@@ -452,26 +455,37 @@
(defn bottom-hull [& p]
(hull p (bottom 0.001 p)))
-(def wall-offset -15)
-(def wall-thickness 2) ; originally 5
+(def left-wall-x-offset 10)
+(def left-wall-z-offset 3)
+
+(defn left-key-position [row direction]
+ (map - (key-position 0 row [(* mount-width -0.5) (* direction mount-height 0.5) 0]) [left-wall-x-offset 0 left-wall-z-offset]) )
+
+(defn left-key-place [row direction shape]
+ (translate (left-key-position row direction) shape))
+
+
+(defn wall-locate1 [dx dy] [(* dx wall-thickness) (* dy wall-thickness) -1])
+(defn wall-locate2 [dx dy] [(* dx wall-xy-offset) (* dy wall-xy-offset) wall-z-offset])
+(defn wall-locate3 [dx dy] [(* dx (+ wall-xy-offset wall-thickness)) (* dy (+ wall-xy-offset wall-thickness)) wall-z-offset])
(defn wall-brace [place1 dx1 dy1 post1 place2 dx2 dy2 post2]
(union
(hull
(place1 post1)
- (place1 (translate [0 0 wall-offset] post1))
- (place1 (translate [(* dx1 wall-thickness) (* dy1 wall-thickness) -4] post1))
- (place1 (translate [(* dx1 wall-thickness) (* dy1 wall-thickness) wall-offset] post1))
+ (place1 (translate (wall-locate1 dx1 dy1) post1))
+ (place1 (translate (wall-locate2 dx1 dy1) post1))
+ (place1 (translate (wall-locate3 dx1 dy1) post1))
(place2 post2)
- (place2 (translate [0 0 wall-offset] post2))
- (place2 (translate [(* dx2 wall-thickness) (* dy2 wall-thickness) -4] post2))
- (place2 (translate [(* dx2 wall-thickness) (* dy2 wall-thickness) wall-offset] post2)))
+ (place2 (translate (wall-locate1 dx2 dy2) post2))
+ (place2 (translate (wall-locate2 dx2 dy2) post2))
+ (place2 (translate (wall-locate3 dx2 dy2) post2)))
(bottom-hull
- (place1 (translate [(* dx1 wall-thickness) (* dy1 wall-thickness) wall-offset] post1))
- (place1 (translate [0 0 wall-offset] post1))
- (place1 (translate [(* dx1 wall-thickness) (* dy1 wall-thickness) wall-offset] post1))
- (place2 (translate [0 0 wall-offset] post2))
- (place2 (translate [(* dx2 wall-thickness) (* dy2 wall-thickness) wall-offset] post2)))))
+ (place1 (translate (wall-locate2 dx1 dy1) post1))
+ (place1 (translate (wall-locate3 dx1 dy1) post1))
+ (place2 (translate (wall-locate2 dx2 dy2) post2))
+ (place2 (translate (wall-locate3 dx2 dy2) post2)))
+ ))
(defn key-wall-brace [x1 y1 dx1 dy1 post1 x2 y2 dx2 dy2 post2]
(wall-brace (partial key-place x1 y1) dx1 dy1 post1
@@ -482,17 +496,25 @@
; back wall
(for [x (range 0 ncols)] (key-wall-brace x 0 0 1 web-post-tl x 0 0 1 web-post-tr))
(for [x (range 1 ncols)] (key-wall-brace x 0 0 1 web-post-tl (dec x) 0 0 1 web-post-tr))
- (key-wall-brace 0 0 0 1 web-post-tl 0 0 -1 0 web-post-tl)
(key-wall-brace lastcol 0 0 1 web-post-tr lastcol 0 1 0 web-post-tr)
; right wall
(for [y (range 0 lastrow)] (key-wall-brace lastcol y 1 0 web-post-tr lastcol y 1 0 web-post-br))
(for [y (range 1 lastrow)] (key-wall-brace lastcol (dec y) 1 0 web-post-br lastcol y 1 0 web-post-tr))
(key-wall-brace lastcol cornerrow 0 -1 web-post-br lastcol cornerrow 1 0 web-post-br)
; left wall
- (for [y (range 0 lastrow)] (key-wall-brace 0 y -1 0 web-post-tl 0 y -1 0 web-post-bl))
- (for [y (range 1 lastrow)] (key-wall-brace 0 (dec y) -1 0 web-post-bl 0 y -1 0 web-post-tl))
+ (for [y (range 0 lastrow)] (union (wall-brace (partial left-key-place y 1) -1 0 web-post (partial left-key-place y -1) -1 0 web-post)
+ (hull (key-place 0 y web-post-tl)
+ (key-place 0 y web-post-bl)
+ (left-key-place y 1 web-post)
+ (left-key-place y -1 web-post))))
+ (for [y (range 1 lastrow)] (union (wall-brace (partial left-key-place (dec y) -1) -1 0 web-post (partial left-key-place y 1) -1 0 web-post)
+ (hull (key-place 0 y web-post-tl)
+ (key-place 0 (dec y) web-post-bl)
+ (left-key-place y 1 web-post)
+ (left-key-place (dec y) -1 web-post))))
+ (wall-brace (partial key-place 0 0) 0 1 web-post-tl (partial left-key-place 0 1) 0 1 web-post)
+ (wall-brace (partial left-key-place 0 1) 0 1 web-post (partial left-key-place 0 1) -1 0 web-post)
; front wall
- (key-wall-brace 0 0 0 1 web-post-tl 0 0 -1 0 web-post-tl)
(key-wall-brace lastcol 0 0 1 web-post-tr lastcol 0 1 0 web-post-tr)
(key-wall-brace 3 lastrow 0 -1 web-post-bl 3 lastrow 0.5 -1 web-post-br)
(key-wall-brace 3 lastrow 0.5 -1 web-post-br 4 cornerrow 1 -1 web-post-bl)
@@ -502,7 +524,7 @@
(wall-brace thumb-mr-place 0 -1 web-post-br thumb-tr-place 0 -1 thumb-post-br)
(wall-brace thumb-mr-place 0 -1 web-post-br thumb-mr-place 0 -1 web-post-bl)
(wall-brace thumb-br-place 0 -1 web-post-br thumb-br-place 0 -1 web-post-bl)
- (wall-brace thumb-ml-place 0 1 web-post-tr thumb-ml-place 0 1 web-post-tl)
+ (wall-brace thumb-ml-place -0.3 1 web-post-tr thumb-ml-place 0 1 web-post-tl)
(wall-brace thumb-bl-place 0 1 web-post-tr thumb-bl-place 0 1 web-post-tl)
(wall-brace thumb-br-place -1 0 web-post-tl thumb-br-place -1 0 web-post-bl)
(wall-brace thumb-bl-place -1 0 web-post-tl thumb-bl-place -1 0 web-post-bl)
@@ -514,112 +536,147 @@
(wall-brace thumb-ml-place 0 1 web-post-tl thumb-bl-place 0 1 web-post-tr)
(wall-brace thumb-bl-place -1 0 web-post-bl thumb-br-place -1 0 web-post-tl)
(wall-brace thumb-tr-place 0 -1 thumb-post-br (partial key-place 3 lastrow) 0 -1 web-post-bl)
- ; clunky bit on the top left thumb connection
- (wall-brace thumb-ml-place 0 1 web-post-tr thumb-tl-place -2.5 0 thumb-post-tl)
- (wall-brace thumb-tl-place -1 0 thumb-post-tl (partial key-place 0 cornerrow) -1 0 web-post-bl)
- ;; another incomplete try to fix this
- ; (bottom-hull (thumb-tl-place thumb-post-tl)
- ; (thumb-tl-place (translate [-7 0 0] thumb-post-tl))
- ; (thumb-ml-place web-post-tr)
- ; (thumb-ml-place (translate [0 5 -4] web-post-tr)))
+ ; clunky bit on the top left thumb connection (normal connectors don't work well)
+ (bottom-hull
+ (left-key-place cornerrow -1 (translate (wall-locate2 -1 0) web-post))
+ (left-key-place cornerrow -1 (translate (wall-locate3 -1 0) web-post))
+ (thumb-ml-place (translate (wall-locate2 -0.3 1) web-post-tr))
+ (thumb-ml-place (translate (wall-locate3 -0.3 1) web-post-tr)))
+ (hull
+ (left-key-place cornerrow -1 (translate (wall-locate2 -1 0) web-post))
+ (left-key-place cornerrow -1 (translate (wall-locate3 -1 0) web-post))
+ (thumb-ml-place (translate (wall-locate2 -0.3 1) web-post-tr))
+ (thumb-ml-place (translate (wall-locate3 -0.3 1) web-post-tr))
+ (thumb-tl-place thumb-post-tl))
+ (hull
+ (left-key-place cornerrow -1 web-post)
+ (left-key-place cornerrow -1 (translate (wall-locate1 -1 0) web-post))
+ (left-key-place cornerrow -1 (translate (wall-locate2 -1 0) web-post))
+ (left-key-place cornerrow -1 (translate (wall-locate3 -1 0) web-post))
+ (thumb-tl-place thumb-post-tl))
+ (hull
+ (left-key-place cornerrow -1 web-post)
+ (left-key-place cornerrow -1 (translate (wall-locate1 -1 0) web-post))
+ (key-place 0 cornerrow web-post-bl)
+ (key-place 0 cornerrow (translate (wall-locate1 -1 0) web-post-bl))
+ (thumb-tl-place thumb-post-tl))
+ (hull
+ (thumb-ml-place web-post-tr)
+ (thumb-ml-place (translate (wall-locate1 -0.3 1) web-post-tr))
+ (thumb-ml-place (translate (wall-locate2 -0.3 1) web-post-tr))
+ (thumb-ml-place (translate (wall-locate3 -0.3 1) web-post-tr))
+ (thumb-tl-place thumb-post-tl))
))
-(defn on-wall-place [column depth shape]
- (translate [0 0 (- depth)]
- (key-place column 0
- (->> shape
- (rotate (+ (* β (- centercol column)) (/ π 12)) [0 -1 0])
- (rotate (* α centerrow) [-1 0 0])
- (translate [0 (/ mount-height 2) wall-offset])
- ))))
-(def rj9-vertical-offset (- (last (key-position 0 0 [0 (/ mount-height 2) 0])) 35))
+(def rj9-start (map + [0 -3 0] (key-position 1 0 (map + (wall-locate3 0 1) [0 (/ mount-height 2) 0]))))
+(def rj9-position [(first rj9-start) (second rj9-start) 11])
(def rj9-cube (cube 14.78 13 22.38))
-(def rj9-space (on-wall-place 1 rj9-vertical-offset rj9-cube))
-(def rj9-holder (on-wall-place 1 rj9-vertical-offset
+(def rj9-space (translate rj9-position rj9-cube))
+(def rj9-holder (translate rj9-position
(difference rj9-cube
(union (translate [0 2 0] (cube 10.78 9 18.38))
(translate [0 0 5] (cube 10.78 13 5))))))
-(def teensy-vertical-offset (+ rj9-vertical-offset 10))
(def teensy-width 20)
(def teensy-height 12)
(def teensy-length 33)
(def teensy2-length 53)
(def teensy-pcb-thickness 1.6)
+(def teensy-holder-width (+ 7 teensy-pcb-thickness))
+(def teensy-holder-height (+ 6 teensy-width))
(def teensy-offset-height 5)
-(def teensy-holder-length 68)
-(def teensy-holder-offset (- 0 (/ teensy-holder-length 2)))
-(def teensy-holder-top-length 14)
-(def teensy-holder-top-offset (- 1 (/ teensy-holder-top-length 2)))
-
+(def teensy-holder-length 72)
+(def teensy-holder-offset (/ teensy-holder-length -2))
+(def teensy-holder-top-length 18)
+(def teensy-top-xy (key-position 0 0 (map + (wall-locate3 0 1) [(/ mount-width -2) (/ mount-height 2) 0])))
+(def teensy-bot-xy (map + (key-position 0 2 (map + (wall-locate3 -1 0) [(/ mount-width -2) (/ mount-height 2) 0]))
+ [(* 1 teensy-holder-width) 0 0]))
+(def teensy-holder-top-offset (/ teensy-holder-top-length -2))
+(def teensy-holder-angle (Math/atan2 (- (first teensy-top-xy) (first teensy-bot-xy)) (- (second teensy-top-xy) (second teensy-bot-xy))))
+
(def teensy-holder
- (on-wall-place 0 teensy-vertical-offset
- (translate [-5 0 0]
+ (->>
(union
(->> (cube 3 teensy-holder-length (+ 6 teensy-width))
- (translate [-1.5 teensy-holder-offset 0]))
+ (translate [1.5 teensy-holder-offset 0]))
(->> (cube teensy-pcb-thickness teensy-holder-length 3)
- (translate [(/ teensy-pcb-thickness 2) teensy-holder-offset (- -1.5 (/ teensy-width 2))]))
+ (translate [(+ (/ teensy-pcb-thickness 2) 3) teensy-holder-offset (- -1.5 (/ teensy-width 2))]))
(->> (cube 4 teensy-holder-length 4)
- (translate [(+ 2 teensy-pcb-thickness) teensy-holder-offset (- -1 (/ teensy-width 2))]))
+ (translate [(+ teensy-pcb-thickness 5) teensy-holder-offset (- -1 (/ teensy-width 2))]))
(->> (cube teensy-pcb-thickness teensy-holder-top-length 3)
- (translate [(/ teensy-pcb-thickness 2) teensy-holder-top-offset (+ 1.5 (/ teensy-width 2))]))
+ (translate [(+ (/ teensy-pcb-thickness 2) 3) teensy-holder-top-offset (+ 1.5 (/ teensy-width 2))]))
(->> (cube 4 teensy-holder-top-length 4)
- (translate [(+ 2 teensy-pcb-thickness) teensy-holder-top-offset (+ 1 (/ teensy-width 2))]))
- ))))
+ (translate [(+ teensy-pcb-thickness 5) teensy-holder-top-offset (+ 1 (/ teensy-width 2))]))
+ (->> (cube teensy-holder-width 2 teensy-holder-height)
+ (translate [(+ (/ teensy-holder-width 2)) -1 0])))
+ (translate [(- teensy-holder-width) 0 0])
+ (rotate teensy-holder-angle [0 0 -1])
+ (translate [(first teensy-top-xy)
+ (- (second teensy-top-xy) 1)
+ (/ (+ 6 teensy-width) 2)])
+ ))
(def usb-cutout
- (let [hole-height 7.5
- side-radius (/ hole-height 2)
- hole-width 12
- side-cylinder (->> (cylinder side-radius teensy-length)
- (with-fn 20)
- (translate [(/ (- hole-width hole-height) 2) 0 0]))]
- (->> (hull side-cylinder
- (mirror [-1 0 0] side-cylinder))
- (rotate (/ π 2) [1 0 0])
- (rotate (/ π 2) [0 1 0])
- (on-wall-place 0 teensy-vertical-offset))))
-
-(def usb-cutout
- (on-wall-place 0 teensy-vertical-offset (->> (cube 9 30 12)
- (translate [-1 10 0]))))
+ (->> (cube 8 30 12)
+ (translate [-4 -5 0])
+ (rotate teensy-holder-angle [0 0 -1])
+ (translate [(+ (first teensy-top-xy) 3)
+ (+ (second teensy-top-xy) 0)
+ (/ teensy-holder-height 2)])
+ ))
+
+(def teensy-holder-hole
+ (->> (cube teensy-holder-width 30 teensy-holder-height)
+ (translate [(/ teensy-holder-width -2) -15 (/ teensy-holder-height 2)])
+ (rotate teensy-holder-angle [0 0 -1])
+ (translate [(first teensy-top-xy)
+ (- (second teensy-top-xy) 1)
+ 0])))
+
+
+(defn screw-insert-shape [bottom-radius top-radius height]
+ (union (cylinder [bottom-radius top-radius] height)
+ (translate [0 0 (/ height 2)] (sphere top-radius))))
(defn screw-insert [column row bottom-radius top-radius height]
- (let [position (key-position column row [0 0 0])
- column-offset (/ mount-width 2)
- row-offset (/ mount-height 2)
- shift-right (= column lastcol)
+ (let [shift-right (= column lastcol)
shift-left (= column 0)
shift-up (and (not (or shift-right shift-left)) (= row 0))
shift-down (and (not (or shift-right shift-left)) (= row lastrow))
- is-vertical (or shift-left shift-right)
- col-angle (+ (* β (- centercol column)) (/ π 12))
- row-angle (* α (- row centerrow))]
- (->> (union (cylinder [bottom-radius top-radius] height)
- (translate [0 0 (/ height 2)] (sphere top-radius)))
+ position (if shift-up (key-position column row (map + (wall-locate2 0 1) [0 (/ mount-height 2) 0]))
+ (if shift-down (key-position column row (map - (wall-locate2 0 -1) [0 (/ mount-height 2) 0]))
+ (if shift-left (map + (left-key-position row 0) (wall-locate3 -1 0))
+ (key-position column row (map + (wall-locate2 1 0) [(/ mount-width 2) 0 0])))))
+ ]
+ (->> (screw-insert-shape bottom-radius top-radius height)
(translate [(first position) (second position) (/ height 2)])
- (translate [(* (if shift-right 1 (if shift-left -1 0)) column-offset)
- (* (if shift-up 1 (if shift-down -1 0)) row-offset)
- 0])
- (translate [(* wall-offset (Math/sin col-angle))
- (* wall-offset (Math/sin row-angle))
- 0]))))
-
-(defn screw-insert-shapes [bottom-radius top-radius height]
- (union (screw-insert 0 0 bottom-radius top-radius height)
- (screw-insert 0 cornerrow bottom-radius top-radius height)
+ )))
+
+(defn screw-insert-all-shapes [bottom-radius top-radius height]
+ (union ; (screw-insert 0 0 bottom-radius top-radius height)
+ (screw-insert 0 1 bottom-radius top-radius height)
(screw-insert 3 lastrow bottom-radius top-radius height)
(screw-insert 3 0 bottom-radius top-radius height)
- ; (screw-insert lastcol (dec cornerrow) radius height)
+ (screw-insert lastcol 1 bottom-radius top-radius height)
))
(def screw-insert-height 3.8)
(def screw-insert-bottom-radius (/ 5.31 2))
(def screw-insert-top-radius (/ 5.1 2))
-(def screw-insert-holes (screw-insert-shapes screw-insert-bottom-radius screw-insert-top-radius screw-insert-height))
-(def screw-insert-outers (screw-insert-shapes (+ screw-insert-bottom-radius 1.6) (+ screw-insert-top-radius 1.6) (+ screw-insert-height 1.6)))
+(def screw-insert-holes (screw-insert-all-shapes screw-insert-bottom-radius screw-insert-top-radius screw-insert-height))
+(def screw-insert-outers (screw-insert-all-shapes (+ screw-insert-bottom-radius 1.6) (+ screw-insert-top-radius 1.6) (+ screw-insert-height 1.6)))
+
+(defn teensy-screw-insert-place [shape]
+ (let [position (vec (map - teensy-bot-xy (map (partial * 0.3) (map - teensy-top-xy teensy-bot-xy))))]
+ (->> shape
+ (rotate (/ π 2) [0 -1 0])
+ (translate [(- 3 teensy-holder-width (/ screw-insert-height 2)) (- (+ teensy2-length 4)) 0])
+ (rotate teensy-holder-angle [0 0 -1])
+ (translate [(first teensy-top-xy) (second teensy-top-xy) 15])
+ )))
+(def teensy-screw-insert-hole (teensy-screw-insert-place (cylinder [screw-insert-bottom-radius screw-insert-top-radius] (+ screw-insert-height 0.4))))
+(def teensy-screw-insert-outer (teensy-screw-insert-place (translate [0 0 1] (cylinder [(+ screw-insert-bottom-radius 1.6) (+ screw-insert-top-radius 1.6)] (+ screw-insert-height 2)))))
(spit "things/right.scad"
(write-scad (difference
@@ -628,26 +685,46 @@
connectors
thumb
thumb-connectors
- (difference (union case-walls
- screw-insert-outers
- (if (= nrows 4) teensy-holder))
+ (difference (union (difference
+ (union case-walls
+ screw-insert-outers
+ teensy-screw-insert-outer)
+ teensy-holder-hole)
+ teensy-holder)
rj9-space
usb-cutout
+ teensy-screw-insert-hole
screw-insert-holes)
rj9-holder
; thumbcaps
; caps
)
(translate [0 0 -20] (cube 350 350 40))
- ; (translate [0 0 -50] (cube 5 5 20))
+ ; (translate [0 0 -150] (cube 5 5 20))
)))
+(spit "things/right-test.scad"
+ (write-scad
+ (union
+ key-holes
+ connectors
+ thumb
+ thumb-connectors
+ case-walls
+ teensy-holder
+ ; teensy-holder-hole
+ screw-insert-outers
+ teensy-screw-insert-hole
+ teensy-screw-insert-outer
+ usb-cutout
+ rj9-space
+ )))
-(spit "things/test.scad"
- (write-scad (intersection (translate [29 -5 0] (cube 30 30 30))
- (difference (union case-walls screw-insert-outers)
- screw-insert-holes)
- )))
+; (spit "things/test.scad"
+; (write-scad (intersection (translate [29 -5 0] (cube 30 30 30))
+; (difference (union case-walls screw-insert-outers)
+; screw-insert-holes)
+; )))
; (spit "things/test.scad"
; (write-scad screw-insert-holes))