2015-12-02 13:19:52 +08:00
|
|
|
|
(ns dactyl-keyboard.dactyl
|
|
|
|
|
(:refer-clojure :exclude [use import])
|
2017-03-11 07:08:27 +08:00
|
|
|
|
(:require [clojure.core.matrix :refer [array matrix mmul]]
|
|
|
|
|
[scad-clj.scad :refer :all]
|
2015-12-02 13:19:52 +08:00
|
|
|
|
[scad-clj.model :refer :all]
|
|
|
|
|
[unicode-math.core :refer :all]))
|
|
|
|
|
|
2017-03-14 07:02:03 +08:00
|
|
|
|
(defn deg2rad [degrees]
|
|
|
|
|
(* (/ degrees 180) pi))
|
|
|
|
|
|
2017-03-11 07:08:27 +08:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; Shape parameters ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2018-06-11 15:36:09 +08:00
|
|
|
|
(def nrows 5)
|
|
|
|
|
(def ncols 6)
|
2017-03-11 07:08:27 +08:00
|
|
|
|
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(def α (/ π 12)) ; curvature of the columns
|
2017-03-14 07:02:03 +08:00
|
|
|
|
(def β (/ π 36)) ; curvature of the rows
|
2017-03-11 07:08:27 +08:00
|
|
|
|
(def centerrow (- nrows 3)) ; controls front-back tilt
|
2018-06-12 11:22:16 +08:00
|
|
|
|
(def centercol 2) ; controls left-right tilt / tenting (higher number is more tenting)
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(def tenting-angle (/ π 12)) ; or, change this for more precise tenting control
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(def column-style
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(if (> nrows 5) :orthographic :standard)) ; options include :standard, :orthographic, and :fixed
|
|
|
|
|
; (def column-style :fixed)
|
2017-03-11 07:08:27 +08:00
|
|
|
|
|
|
|
|
|
(defn column-offset [column] (cond
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(= column 2) [0 2.82 -4.5]
|
|
|
|
|
(>= column 4) [0 -12 5.64] ; original [0 -5.8 5.64]
|
|
|
|
|
:else [0 0 0]))
|
2017-03-11 07:08:27 +08:00
|
|
|
|
|
|
|
|
|
(def thumb-offsets [6 -3 7])
|
|
|
|
|
|
2018-06-12 11:22:16 +08:00
|
|
|
|
(def keyboard-z-offset 10) ; controls overall height; original=9 with centercol=3; use 16 for centercol=2
|
2017-03-14 07:02:03 +08:00
|
|
|
|
|
|
|
|
|
(def extra-width 2.5) ; extra space between the base of keys; original= 2
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(def extra-height 1.0) ; original= 0.5
|
2017-03-14 07:02:03 +08:00
|
|
|
|
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(def wall-z-offset -5) ; original=-15 length of the first downward-sloping part of the wall (negative)
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(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
|
2017-03-11 07:08:27 +08:00
|
|
|
|
|
2018-04-11 17:17:01 +08:00
|
|
|
|
;; Settings for column-style == :fixed
|
2017-03-23 10:40:20 +08:00
|
|
|
|
;; The defaults roughly match Maltron settings
|
|
|
|
|
;; http://patentimages.storage.googleapis.com/EP0219944A2/imgf0002.png
|
|
|
|
|
;; Fixed-z overrides the z portion of the column ofsets above.
|
|
|
|
|
;; NOTE: THIS DOESN'T WORK QUITE LIKE I'D HOPED.
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(def fixed-angles [(deg2rad 10) (deg2rad 10) 0 0 0 (deg2rad -15) (deg2rad -15)])
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(def fixed-x [-41.5 -22.5 0 20.3 41.4 65.5 89.6]) ; relative to the middle finger
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(def fixed-z [12.1 8.3 0 5 10.7 14.5 17.5])
|
|
|
|
|
(def fixed-tenting (deg2rad 0))
|
2017-03-23 10:40:20 +08:00
|
|
|
|
|
2018-04-21 09:39:53 +08:00
|
|
|
|
; If you use Cherry MX or Gateron switches, this can be turned on.
|
|
|
|
|
; If you use other switches such as Kailh, you should set this as false
|
|
|
|
|
(def create-side-nubs? false)
|
2018-04-21 09:02:39 +08:00
|
|
|
|
|
2017-03-11 07:08:27 +08:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; General variables ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(def lastrow (dec nrows))
|
|
|
|
|
(def cornerrow (dec lastrow))
|
|
|
|
|
(def lastcol (dec ncols))
|
2017-03-10 08:25:55 +08:00
|
|
|
|
|
2015-12-02 13:19:52 +08:00
|
|
|
|
;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; Switch Hole ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(def keyswitch-height 14.4) ;; Was 14.1, then 14.25
|
|
|
|
|
(def keyswitch-width 14.4)
|
|
|
|
|
|
|
|
|
|
(def sa-profile-key-height 12.7)
|
|
|
|
|
|
2018-05-20 08:22:27 +08:00
|
|
|
|
(def plate-thickness 3)
|
|
|
|
|
(def retention-tab-thickness 1.5)
|
|
|
|
|
(def retention-tab-hole-thickness (- plate-thickness retention-tab-thickness))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(def mount-width (+ keyswitch-width 3))
|
|
|
|
|
(def mount-height (+ keyswitch-height 3))
|
|
|
|
|
|
|
|
|
|
(def single-plate
|
|
|
|
|
(let [top-wall (->> (cube (+ keyswitch-width 3) 1.5 plate-thickness)
|
|
|
|
|
(translate [0
|
|
|
|
|
(+ (/ 1.5 2) (/ keyswitch-height 2))
|
|
|
|
|
(/ plate-thickness 2)]))
|
|
|
|
|
left-wall (->> (cube 1.5 (+ keyswitch-height 3) plate-thickness)
|
|
|
|
|
(translate [(+ (/ 1.5 2) (/ keyswitch-width 2))
|
|
|
|
|
0
|
|
|
|
|
(/ plate-thickness 2)]))
|
|
|
|
|
side-nub (->> (binding [*fn* 30] (cylinder 1 2.75))
|
|
|
|
|
(rotate (/ π 2) [1 0 0])
|
|
|
|
|
(translate [(+ (/ keyswitch-width 2)) 0 1])
|
|
|
|
|
(hull (->> (cube 1.5 2.75 plate-thickness)
|
|
|
|
|
(translate [(+ (/ 1.5 2) (/ keyswitch-width 2))
|
|
|
|
|
0
|
|
|
|
|
(/ plate-thickness 2)]))))
|
2018-05-20 08:22:27 +08:00
|
|
|
|
plate-half (union top-wall left-wall (if create-side-nubs? (with-fn 100 side-nub)))
|
2018-05-20 08:44:02 +08:00
|
|
|
|
top-nub (->> (cube 5 5 (- plate-thickness retention-tab-hole-thickness))
|
2018-05-20 08:22:27 +08:00
|
|
|
|
(translate [(+ (/ keyswitch-width 2)) 0 (/ retention-tab-hole-thickness 2)]))
|
|
|
|
|
top-nub-pair (union top-nub
|
|
|
|
|
(->> top-nub
|
|
|
|
|
(mirror [1 0 0])
|
|
|
|
|
(mirror [0 1 0])))]
|
|
|
|
|
(difference
|
|
|
|
|
(union plate-half
|
|
|
|
|
(->> plate-half
|
|
|
|
|
(mirror [1 0 0])
|
|
|
|
|
(mirror [0 1 0])))
|
|
|
|
|
(->>
|
|
|
|
|
top-nub-pair
|
|
|
|
|
(rotate (/ π 2) [0 0 1])))))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;
|
|
|
|
|
;; SA Keycaps ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(def sa-length 18.25)
|
|
|
|
|
(def sa-cap {1 (let [bl2 (/ 18.5 2)
|
|
|
|
|
m (/ 17 2)
|
|
|
|
|
key-cap (hull (->> (polygon [[bl2 bl2] [bl2 (- bl2)] [(- bl2) (- bl2)] [(- bl2) bl2]])
|
|
|
|
|
(extrude-linear {:height 0.1 :twist 0 :convexity 0})
|
|
|
|
|
(translate [0 0 0.05]))
|
|
|
|
|
(->> (polygon [[m m] [m (- m)] [(- m) (- m)] [(- m) m]])
|
|
|
|
|
(extrude-linear {:height 0.1 :twist 0 :convexity 0})
|
|
|
|
|
(translate [0 0 6]))
|
|
|
|
|
(->> (polygon [[6 6] [6 -6] [-6 -6] [-6 6]])
|
|
|
|
|
(extrude-linear {:height 0.1 :twist 0 :convexity 0})
|
|
|
|
|
(translate [0 0 12])))]
|
|
|
|
|
(->> key-cap
|
|
|
|
|
(translate [0 0 (+ 5 plate-thickness)])
|
|
|
|
|
(color [220/255 163/255 163/255 1])))
|
2018-04-21 09:56:08 +08:00
|
|
|
|
2 (let [bl2 sa-length
|
2015-12-02 13:19:52 +08:00
|
|
|
|
bw2 (/ 18.25 2)
|
|
|
|
|
key-cap (hull (->> (polygon [[bw2 bl2] [bw2 (- bl2)] [(- bw2) (- bl2)] [(- bw2) bl2]])
|
|
|
|
|
(extrude-linear {:height 0.1 :twist 0 :convexity 0})
|
|
|
|
|
(translate [0 0 0.05]))
|
|
|
|
|
(->> (polygon [[6 16] [6 -16] [-6 -16] [-6 16]])
|
|
|
|
|
(extrude-linear {:height 0.1 :twist 0 :convexity 0})
|
|
|
|
|
(translate [0 0 12])))]
|
|
|
|
|
(->> key-cap
|
|
|
|
|
(translate [0 0 (+ 5 plate-thickness)])
|
|
|
|
|
(color [127/255 159/255 127/255 1])))
|
|
|
|
|
1.5 (let [bl2 (/ 18.25 2)
|
|
|
|
|
bw2 (/ 28 2)
|
|
|
|
|
key-cap (hull (->> (polygon [[bw2 bl2] [bw2 (- bl2)] [(- bw2) (- bl2)] [(- bw2) bl2]])
|
|
|
|
|
(extrude-linear {:height 0.1 :twist 0 :convexity 0})
|
|
|
|
|
(translate [0 0 0.05]))
|
|
|
|
|
(->> (polygon [[11 6] [-11 6] [-11 -6] [11 -6]])
|
|
|
|
|
(extrude-linear {:height 0.1 :twist 0 :convexity 0})
|
|
|
|
|
(translate [0 0 12])))]
|
|
|
|
|
(->> key-cap
|
|
|
|
|
(translate [0 0 (+ 5 plate-thickness)])
|
|
|
|
|
(color [240/255 223/255 175/255 1])))})
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; Placement Functions ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(def columns (range 0 ncols))
|
|
|
|
|
(def rows (range 0 nrows))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
|
|
|
|
(def cap-top-height (+ plate-thickness sa-profile-key-height))
|
2017-03-14 07:02:03 +08:00
|
|
|
|
(def row-radius (+ (/ (/ (+ mount-height extra-height) 2)
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(Math/sin (/ α 2)))
|
|
|
|
|
cap-top-height))
|
2017-03-14 07:02:03 +08:00
|
|
|
|
(def column-radius (+ (/ (/ (+ mount-width extra-width) 2)
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(Math/sin (/ β 2)))
|
|
|
|
|
cap-top-height))
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(def column-x-delta (+ -1 (- (* column-radius (Math/sin β)))))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(defn apply-key-geometry [translate-fn rotate-x-fn rotate-y-fn column row shape]
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(let [column-angle (* β (- centercol column))
|
2017-03-23 10:40:20 +08:00
|
|
|
|
placed-shape (->> shape
|
|
|
|
|
(translate-fn [0 0 (- row-radius)])
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(rotate-x-fn (* α (- centerrow row)))
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(translate-fn [0 0 row-radius])
|
|
|
|
|
(translate-fn [0 0 (- column-radius)])
|
|
|
|
|
(rotate-y-fn column-angle)
|
|
|
|
|
(translate-fn [0 0 column-radius])
|
|
|
|
|
(translate-fn (column-offset column)))
|
2017-03-10 08:25:55 +08:00
|
|
|
|
column-z-delta (* column-radius (- 1 (Math/cos column-angle)))
|
2017-03-23 10:40:20 +08:00
|
|
|
|
placed-shape-ortho (->> shape
|
|
|
|
|
(translate-fn [0 0 (- row-radius)])
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(rotate-x-fn (* α (- centerrow row)))
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(translate-fn [0 0 row-radius])
|
|
|
|
|
(rotate-y-fn column-angle)
|
|
|
|
|
(translate-fn [(- (* (- column centercol) column-x-delta)) 0 column-z-delta])
|
|
|
|
|
(translate-fn (column-offset column)))
|
|
|
|
|
placed-shape-fixed (->> shape
|
|
|
|
|
(rotate-y-fn (nth fixed-angles column))
|
|
|
|
|
(translate-fn [(nth fixed-x column) 0 (nth fixed-z column)])
|
|
|
|
|
(translate-fn [0 0 (- (+ row-radius (nth fixed-z column)))])
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(rotate-x-fn (* α (- centerrow row)))
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(translate-fn [0 0 (+ row-radius (nth fixed-z column))])
|
|
|
|
|
(rotate-y-fn fixed-tenting)
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(translate-fn [0 (second (column-offset column)) 0]))]
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(->> (case column-style
|
2018-04-11 22:37:58 +08:00
|
|
|
|
:orthographic placed-shape-ortho
|
|
|
|
|
:fixed placed-shape-fixed
|
|
|
|
|
placed-shape)
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(rotate-y-fn tenting-angle)
|
|
|
|
|
(translate-fn [0 0 keyboard-z-offset]))))
|
|
|
|
|
|
|
|
|
|
(defn key-place [column row shape]
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(apply-key-geometry translate
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(fn [angle obj] (rotate angle [1 0 0] obj))
|
|
|
|
|
(fn [angle obj] (rotate angle [0 1 0] obj))
|
|
|
|
|
column row shape))
|
2017-03-23 10:40:20 +08:00
|
|
|
|
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(defn rotate-around-x [angle position]
|
|
|
|
|
(mmul
|
2017-03-23 10:40:20 +08:00
|
|
|
|
[[1 0 0]
|
|
|
|
|
[0 (Math/cos angle) (- (Math/sin angle))]
|
|
|
|
|
[0 (Math/sin angle) (Math/cos angle)]]
|
|
|
|
|
position))
|
|
|
|
|
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(defn rotate-around-y [angle position]
|
|
|
|
|
(mmul
|
2017-03-23 10:40:20 +08:00
|
|
|
|
[[(Math/cos angle) 0 (Math/sin angle)]
|
|
|
|
|
[0 1 0]
|
|
|
|
|
[(- (Math/sin angle)) 0 (Math/cos angle)]]
|
|
|
|
|
position))
|
|
|
|
|
|
|
|
|
|
(defn key-position [column row position]
|
|
|
|
|
(apply-key-geometry (partial map +) rotate-around-x rotate-around-y column row position))
|
|
|
|
|
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(def key-holes
|
|
|
|
|
(apply union
|
|
|
|
|
(for [column columns
|
|
|
|
|
row rows
|
2017-03-10 08:25:55 +08:00
|
|
|
|
:when (or (.contains [2 3] column)
|
|
|
|
|
(not= row lastrow))]
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(->> single-plate
|
|
|
|
|
(key-place column row)))))
|
|
|
|
|
|
|
|
|
|
(def caps
|
|
|
|
|
(apply union
|
|
|
|
|
(for [column columns
|
|
|
|
|
row rows
|
2017-03-10 08:25:55 +08:00
|
|
|
|
:when (or (.contains [2 3] column)
|
|
|
|
|
(not= row lastrow))]
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(->> (sa-cap (if (= column 5) 1 1))
|
|
|
|
|
(key-place column row)))))
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; Web Connectors ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2018-05-20 08:22:27 +08:00
|
|
|
|
(def web-thickness 3)
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(def post-size 0.1)
|
|
|
|
|
(def web-post (->> (cube post-size post-size web-thickness)
|
|
|
|
|
(translate [0 0 (+ (/ web-thickness -2)
|
|
|
|
|
plate-thickness)])))
|
|
|
|
|
|
|
|
|
|
(def post-adj (/ post-size 2))
|
|
|
|
|
(def web-post-tr (translate [(- (/ mount-width 2) post-adj) (- (/ mount-height 2) post-adj) 0] web-post))
|
|
|
|
|
(def web-post-tl (translate [(+ (/ mount-width -2) post-adj) (- (/ mount-height 2) post-adj) 0] web-post))
|
|
|
|
|
(def web-post-bl (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))
|
|
|
|
|
|
|
|
|
|
(defn triangle-hulls [& shapes]
|
|
|
|
|
(apply union
|
|
|
|
|
(map (partial apply hull)
|
|
|
|
|
(partition 3 1 shapes))))
|
|
|
|
|
|
|
|
|
|
(def connectors
|
|
|
|
|
(apply union
|
|
|
|
|
(concat
|
|
|
|
|
;; Row connections
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(for [column (range 0 (dec ncols))
|
|
|
|
|
row (range 0 lastrow)]
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(triangle-hulls
|
|
|
|
|
(key-place (inc column) row web-post-tl)
|
|
|
|
|
(key-place column row web-post-tr)
|
|
|
|
|
(key-place (inc column) row web-post-bl)
|
|
|
|
|
(key-place column row web-post-br)))
|
|
|
|
|
|
|
|
|
|
;; Column connections
|
|
|
|
|
(for [column columns
|
2017-03-10 08:25:55 +08:00
|
|
|
|
row (range 0 cornerrow)]
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(triangle-hulls
|
|
|
|
|
(key-place column row web-post-bl)
|
|
|
|
|
(key-place column row web-post-br)
|
|
|
|
|
(key-place column (inc row) web-post-tl)
|
|
|
|
|
(key-place column (inc row) web-post-tr)))
|
|
|
|
|
|
|
|
|
|
;; Diagonal connections
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(for [column (range 0 (dec ncols))
|
|
|
|
|
row (range 0 cornerrow)]
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(triangle-hulls
|
|
|
|
|
(key-place column row web-post-br)
|
|
|
|
|
(key-place column (inc row) web-post-tr)
|
|
|
|
|
(key-place (inc column) row web-post-bl)
|
|
|
|
|
(key-place (inc column) (inc row) web-post-tl))))))
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;
|
|
|
|
|
;; Thumbs ;;
|
|
|
|
|
;;;;;;;;;;;;
|
2017-03-11 07:08:27 +08:00
|
|
|
|
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(def thumborigin
|
2017-03-11 07:08:27 +08:00
|
|
|
|
(map + (key-position 1 cornerrow [(/ mount-width 2) (- (/ mount-height 2)) 0])
|
2018-04-11 22:37:58 +08:00
|
|
|
|
thumb-offsets))
|
2017-03-10 08:25:55 +08:00
|
|
|
|
|
|
|
|
|
(defn thumb-tr-place [shape]
|
|
|
|
|
(->> shape
|
2018-06-11 16:58:48 +08:00
|
|
|
|
(rotate (deg2rad 14) [1 0 0])
|
|
|
|
|
(rotate (deg2rad -15) [0 1 0])
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(rotate (deg2rad 10) [0 0 1]) ; original 10
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(translate thumborigin)
|
2018-06-11 16:58:48 +08:00
|
|
|
|
(translate [-15 -10 5]))) ; original 1.5u (translate [-12 -16 3])
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(defn thumb-tl-place [shape]
|
|
|
|
|
(->> shape
|
|
|
|
|
(rotate (deg2rad 10) [1 0 0])
|
|
|
|
|
(rotate (deg2rad -23) [0 1 0])
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(rotate (deg2rad 25) [0 0 1]) ; original 10
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(translate thumborigin)
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(translate [-35 -16 -2]))) ; original 1.5u (translate [-32 -15 -2])))
|
|
|
|
|
|
|
|
|
|
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(defn thumb-mr-place [shape]
|
|
|
|
|
(->> shape
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(rotate (deg2rad 10) [1 0 0])
|
|
|
|
|
(rotate (deg2rad -23) [0 1 0])
|
|
|
|
|
(rotate (deg2rad 25) [0 0 1])
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(translate thumborigin)
|
2018-06-11 16:58:48 +08:00
|
|
|
|
(translate [-23 -34 -8])))
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(defn thumb-br-place [shape]
|
|
|
|
|
(->> shape
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(rotate (deg2rad 6) [1 0 0])
|
|
|
|
|
(rotate (deg2rad -34) [0 1 0])
|
|
|
|
|
(rotate (deg2rad 35) [0 0 1])
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(translate thumborigin)
|
2018-06-11 16:58:48 +08:00
|
|
|
|
(translate [-39 -43 -18])))
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(defn thumb-bl-place [shape]
|
|
|
|
|
(->> shape
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(rotate (deg2rad 6) [1 0 0])
|
2018-06-11 16:58:48 +08:00
|
|
|
|
(rotate (deg2rad -32) [0 1 0])
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(rotate (deg2rad 35) [0 0 1])
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(translate thumborigin)
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(translate [-51 -25 -12]))) ; (translate [-51 -25 -12])))
|
|
|
|
|
|
2017-03-10 08:25:55 +08:00
|
|
|
|
|
|
|
|
|
(defn thumb-1x-layout [shape]
|
|
|
|
|
(union
|
|
|
|
|
(thumb-mr-place shape)
|
|
|
|
|
(thumb-br-place shape)
|
|
|
|
|
(thumb-bl-place shape)))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(defn thumb-15x-layout [shape]
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(union
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(thumb-tr-place shape)
|
|
|
|
|
(thumb-tl-place shape)))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
|
|
|
|
(def thumbcaps
|
|
|
|
|
(union
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(thumb-1x-layout (sa-cap 1))
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(thumb-15x-layout (rotate (/ π 2) [0 0 1] (sa-cap 1)))))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(def thumb
|
|
|
|
|
(union
|
|
|
|
|
(thumb-1x-layout single-plate)
|
|
|
|
|
(thumb-15x-layout single-plate)
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(thumb-15x-layout single-plate)))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(def thumb-post-tr (translate [(- (/ mount-width 2) post-adj) (- (/ mount-height 2) post-adj) 0] web-post))
|
|
|
|
|
(def thumb-post-tl (translate [(+ (/ mount-width -2) post-adj) (- (/ mount-height 2) post-adj) 0] web-post))
|
|
|
|
|
(def thumb-post-bl (translate [(+ (/ mount-width -2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post))
|
|
|
|
|
(def thumb-post-br (translate [(- (/ mount-width 2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(def thumb-connectors
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(union
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(triangle-hulls ; top two
|
|
|
|
|
(thumb-tl-place thumb-post-tr)
|
|
|
|
|
(thumb-tl-place thumb-post-br)
|
|
|
|
|
(thumb-tr-place thumb-post-tl)
|
|
|
|
|
(thumb-tr-place thumb-post-bl))
|
|
|
|
|
(triangle-hulls ; bottom two on the right
|
|
|
|
|
(thumb-br-place web-post-tr)
|
|
|
|
|
(thumb-br-place web-post-br)
|
|
|
|
|
(thumb-mr-place web-post-tl)
|
|
|
|
|
(thumb-mr-place web-post-bl))
|
|
|
|
|
|
|
|
|
|
(triangle-hulls ; tr, mr and wall
|
|
|
|
|
(thumb-mr-place web-post-tr)
|
|
|
|
|
(thumb-mr-place web-post-br)
|
|
|
|
|
(thumb-tr-place thumb-post-br))
|
|
|
|
|
|
|
|
|
|
(triangle-hulls ; centers of the bottom four
|
|
|
|
|
(thumb-br-place web-post-tl)
|
|
|
|
|
(thumb-bl-place web-post-bl)
|
|
|
|
|
(thumb-br-place web-post-tr)
|
|
|
|
|
(thumb-bl-place web-post-br)
|
|
|
|
|
(thumb-mr-place web-post-tl)
|
|
|
|
|
(thumb-mr-place web-post-tr)
|
|
|
|
|
(thumb-bl-place web-post-br))
|
|
|
|
|
(triangle-hulls ; top two to the middle two, starting on the left
|
|
|
|
|
(thumb-tl-place thumb-post-tl)
|
|
|
|
|
(thumb-bl-place web-post-tr)
|
|
|
|
|
(thumb-tl-place thumb-post-bl)
|
|
|
|
|
(thumb-bl-place web-post-br)
|
|
|
|
|
(thumb-tl-place thumb-post-br)
|
|
|
|
|
(thumb-mr-place web-post-tr)
|
|
|
|
|
(thumb-tr-place thumb-post-bl)
|
|
|
|
|
; (thumb-mr-place thumb-post-br)
|
|
|
|
|
(thumb-tr-place thumb-post-br))
|
|
|
|
|
(triangle-hulls ; top two to the main keyboard, starting on the left
|
|
|
|
|
(thumb-tl-place thumb-post-tl)
|
|
|
|
|
(key-place 0 cornerrow web-post-bl)
|
|
|
|
|
(thumb-tl-place thumb-post-tr)
|
|
|
|
|
(key-place 0 cornerrow web-post-br)
|
|
|
|
|
(thumb-tr-place thumb-post-tl)
|
|
|
|
|
(key-place 1 cornerrow web-post-bl)
|
|
|
|
|
(thumb-tr-place thumb-post-tr)
|
|
|
|
|
(key-place 1 cornerrow web-post-br)
|
|
|
|
|
(key-place 2 lastrow web-post-tl)
|
|
|
|
|
(key-place 2 lastrow web-post-bl)
|
|
|
|
|
(thumb-tr-place thumb-post-tr)
|
|
|
|
|
(key-place 2 lastrow web-post-bl)
|
|
|
|
|
(thumb-tr-place thumb-post-br)
|
|
|
|
|
(key-place 2 lastrow web-post-br)
|
|
|
|
|
(key-place 3 lastrow web-post-bl)
|
|
|
|
|
(key-place 2 lastrow web-post-tr)
|
|
|
|
|
(key-place 3 lastrow web-post-tl)
|
|
|
|
|
(key-place 3 cornerrow web-post-bl)
|
|
|
|
|
(key-place 3 lastrow web-post-tr)
|
|
|
|
|
(key-place 3 cornerrow web-post-br)
|
|
|
|
|
(key-place 4 cornerrow web-post-bl))
|
|
|
|
|
(triangle-hulls
|
|
|
|
|
(key-place 1 cornerrow web-post-br)
|
|
|
|
|
(key-place 2 lastrow web-post-tl)
|
|
|
|
|
(key-place 2 cornerrow web-post-bl)
|
|
|
|
|
(key-place 2 lastrow web-post-tr)
|
|
|
|
|
(key-place 2 cornerrow web-post-br)
|
|
|
|
|
(key-place 3 cornerrow web-post-bl))
|
|
|
|
|
(triangle-hulls
|
|
|
|
|
(key-place 3 lastrow web-post-tr)
|
|
|
|
|
(key-place 3 lastrow web-post-br)
|
|
|
|
|
(key-place 3 lastrow web-post-tr)
|
|
|
|
|
(key-place 4 cornerrow web-post-bl))))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;
|
|
|
|
|
;; Case ;;
|
|
|
|
|
;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(defn bottom [height p]
|
|
|
|
|
(->> (project p)
|
|
|
|
|
(extrude-linear {:height height :twist 0 :convexity 0})
|
2017-03-14 07:02:03 +08:00
|
|
|
|
(translate [0 0 (- (/ height 2) 10)])))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(defn bottom-hull [& p]
|
2017-03-14 07:02:03 +08:00
|
|
|
|
(hull p (bottom 0.001 p)))
|
2015-12-02 13:19:52 +08:00
|
|
|
|
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(def left-wall-x-offset 5) ; original 10
|
|
|
|
|
(def left-wall-z-offset 3) ; original 3
|
2017-03-17 10:03:07 +08:00
|
|
|
|
|
|
|
|
|
(defn left-key-position [row direction]
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(map - (key-position 0 row [(* mount-width -0.5) (* direction mount-height 0.5) 0]) [left-wall-x-offset 0 left-wall-z-offset]))
|
2017-03-17 10:03:07 +08:00
|
|
|
|
|
|
|
|
|
(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])
|
2017-03-11 23:42:07 +08:00
|
|
|
|
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(defn wall-brace [place1 dx1 dy1 post1 place2 dx2 dy2 post2]
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(union
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(hull
|
|
|
|
|
(place1 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 (wall-locate1 dx2 dy2) post2))
|
|
|
|
|
(place2 (translate (wall-locate2 dx2 dy2) post2))
|
|
|
|
|
(place2 (translate (wall-locate3 dx2 dy2) post2)))
|
|
|
|
|
(bottom-hull
|
|
|
|
|
(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)))))
|
2017-03-10 08:25:55 +08:00
|
|
|
|
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(defn key-wall-brace [x1 y1 dx1 dy1 post1 x2 y2 dx2 dy2 post2]
|
|
|
|
|
(wall-brace (partial key-place x1 y1) dx1 dy1 post1
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(partial key-place x2 y2) dx2 dy2 post2))
|
|
|
|
|
|
|
|
|
|
(def case-walls
|
2015-12-02 13:19:52 +08:00
|
|
|
|
(union
|
2017-03-10 08:25:55 +08:00
|
|
|
|
; back wall
|
2017-03-11 07:08:27 +08:00
|
|
|
|
(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 lastcol 0 0 1 web-post-tr lastcol 0 1 0 web-post-tr)
|
2017-03-10 08:25:55 +08:00
|
|
|
|
; right wall
|
2017-03-11 07:08:27 +08:00
|
|
|
|
(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)
|
2017-03-10 08:25:55 +08:00
|
|
|
|
; left wall
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(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)
|
2017-03-10 08:25:55 +08:00
|
|
|
|
; front wall
|
2017-03-11 07:08:27 +08:00
|
|
|
|
(key-wall-brace lastcol 0 0 1 web-post-tr lastcol 0 1 0 web-post-tr)
|
2017-03-10 08:25:55 +08:00
|
|
|
|
(key-wall-brace 3 lastrow 0 -1 web-post-bl 3 lastrow 0.5 -1 web-post-br)
|
2018-04-21 15:29:26 +08:00
|
|
|
|
(key-wall-brace 3 lastrow 0.5 -1 web-post-br 4 cornerrow 0.5 -1 web-post-bl)
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(for [x (range 4 ncols)] (key-wall-brace x cornerrow 0 -1 web-post-bl x cornerrow 0 -1 web-post-br)) ; TODO fix extra wall
|
2017-03-11 07:08:27 +08:00
|
|
|
|
(for [x (range 5 ncols)] (key-wall-brace x cornerrow 0 -1 web-post-bl (dec x) cornerrow 0 -1 web-post-br))
|
2017-03-10 08:25:55 +08:00
|
|
|
|
; thumb walls
|
|
|
|
|
(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-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)
|
|
|
|
|
; thumb corners
|
|
|
|
|
(wall-brace thumb-br-place -1 0 web-post-bl thumb-br-place 0 -1 web-post-bl)
|
|
|
|
|
(wall-brace thumb-bl-place -1 0 web-post-tl thumb-bl-place 0 1 web-post-tl)
|
|
|
|
|
; thumb tweeners
|
|
|
|
|
(wall-brace thumb-mr-place 0 -1 web-post-bl thumb-br-place 0 -1 web-post-br)
|
|
|
|
|
(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)
|
2017-03-17 10:03:07 +08:00
|
|
|
|
; clunky bit on the top left thumb connection (normal connectors don't work well)
|
|
|
|
|
(bottom-hull
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(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-bl-place (translate (wall-locate2 -0.3 1) web-post-tr))
|
|
|
|
|
(thumb-bl-place (translate (wall-locate3 -0.3 1) web-post-tr)))
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(hull
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(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-bl-place (translate (wall-locate2 -0.3 1) web-post-tr))
|
|
|
|
|
(thumb-bl-place (translate (wall-locate3 -0.3 1) web-post-tr))
|
|
|
|
|
(thumb-tl-place thumb-post-tl))
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(hull
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(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))
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(hull
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(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))
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(hull
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(thumb-bl-place web-post-tr)
|
|
|
|
|
(thumb-bl-place (translate (wall-locate1 -0.3 1) web-post-tr))
|
|
|
|
|
(thumb-bl-place (translate (wall-locate2 -0.3 1) web-post-tr))
|
|
|
|
|
(thumb-bl-place (translate (wall-locate3 -0.3 1) web-post-tr))
|
|
|
|
|
(thumb-tl-place thumb-post-tl))))
|
|
|
|
|
|
2018-05-20 07:19:45 +08:00
|
|
|
|
(def usb-holder-ref (key-position 0 0 (map - (wall-locate2 0 -1) [0 (/ mount-height 2) 0])))
|
|
|
|
|
|
2018-05-22 15:24:46 +08:00
|
|
|
|
(def usb-holder-position (map + [15 22.4 0] [(first usb-holder-ref) (second usb-holder-ref) 2]))
|
|
|
|
|
(def usb-holder-cube (cube 15 12 2))
|
2018-05-20 07:19:45 +08:00
|
|
|
|
(def usb-holder-space (translate (map + usb-holder-position [0 (* -1 wall-thickness) 1]) usb-holder-cube))
|
2018-05-22 15:24:46 +08:00
|
|
|
|
(def usb-holder-holder (translate usb-holder-position (cube 19 12 4)))
|
2018-04-11 22:37:58 +08:00
|
|
|
|
|
2018-05-22 15:24:46 +08:00
|
|
|
|
(def usb-jack (translate (map + usb-holder-position [0 10 3]) (cube 8 20 3)))
|
2018-04-11 22:37:58 +08:00
|
|
|
|
|
2018-06-11 17:16:39 +08:00
|
|
|
|
(def pro-micro-position (map + (key-position 0 1 (wall-locate3 -1 0)) [-6 0 -20]))
|
|
|
|
|
(def pro-micro-space-size [5 10 12]) ; z has no wall;
|
2018-04-21 15:23:14 +08:00
|
|
|
|
(def pro-micro-wall-thickness 2)
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(def pro-micro-holder-size [(+ pro-micro-wall-thickness (first pro-micro-space-size)) (+ pro-micro-wall-thickness (second pro-micro-space-size)) (last pro-micro-space-size)])
|
|
|
|
|
(def pro-micro-holder
|
|
|
|
|
(->> (cube (first pro-micro-holder-size) (second pro-micro-holder-size) (last pro-micro-holder-size))
|
|
|
|
|
(translate [(first pro-micro-position) (second pro-micro-position) (last pro-micro-position)])))
|
|
|
|
|
(def pro-micro-space
|
|
|
|
|
(->> (cube (first pro-micro-space-size) (second pro-micro-space-size) (last pro-micro-space-size))
|
2018-06-11 17:16:39 +08:00
|
|
|
|
(translate [(- (first pro-micro-position) (/ pro-micro-wall-thickness 2)) (- (second pro-micro-position) (/ pro-micro-wall-thickness 2)) (last pro-micro-position)])))
|
2018-04-11 22:37:58 +08:00
|
|
|
|
|
2018-05-22 15:24:46 +08:00
|
|
|
|
(def trrs-holder-size [6.2 13 2]) ; trrs jack PJ-320A
|
2018-05-21 14:35:49 +08:00
|
|
|
|
(def trrs-holder-position (map + usb-holder-position [-13.6 -4.5 0]))
|
2018-05-20 07:19:45 +08:00
|
|
|
|
(def trrs-holder-thickness 2)
|
2018-04-21 09:25:43 +08:00
|
|
|
|
(def trrs-holder-thickness-2x (* 2 trrs-holder-thickness))
|
|
|
|
|
(def trrs-holder
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(union
|
2018-04-21 09:25:43 +08:00
|
|
|
|
(->> (cube (+ (first trrs-holder-size) trrs-holder-thickness-2x) (+ wall-thickness (second trrs-holder-size) trrs-holder-thickness) (+ (last trrs-holder-size) trrs-holder-thickness))
|
|
|
|
|
(translate [(first trrs-holder-position) (+ wall-thickness (second trrs-holder-position)) (/ (+ (last trrs-holder-size) trrs-holder-thickness) 2)]))))
|
|
|
|
|
(def trrs-holder-hole
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(union
|
|
|
|
|
|
|
|
|
|
; circle trrs hole
|
|
|
|
|
(->>
|
2018-06-10 18:45:59 +08:00
|
|
|
|
(->> (binding [*fn* 30] (cylinder 2.55 20))) ; 5mm trrs jack
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(rotate (deg2rad 90) [1 0 0])
|
2018-05-22 15:24:46 +08:00
|
|
|
|
(translate [(first trrs-holder-position) (+ (second trrs-holder-position) (+ wall-thickness (/ (+ (second trrs-holder-size) trrs-holder-thickness) 2))) (+ 3 (/ (+ (last trrs-holder-size) trrs-holder-thickness) 2))])) ;1.5 padding
|
2018-04-11 22:37:58 +08:00
|
|
|
|
|
|
|
|
|
; rectangular trrs holder
|
2018-04-21 09:25:43 +08:00
|
|
|
|
(->> (apply cube trrs-holder-size) (translate [(first trrs-holder-position) (+ (/ wall-thickness 2) (second trrs-holder-position) (/ trrs-holder-thickness 2)) (+ (/ (last trrs-holder-size) 2) trrs-holder-thickness)]))))
|
2017-04-02 22:16:41 +08:00
|
|
|
|
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(defn screw-insert-shape [bottom-radius top-radius height]
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(union
|
|
|
|
|
(->> (binding [*fn* 30]
|
|
|
|
|
(cylinder [bottom-radius top-radius] height)))
|
2018-05-20 08:40:06 +08:00
|
|
|
|
(translate [0 0 (/ height 2)] (->> (binding [*fn* 30] (sphere top-radius))))))
|
2017-03-11 23:42:07 +08:00
|
|
|
|
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(defn screw-insert [column row bottom-radius top-radius height offset]
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(let [shift-right (= column lastcol)
|
2017-03-11 23:42:07 +08:00
|
|
|
|
shift-left (= column 0)
|
|
|
|
|
shift-up (and (not (or shift-right shift-left)) (= row 0))
|
2017-04-03 02:48:37 +08:00
|
|
|
|
shift-down (and (not (or shift-right shift-left)) (>= row lastrow))
|
2017-03-17 10:03:07 +08:00
|
|
|
|
position (if shift-up (key-position column row (map + (wall-locate2 0 1) [0 (/ mount-height 2) 0]))
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(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])))))]
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(->> (screw-insert-shape bottom-radius top-radius height)
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(translate (map + offset [(first position) (second position) (/ height 2)])))))
|
2017-03-17 10:03:07 +08:00
|
|
|
|
|
|
|
|
|
(defn screw-insert-all-shapes [bottom-radius top-radius height]
|
2018-06-11 17:09:00 +08:00
|
|
|
|
(union (screw-insert 0 0 bottom-radius top-radius height [9 9 0])
|
2018-06-12 11:25:19 +08:00
|
|
|
|
(screw-insert 0 lastrow bottom-radius top-radius height [1 8 0])
|
2018-06-12 11:30:29 +08:00
|
|
|
|
(screw-insert lastcol lastrow bottom-radius top-radius height [-5 13 0])
|
2018-06-11 17:09:00 +08:00
|
|
|
|
(screw-insert lastcol 0 bottom-radius top-radius height [-3 6 0])
|
2018-05-20 08:27:27 +08:00
|
|
|
|
(screw-insert 1 lastrow bottom-radius top-radius height [0 -16 0])))
|
2018-05-20 07:30:26 +08:00
|
|
|
|
|
|
|
|
|
; Hole Depth Y: 4.4
|
|
|
|
|
(def screw-insert-height 4)
|
|
|
|
|
|
|
|
|
|
; Hole Diameter C: 4.1-4.4
|
|
|
|
|
(def screw-insert-bottom-radius (/ 4.4 2))
|
|
|
|
|
(def screw-insert-top-radius (/ 4.4 2))
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(def screw-insert-holes (screw-insert-all-shapes screw-insert-bottom-radius screw-insert-top-radius screw-insert-height))
|
2018-05-20 07:30:26 +08:00
|
|
|
|
|
|
|
|
|
; Wall Thickness W:\t1.65
|
|
|
|
|
(def screw-insert-outers (screw-insert-all-shapes (+ screw-insert-bottom-radius 1.65) (+ screw-insert-top-radius 1.65) (+ screw-insert-height 1.5)))
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(def screw-insert-screw-holes (screw-insert-all-shapes 1.7 1.7 350))
|
2017-03-17 10:03:07 +08:00
|
|
|
|
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(def model-right (difference
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(union
|
|
|
|
|
key-holes
|
|
|
|
|
connectors
|
|
|
|
|
thumb
|
|
|
|
|
thumb-connectors
|
|
|
|
|
(difference (union case-walls
|
|
|
|
|
screw-insert-outers
|
|
|
|
|
pro-micro-holder
|
2018-04-21 09:25:43 +08:00
|
|
|
|
usb-holder-holder
|
|
|
|
|
trrs-holder)
|
|
|
|
|
usb-holder-space
|
|
|
|
|
usb-jack
|
2018-04-11 22:37:58 +08:00
|
|
|
|
pro-micro-space
|
2018-04-21 09:25:43 +08:00
|
|
|
|
trrs-holder-hole
|
2018-04-21 09:32:42 +08:00
|
|
|
|
screw-insert-holes))
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(translate [0 0 -20] (cube 350 350 40))))
|
2017-03-23 10:40:20 +08:00
|
|
|
|
|
|
|
|
|
(spit "things/right.scad"
|
|
|
|
|
(write-scad model-right))
|
2018-04-11 17:17:01 +08:00
|
|
|
|
|
2017-03-23 10:40:20 +08:00
|
|
|
|
(spit "things/left.scad"
|
|
|
|
|
(write-scad (mirror [-1 0 0] model-right)))
|
2018-04-11 17:17:01 +08:00
|
|
|
|
|
2017-03-17 10:03:07 +08:00
|
|
|
|
(spit "things/right-test.scad"
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(write-scad
|
2018-06-11 10:00:30 +08:00
|
|
|
|
(difference
|
|
|
|
|
(union
|
|
|
|
|
key-holes
|
|
|
|
|
connectors
|
|
|
|
|
thumb
|
|
|
|
|
thumb-connectors
|
|
|
|
|
case-walls
|
|
|
|
|
thumbcaps
|
|
|
|
|
caps)
|
|
|
|
|
|
|
|
|
|
(translate [0 0 -20] (cube 350 350 40)))))
|
2015-12-04 12:45:05 +08:00
|
|
|
|
|
2017-03-25 05:03:47 +08:00
|
|
|
|
(spit "things/right-plate.scad"
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(write-scad
|
2018-04-11 22:37:58 +08:00
|
|
|
|
(cut
|
|
|
|
|
(translate [0 0 -0.1]
|
|
|
|
|
(difference (union case-walls
|
|
|
|
|
screw-insert-outers)
|
|
|
|
|
(translate [0 0 -10] screw-insert-screw-holes))))))
|
2017-04-02 22:16:41 +08:00
|
|
|
|
|
2017-04-03 01:39:00 +08:00
|
|
|
|
(spit "things/test.scad"
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(write-scad
|
2018-04-21 09:25:43 +08:00
|
|
|
|
(difference trrs-holder trrs-holder-hole)))
|
2017-04-03 01:39:00 +08:00
|
|
|
|
|
2018-04-11 17:17:01 +08:00
|
|
|
|
(defn -main [dum] 1) ; dummy to make it easier to batch
|