From dfb8498ed3b75baa226bb517eb2e8dd69f30b336 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Fri, 10 Apr 2020 20:22:26 +0200 Subject: [PATCH] 3 thumb keys, smoother transition between thumb and fingers --- .gitignore | 2 + README.md | 26 +- project.clj | 3 +- src/dactyl_keyboard/dactyl.clj | 815 ++++++++++++++++----------------- 4 files changed, 398 insertions(+), 448 deletions(-) diff --git a/.gitignore b/.gitignore index b2bcecb3..e6397298 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ *.stl *.ai *.svg +/.idea/ +/dactyl-manuform-mini-keyboard.iml diff --git a/README.md b/README.md index a86305e7..7e59aab7 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,36 @@ -# Dactyl ManuForm Mini Keyboard +# Dactyl ManuForm Tight Keyboard This is a fork of the [Dactyl-ManuForm](https://github.com/tshort/dactyl-keyboard). The Dactyl-Manuform is a fork of the [Dactyl](https://github.com/adereth/dactyl-keyboard) with the thumb cluster from [ManuForm](https://github.com/jeffgran/ManuForm). -Build log: https://www.beekeeb.com/dactyl-manuform-mini-mechanical-keyboard-build-log/ - ## Forks - https://github.com/lebastaq/dactyl-manuform-mini-keyboard ## Features +- As small around the keys as possible +- Smoother transition between thumb and fingers (less facets) +- Thicker walls in steep regions where walls were too thin -- The use of sidenubs can be disabled. Sidenub should be disabled if you use Kailh, and Outemu. If you use Cherry MX, Gateron or Zealios switches, you can enable the sidenubs. -- Spaces for rentention tabs are added. -- One key in the thumb cluster has been removed. Other thumb keys are also adjusted. -- The total height is reduced and wire posts are removed. This results in a - higher printing speed and a lower cost. -- A TRRS mount instead of a RJ9 mount is used. -- A micro USB mount is used. A breakout board, or an extension cable can be used. -- Screw posts are moved inside. The holes are designed for TRISERT® thread inserts 145m3. -- The pro micro holder has been modified. Dupont cables can be used. ## Generate OpenSCAD and STL models -* Run `lein generate` or `lein auto generate` +* Run `lein repl` +* In the repl run `(load-file "src/dactyl_keyboard/dactyl.clj")` * This will regenerate the `things/*.scad` files * Use OpenSCAD to open a `.scad` file. * Make changes to design, repeat `load-file`, OpenSCAD will watch for changes and rerender. * When done, use OpenSCAD to export STL files +## Tips + +* When trying things out, 10 seconds of rendering time in OpenSCAD is really annoying. Load one of the test outputs with commented out parts that you don't use. +* If you're not sure what things are generted by a piece of code, color them in using something like +`(color [0.5 0.5 0.5 0.5] (the code)` ## License -Copyright © 2015-2018 Matthew Adereth, Tom Short and Leo Lou +Copyright © 2015-2020 Matthew Adereth, Tom Short, Leo Lou, Okke Formsma The source code for generating the models is distributed under the [GNU AFFERO GENERAL PUBLIC LICENSE Version 3](LICENSE). diff --git a/project.clj b/project.clj index e01d78e4..0291dd61 100644 --- a/project.clj +++ b/project.clj @@ -3,12 +3,11 @@ :url "http://example.com/FIXME" :main dactyl-keyboard.dactyl :license {:name "Eclipse Public License" - :url "http://www.eclipse.org/legal/epl-v10.html"} + :url "http://www.eclipse.org/legal/epl-v10.html"} :plugins [[lein-auto "0.1.3"] [lein-exec "0.3.7"]] :aliases {"generate" ["exec" "-p" "src/dactyl_keyboard/dactyl.clj"]} :dependencies [[org.clojure/clojure "1.7.0"] - [unicode-math "0.2.0"] [scad-clj "0.4.0"]]) diff --git a/src/dactyl_keyboard/dactyl.clj b/src/dactyl_keyboard/dactyl.clj index f877d977..9fc03c91 100644 --- a/src/dactyl_keyboard/dactyl.clj +++ b/src/dactyl_keyboard/dactyl.clj @@ -2,8 +2,7 @@ (:refer-clojure :exclude [use import]) (:require [clojure.core.matrix :refer [array matrix mmul]] [scad-clj.scad :refer :all] - [scad-clj.model :refer :all] - [unicode-math.core :refer :all])) + [scad-clj.model :refer :all])) (defn deg2rad [degrees] (* (/ degrees 180) pi)) @@ -15,38 +14,38 @@ (def nrows 4) (def ncols 6) -(def α (deg2rad 23)) ; 15 ; curvature of the columns -(def β (deg2rad 5)) ; 5 ; curvature of the rows -(def centerrow 1) ; controls front-back tilt -(def centercol 2) ; controls left-right tilt / tenting (higher number is more tenting) -(def tenting-angle (deg2rad 15)) ; or, change this for more precise tenting control +(def α (deg2rad 20)) ; 15 ; curvature of the columns +(def β (deg2rad 5)) ; 5 ; curvature of the rows +(def centerrow (- nrows 3)) ; controls front-back tilt +(def centercol 2) ; controls left-right tilt / tenting (higher number is more tenting) +(def tenting-angle (deg2rad 15)) ; or, change this for more precise tenting control (def column-style - (if (> nrows 5) :orthographic :standard)) ; options include :standard, :orthographic, and :fixed + (if (> nrows 5) :orthographic :standard)) ; options include :standard, :orthographic, and :fixed ; (def column-style :fixed) (def pinky-15u false) (defn column-offset [column] (cond (= column 2) [0 2.82 -3] - (>= column 4) [0 -6 5.64] ; original [0 -5.8 5.64] + (>= column 4) [0 -6 5.64] ; original [0 -5.8 5.64] :else [0 0 0])) (def thumb-offsets [6 -3 7]) -(def keyboard-z-offset 9) ; controls overall height; original=9 with centercol=3; use 16 for centercol=2 +(def keyboard-z-offset 9) ; controls overall height; original=9 with centercol=3; use 16 for centercol=2 -(def extra-width 2) ; extra space between the base of keys; original= 2 -(def extra-height 1.0) ; original= 0.5 +(def extra-width 2) ; extra space between the base of keys; original= 2 +(def extra-height 1.0) ; original= 0.5 -(def wall-z-offset 0) ; -5 ; original=-15 length of the first downward-sloping part of the wall (negative) +(def wall-z-offset -0.5) ; -5 ; original=-15 length of the first downward-sloping part of the wall (negative) ;(def wall-xy-offset 0.5) ; 2 ; offset in the x and/or y direction for the first downward-sloping part of the wall (negative) (def wall-x-offset 0.5) (def wall-y-offset 0.5) -(def left-wall-x-offset 0) ; original 10 -(def left-wall-y-offset 0) ; original 0 -(def left-wall-z-offset 0) ; original 3 +(def left-wall-x-offset 0) ; original 10 +(def left-wall-y-offset 0) ; original 0 +(def left-wall-z-offset 0) ; original 3 -(def wall-thickness 2) ; wall thickness parameter; originally 5 +(def wall-thickness 2) ; wall thickness parameter; originally 5 ;; Settings for column-style == :fixed ;; The defaults roughly match Maltron settings @@ -54,8 +53,8 @@ ;; Fixed-z overrides the z portion of the column ofsets above. ;; NOTE: THIS DOESN'T WORK QUITE LIKE I'D HOPED. (def fixed-angles [(deg2rad 10) (deg2rad 10) 0 0 0 (deg2rad -15) (deg2rad -15)]) -(def fixed-x [-41.5 -22.5 0 20.3 41.4 65.5 89.6]) ; relative to the middle finger -(def fixed-z [12.1 8.3 0 5 10.7 14.5 17.5]) +(def fixed-x [-41.5 -22.5 0 20.3 41.4 65.5 89.6]) ; relative to the middle finger +(def fixed-z [12.1 8.3 0 5 10.7 14.5 17.5]) (def fixed-tenting (deg2rad 0)) ; If you use Cherry MX or Gateron switches, this can be turned on. @@ -74,7 +73,7 @@ ;; Switch Hole ;; ;;;;;;;;;;;;;;;;; -(def keyswitch-height 14.2) ;; Was 14.1, then 14.25 +(def keyswitch-height 14.2) ;; Was 14.1, then 14.25 (def keyswitch-width 14.2) (def sa-profile-key-height 12.7) @@ -96,7 +95,7 @@ 0 (/ plate-thickness 2)])) side-nub (->> (binding [*fn* 30] (cylinder 1 2.75)) - (rotate (/ π 2) [1 0 0]) + (rotate (/ pi 2) [1 0 0]) (translate [(+ (/ keyswitch-width 2)) 0 1]) (hull (->> (cube 1.5 2.75 side-nub-thickness) (translate [(+ (/ 1.5 2) (/ keyswitch-width 2)) @@ -111,13 +110,13 @@ (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]))))) + (union plate-half + (->> plate-half + (mirror [1 0 0]) + (mirror [0 1 0]))) + (->> + top-nub-pair + (rotate (/ pi 2) [0 0 1]))))) ;;;;;;;;;;;;;;;; ;; SA Keycaps ;; @@ -125,31 +124,31 @@ (def sa-length 18.25) (def sa-double-length 37.5) -(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]))) - 2 (let [bl2 sa-length - 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]))) +(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]))) + 2 (let [bl2 sa-length + 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 (/ 27.94 2) key-cap (hull (->> (polygon [[bw2 bl2] [bw2 (- bl2)] [(- bw2) (- bl2)] [(- bw2) bl2]]) @@ -184,33 +183,33 @@ (let [column-angle (* β (- centercol column)) placed-shape (->> shape (translate-fn [(offset-for-column column) 0 (- row-radius)]) - (rotate-x-fn (* α (- centerrow row))) + (rotate-x-fn (* α (- centerrow row))) (translate-fn [0 0 row-radius]) (translate-fn [0 0 (- column-radius)]) - (rotate-y-fn column-angle) + (rotate-y-fn column-angle) (translate-fn [0 0 column-radius]) (translate-fn (column-offset column))) column-z-delta (* column-radius (- 1 (Math/cos column-angle))) placed-shape-ortho (->> shape (translate-fn [0 0 (- row-radius)]) - (rotate-x-fn (* α (- centerrow row))) + (rotate-x-fn (* α (- centerrow row))) (translate-fn [0 0 row-radius]) - (rotate-y-fn column-angle) + (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)) + (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)))]) - (rotate-x-fn (* α (- centerrow row))) + (rotate-x-fn (* α (- centerrow row))) (translate-fn [0 0 (+ row-radius (nth fixed-z column))]) - (rotate-y-fn fixed-tenting) + (rotate-y-fn fixed-tenting) (translate-fn [0 (second (column-offset column)) 0]))] (->> (case column-style :orthographic placed-shape-ortho - :fixed placed-shape-fixed + :fixed placed-shape-fixed placed-shape) - (rotate-y-fn tenting-angle) + (rotate-y-fn tenting-angle) (translate-fn [0 0 keyboard-z-offset])))) (defn key-place [column row shape] @@ -221,17 +220,17 @@ (defn rotate-around-x [angle position] (mmul - [[1 0 0] - [0 (Math/cos angle) (- (Math/sin angle))] - [0 (Math/sin angle) (Math/cos angle)]] - position)) + [[1 0 0] + [0 (Math/cos angle) (- (Math/sin angle))] + [0 (Math/sin angle) (Math/cos angle)]] + position)) (defn rotate-around-y [angle position] (mmul - [[(Math/cos angle) 0 (Math/sin angle)] - [0 1 0] - [(- (Math/sin angle)) 0 (Math/cos angle)]] - position)) + [[(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)) @@ -258,6 +257,10 @@ ;; Web Connectors ;; ;;;;;;;;;;;;;;;;;;;; +; posts are located at the inside corners of the key plates. +; the 'web' is the fill between key plates. +; + (def web-thickness 2) (def post-size 0.1) (def web-post (->> (cube post-size post-size web-thickness) @@ -270,13 +273,22 @@ (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)) +; fat web post for very steep angles between thumb and finger clusters +; this ensures the walls stay somewhat thicker +(def fat-post-size 1.2) +(def fat-web-post (->> (cube fat-post-size fat-post-size fat-post-size) + (translate [0 0 (+ (/ fat-post-size -2) + plate-thickness)]))) + +(def fat-post-adj (/ fat-post-size 2)) +(def fat-web-post-tr (translate [(- (/ mount-width 2) fat-post-adj) (- (/ mount-height 2) fat-post-adj) 0] fat-web-post)) ; wide posts for 1.5u keys in the main cluster (if (true? pinky-15u) - (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)) + (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-bl (translate [(+ (/ mount-width -1.2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post)) - (def wide-post-br (translate [(- (/ mount-width 1.2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post))) + (def wide-post-br (translate [(- (/ mount-width 1.2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post))) (do (def wide-post-tr web-post-tr) (def wide-post-tl web-post-tl) (def wide-post-bl web-post-bl) @@ -287,35 +299,40 @@ (map (partial apply hull) (partition 3 1 shapes)))) +(defn piramid-hulls [top & shapes] + (apply union + (map (partial apply hull top) + (partition 2 1 shapes)))) + (def connectors (apply union (concat - ;; Row connections - (for [column (range 0 (dec ncols)) - row (range 0 lastrow)] - (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 - row (range 0 cornerrow)] - (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 - (for [column (range 0 (dec ncols)) - row (range 0 cornerrow)] - (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)))))) + ;; Row connections + (for [column (range 0 (dec ncols)) + row (range 0 lastrow)] + (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 + row (range 0 cornerrow)] + (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 + (for [column (range 0 (dec ncols)) + row (range 0 cornerrow)] + (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 ;; @@ -325,151 +342,100 @@ (map + (key-position 1 cornerrow [(/ mount-width 2) (- (/ mount-height 2)) 0]) thumb-offsets)) -(defn thumb-tr-place [shape] +(defn thumb-place [rot move shape] (->> shape - (rotate (deg2rad 14) [1 0 0]) - (rotate (deg2rad -15) [0 1 0]) - (rotate (deg2rad 10) [0 0 1]) ; original 10 + (rotate (deg2rad (nth rot 0)) [1 0 0]) + (rotate (deg2rad (nth rot 1)) [0 1 0]) + (rotate (deg2rad (nth rot 2)) [0 0 1]) ; original 10 (translate thumborigin) - (translate [-15 -10 5]))) ; original 1.5u (translate [-12 -16 3]) -(defn thumb-tl-place [shape] - (->> shape - (rotate (deg2rad 10) [1 0 0]) - (rotate (deg2rad -23) [0 1 0]) - (rotate (deg2rad 25) [0 0 1]) ; original 10 - (translate thumborigin) - (translate [-35 -16 -2]))) ; original 1.5u (translate [-32 -15 -2]))) - - -(defn thumb-mr-place [shape] - (->> shape - (rotate (deg2rad 10) [1 0 0]) - (rotate (deg2rad -23) [0 1 0]) - (rotate (deg2rad 25) [0 0 1]) - (translate thumborigin) - (translate [-23 -34 -6]))) -(defn thumb-br-place [shape] - (->> shape - (rotate (deg2rad 6) [1 0 0]) - (rotate (deg2rad -34) [0 1 0]) - (rotate (deg2rad 35) [0 0 1]) - (translate thumborigin) - (translate [-39 -43 -16]))) -(defn thumb-bl-place [shape] - (->> shape - (rotate (deg2rad 6) [1 0 0]) - (rotate (deg2rad -32) [0 1 0]) - (rotate (deg2rad 35) [0 0 1]) - (translate thumborigin) - (translate [-51 -25 -11.5]))) ; (translate [-51 -25 -12]))) + (translate move))) +(defn thumb-r-place [shape] (thumb-place [14 -15 10] [-15 -10 5] shape)) ; right +(defn thumb-m-place [shape] (thumb-place [10 -23 25] [-35 -16 -2] shape)) ; middle +(defn thumb-l-place [shape] (thumb-place [6 -32 35] [-51 -25 -11.5] shape)) ; left -(defn thumb-1x-layout [shape] +(defn thumb-layout [shape] (union - (thumb-mr-place shape) - (thumb-br-place shape) - (thumb-tl-place shape) - (thumb-bl-place shape))) + (thumb-r-place shape) + (thumb-m-place shape) + (thumb-l-place shape) + )) -(defn thumb-15x-layout [shape] - (union - (thumb-tr-place shape))) -(def larger-plate - (let [plate-height (- (/ (- sa-double-length mount-height) 3) 0.5) - top-plate (->> (cube mount-width plate-height web-thickness) - (translate [0 (/ (+ plate-height mount-height) 2) - (- plate-thickness (/ web-thickness 2))]))] - (union top-plate (mirror [0 1 0] top-plate)))) +(def thumbcaps (thumb-layout (sa-cap 1))) -(def thumbcaps - (union - (thumb-1x-layout (sa-cap 1)) - (thumb-15x-layout (rotate (/ π 2) [0 0 1] (sa-cap 1))))) - -(def thumb - (union - (thumb-1x-layout single-plate) - (thumb-15x-layout single-plate) - ; (thumb-15x-layout larger-plate) -)) +(def thumb (thumb-layout single-plate)) -(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-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)) +(def thumb-post-br (translate [(- (/ mount-width 2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post)) (def thumb-connectors (union - (triangle-hulls ; top two - (thumb-tl-place web-post-tr) - (thumb-tl-place web-post-br) - (thumb-tr-place thumb-post-tl) - (thumb-tr-place thumb-post-bl)) - (triangle-hulls ; bottom two - (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 - (thumb-mr-place web-post-tr) - (thumb-mr-place web-post-br) - (thumb-tr-place thumb-post-br)) - (triangle-hulls ; between top row and bottom row - (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-tl-place web-post-bl) - (thumb-mr-place web-post-tr) - (thumb-tl-place web-post-br) - (thumb-tr-place web-post-bl) - (thumb-mr-place web-post-tr) - (thumb-tr-place web-post-br)) - (triangle-hulls ; top two to the middle two, starting on the left - (thumb-tl-place web-post-tl) - (thumb-bl-place web-post-tr) - (thumb-tl-place web-post-bl) - (thumb-bl-place web-post-br) - (thumb-mr-place web-post-tr) - (thumb-tl-place web-post-bl) - (thumb-tl-place web-post-br) - (thumb-mr-place web-post-tr)) - (triangle-hulls ; top two to the main keyboard, starting on the left - (thumb-tl-place web-post-tl) - (key-place 0 cornerrow web-post-bl) - (thumb-tl-place web-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)))) + (triangle-hulls ; top two + (thumb-m-place web-post-tr) + (thumb-m-place web-post-br) + (thumb-r-place thumb-post-tl) + (thumb-r-place thumb-post-bl)) + (triangle-hulls ; top two + (thumb-m-place web-post-tl) + (thumb-l-place web-post-tr) + (thumb-m-place web-post-bl) + (thumb-l-place web-post-br) + (thumb-m-place web-post-bl) + (thumb-m-place web-post-br)) + (triangle-hulls ; top two to the main keyboard, starting on the left + (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)) + (hull ; between thumb m and top key + (left-key-place cornerrow -1 web-post) + (thumb-m-place (translate (wall-locate2 0 1) web-post-tl)) + (thumb-m-place web-post-tr) + (thumb-m-place web-post-tl)) + (piramid-hulls ; top ridge thumb side + (left-key-place cornerrow -1 web-post) + (thumb-r-place web-post-tr) + (thumb-r-place web-post-tl) + (thumb-m-place web-post-tr)) + (piramid-hulls + (thumb-r-place web-post-tr) ; top ridge finger side + (left-key-place cornerrow -1 web-post) + (key-place 0 cornerrow web-post-bl) + (key-place 0 cornerrow web-post-br)) + (piramid-hulls ; infill between top ridge and fingers + (thumb-r-place fat-web-post-tr) + (key-place 0 cornerrow web-post-br) + (key-place 1 cornerrow web-post-bl) + (key-place 1 cornerrow web-post-br) + (key-place 2 lastrow web-post-tl) + (key-place 2 lastrow web-post-bl) + (thumb-r-place web-post-br)) + (piramid-hulls ; between thumb and front wall + (key-place 2 lastrow web-post-bl) + (thumb-r-place web-post-br) + (key-place 3 lastrow (translate (wall-locate3 0 -1) web-post-bl)) + (key-place 3 lastrow web-post-bl) + (key-place 2 lastrow web-post-br) + ))) ;;;;;;;;;; ;; Case ;; @@ -494,22 +460,25 @@ (defn wall-locate2 [dx dy] [(* dx wall-x-offset) (* dy wall-y-offset) wall-z-offset]) (defn wall-locate3 [dx dy] [(* dx (+ wall-y-offset wall-thickness)) (* dy (+ wall-y-offset wall-thickness)) wall-z-offset]) +; dx1, dy1, dx2, dy2 = direction of the wall. '1' for front, '-1' for back, '0' for 'not in this direction'. +; place1, place2 = function that places an object at a location, typically refers to the center of a key position. +; post1, post2 = the (defn wall-brace [place1 dx1 dy1 post1 place2 dx2 dy2 post2] (union - (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))))) + (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))))) (defn key-wall-brace [x1 y1 dx1 dy1 post1 x2 y2 dx2 dy2 post2] (wall-brace (partial key-place x1 y1) dx1 dy1 post1 @@ -523,95 +492,64 @@ (for [y (range 1 lastrow)] (key-wall-brace lastcol (dec y) 1 0 br lastcol y 1 0 tr)) (key-wall-brace lastcol cornerrow 0 -1 br lastcol cornerrow 1 0 br)))) + (def case-walls (union - right-wall - ; 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)) - - ; left wall - ; key rows - (for [y (range 0 lastrow)] (union - ; bottom part - (wall-brace (partial left-key-place y 1) -1 0 web-post (partial left-key-place y -1) -1 0 web-post) - ; top part - (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)))) - ; in between key rows - (for [y (range 1 lastrow)] (union - ; bottom part - (wall-brace (partial left-key-place (dec y) -1) -1 0 web-post (partial left-key-place y 1) -1 0 web-post) - ; top part - (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)))) - ; left-back-corner - (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 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 0.5 -1 web-post-bl) - (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 - (for [x (range 5 ncols)] (key-wall-brace x cornerrow 0 -1 web-post-bl (dec x) cornerrow 0 -1 web-post-br)) - ; 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) - ; 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-bl-place (translate (wall-locate2 -0.3 1) web-post-tr)) - (thumb-bl-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-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 web-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 web-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) - (thumb-tl-place web-post-tl)) - (hull - (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 web-post-tl)))) - -(def usb-holder-ref (key-position 0 0 (map - (wall-locate2 0 -1) [0 (/ mount-height 2) 0]))) + right-wall + ; 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)) + + ; left wall + (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)))) + ; left-back-corner + (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 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 0.5 -1 web-post-bl) + (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 + (for [x (range 5 ncols)] (key-wall-brace x cornerrow 0 -1 web-post-bl (dec x) cornerrow 0 -1 web-post-br)) + ; thumb walls + (wall-brace thumb-m-place 0 -1 web-post-br thumb-r-place 0 -1 thumb-post-br) + (wall-brace thumb-m-place 0 -1 web-post-br thumb-m-place 0 -1 web-post-bl) + (wall-brace thumb-l-place 0 -1 web-post-br thumb-l-place 0 -1 web-post-bl) + (wall-brace thumb-l-place 0 1 web-post-tr thumb-l-place 0 1 web-post-tl) + (wall-brace thumb-l-place -1 0 web-post-tl thumb-l-place -1 0 web-post-bl) + ; thumb corners + (wall-brace thumb-l-place -1 0 web-post-bl thumb-l-place 0 -1 web-post-bl) + (wall-brace thumb-l-place -1 0 web-post-tl thumb-l-place 0 1 web-post-tl) + ; thumb tweeners + (wall-brace thumb-m-place 0 -1 web-post-bl thumb-l-place 0 -1 web-post-br) + (wall-brace thumb-m-place 0 1 web-post-tl thumb-l-place 0 1 web-post-tr) + (wall-brace thumb-l-place -1 0 web-post-bl thumb-l-place -1 0 web-post-tl) + (wall-brace thumb-r-place 0 -1 thumb-post-br (partial key-place 3 lastrow) 0 -1 web-post-bl) + ; inner corner between left wall and thumb + (bottom-hull ; inner corner wall down + (left-key-place cornerrow -1 web-post) + (left-key-place cornerrow -1 (translate (wall-locate3 -1 0) web-post)) + (thumb-m-place web-post-tl) + (thumb-m-place (translate (wall-locate3 0 1) web-post-tl))) + )) + +(def usb-holder-ref (key-position 0 0 (map - (wall-locate2 0 -1) [0 (/ mount-height 2) 0]))) (def usb-holder-position (map + [17 19.3 0] [(first usb-holder-ref) (second usb-holder-ref) 2])) -(def usb-holder-cube (cube 15 12 2)) -(def usb-holder-space (translate (map + usb-holder-position [0 (* -1 wall-thickness) 1]) usb-holder-cube)) +(def usb-holder-cube (cube 15 12 2)) +(def usb-holder-space (translate (map + usb-holder-position [0 (* -1 wall-thickness) 1]) usb-holder-cube)) (def usb-holder-holder (translate usb-holder-position (cube 19 12 4))) (def usb-jack (translate (map + usb-holder-position [0 10 3]) (cube 8.1 20 3.1))) (def pro-micro-position (map + (key-position 0 1 (wall-locate3 -1 0)) [-3 2 -15])) -(def pro-micro-space-size [4 10 12]) ; z has no wall; +(def pro-micro-space-size [4 10 12]) ; z has no wall; (def pro-micro-wall-thickness 2) (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-space @@ -619,57 +557,57 @@ (translate [(- (first pro-micro-position) (/ pro-micro-wall-thickness 2)) (- (second pro-micro-position) (/ pro-micro-wall-thickness 2)) (last pro-micro-position)]))) (def pro-micro-holder (difference - (->> (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)])) - pro-micro-space)) + (->> (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)])) + pro-micro-space)) -(def trrs-holder-size [6.2 10 2]) ; trrs jack PJ-320A -(def trrs-holder-hole-size [6.2 10 6]) ; trrs jack PJ-320A -(def trrs-holder-position (map + usb-holder-position [-13.6 0 0])) +(def trrs-holder-size [6.2 10 2]) ; trrs jack PJ-320A +(def trrs-holder-hole-size [6.2 10 6]) ; trrs jack PJ-320A +(def trrs-holder-position (map + usb-holder-position [-13.6 0 0])) (def trrs-holder-thickness 2) (def trrs-holder-thickness-2x (* 2 trrs-holder-thickness)) (def trrs-holder (union - (->> (cube (+ (first trrs-holder-size) trrs-holder-thickness-2x) (+ trrs-holder-thickness (second trrs-holder-size)) (+ (last trrs-holder-size) trrs-holder-thickness)) - (translate [(first trrs-holder-position) (second trrs-holder-position) (/ (+ (last trrs-holder-size) trrs-holder-thickness) 2)])))) + (->> (cube (+ (first trrs-holder-size) trrs-holder-thickness-2x) (+ trrs-holder-thickness (second trrs-holder-size)) (+ (last trrs-holder-size) trrs-holder-thickness)) + (translate [(first trrs-holder-position) (second trrs-holder-position) (/ (+ (last trrs-holder-size) trrs-holder-thickness) 2)])))) (def trrs-holder-hole (union - ; circle trrs hole - (->> - (->> (binding [*fn* 30] (cylinder 2.55 20))) ; 5mm trrs jack - (rotate (deg2rad 90) [1 0 0]) - (translate [(first trrs-holder-position) (+ (second trrs-holder-position) (/ (+ (second trrs-holder-size) trrs-holder-thickness) 2)) (+ 3 (/ (+ (last trrs-holder-size) trrs-holder-thickness) 2))])) ;1.5 padding + ; circle trrs hole + (->> + (->> (binding [*fn* 30] (cylinder 2.55 20))) ; 5mm trrs jack + (rotate (deg2rad 90) [1 0 0]) + (translate [(first trrs-holder-position) (+ (second trrs-holder-position) (/ (+ (second trrs-holder-size) trrs-holder-thickness) 2)) (+ 3 (/ (+ (last trrs-holder-size) trrs-holder-thickness) 2))])) ;1.5 padding - ; rectangular trrs holder - (->> (apply cube trrs-holder-hole-size) (translate [(first trrs-holder-position) (+ (/ trrs-holder-thickness -2) (second trrs-holder-position)) (+ (/ (last trrs-holder-hole-size) 2) trrs-holder-thickness)])))) + ; rectangular trrs holder + (->> (apply cube trrs-holder-hole-size) (translate [(first trrs-holder-position) (+ (/ trrs-holder-thickness -2) (second trrs-holder-position)) (+ (/ (last trrs-holder-hole-size) 2) trrs-holder-thickness)])))) (defn screw-insert-shape [bottom-radius top-radius height] (union - (->> (binding [*fn* 30] - (cylinder [bottom-radius top-radius] height))) - (translate [0 0 (/ height 2)] (->> (binding [*fn* 30] (sphere top-radius)))))) + (->> (binding [*fn* 30] + (cylinder [bottom-radius top-radius] height))) + (translate [0 0 (/ height 2)] (->> (binding [*fn* 30] (sphere top-radius)))))) (defn screw-insert [column row bottom-radius top-radius height offset] - (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)) - 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])))))] + (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)) + 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 (map + offset [(first position) (second position) (/ height 2)]))))) (defn screw-insert-all-shapes [bottom-radius top-radius height] - (union (screw-insert 0 0 bottom-radius top-radius height [11 10 0]) - (screw-insert 0 lastrow bottom-radius top-radius height [0 0 0]) - ; (screw-insert lastcol lastrow bottom-radius top-radius height [-5 13 0]) - ; (screw-insert lastcol 0 bottom-radius top-radius height [-3 6 0]) - (screw-insert lastcol lastrow bottom-radius top-radius height (if pinky-15u [0 12 0] [-5 12 0])) ; -5 12 - (screw-insert lastcol 0 bottom-radius top-radius height (if pinky-15u [0 7 0] [-4 8 0])) ; -5 7 - (screw-insert 1 lastrow bottom-radius top-radius height [0 -16 0]))) + (union (screw-insert 0 0 bottom-radius top-radius height [11 10 0]) + (screw-insert 0 lastrow bottom-radius top-radius height [0 0 0]) + ; (screw-insert lastcol lastrow bottom-radius top-radius height [-5 13 0]) + ; (screw-insert lastcol 0 bottom-radius top-radius height [-3 6 0]) + (screw-insert lastcol lastrow bottom-radius top-radius height (if pinky-15u [0 12 0] [-5 12 0])) ; -5 12 + (screw-insert lastcol 0 bottom-radius top-radius height (if pinky-15u [0 7 0] [-4 8 0])) ; -5 7 + (screw-insert 1 lastrow bottom-radius top-radius height [0 -16 0]))) ; Hole Depth Y: 4.4 (def screw-insert-height 4) @@ -677,92 +615,105 @@ ; Hole Diameter C: 4.1-4.4 (def screw-insert-bottom-radius (/ 4.4 2)) (def screw-insert-top-radius (/ 4.4 2)) -(def screw-insert-holes (screw-insert-all-shapes screw-insert-bottom-radius screw-insert-top-radius screw-insert-height)) +(def screw-insert-holes (screw-insert-all-shapes screw-insert-bottom-radius screw-insert-top-radius screw-insert-height)) ; 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))) -(def screw-insert-screw-holes (screw-insert-all-shapes 1.7 1.7 350)) +(def screw-insert-screw-holes (screw-insert-all-shapes 1.7 1.7 350)) (def pinky-connectors (apply union (concat - ;; Row connections - (for [row (range 0 lastrow)] - (triangle-hulls - (key-place lastcol row web-post-tr) - (key-place lastcol row wide-post-tr) - (key-place lastcol row web-post-br) - (key-place lastcol row wide-post-br))) - - ;; Column connections - (for [row (range 0 cornerrow)] - (triangle-hulls - (key-place lastcol row web-post-br) - (key-place lastcol row wide-post-br) - (key-place lastcol (inc row) web-post-tr) - (key-place lastcol (inc row) wide-post-tr))) - ;; -))) + ;; Row connections + (for [row (range 0 lastrow)] + (triangle-hulls + (key-place lastcol row web-post-tr) + (key-place lastcol row wide-post-tr) + (key-place lastcol row web-post-br) + (key-place lastcol row wide-post-br))) + + ;; Column connections + (for [row (range 0 cornerrow)] + (triangle-hulls + (key-place lastcol row web-post-br) + (key-place lastcol row wide-post-br) + (key-place lastcol (inc row) web-post-tr) + (key-place lastcol (inc row) wide-post-tr))) + ;; + ))) (def pinky-walls (union - (key-wall-brace lastcol cornerrow 0 -1 web-post-br lastcol cornerrow 0 -1 wide-post-br) - (key-wall-brace lastcol 0 0 1 web-post-tr lastcol 0 0 1 wide-post-tr))) + (key-wall-brace lastcol cornerrow 0 -1 web-post-br lastcol cornerrow 0 -1 wide-post-br) + (key-wall-brace lastcol 0 0 1 web-post-tr lastcol 0 0 1 wide-post-tr))) (def model-right (difference - (union - key-holes - pinky-connectors - pinky-walls - connectors - thumb - thumb-connectors - (difference (union case-walls - ;screw-insert-outers - pro-micro-holder - ;usb-holder-holder - ;trrs-holder - ) - ;usb-holder-space - ;usb-jack - ;trrs-holder-hole - ;screw-insert-holes - )) - (translate [0 0 -20] (cube 350 350 40)))) - -(spit "things/right.scad" - (write-scad model-right)) - -(spit "things/left.scad" - (write-scad (mirror [-1 0 0] model-right))) - -(spit "things/right-test.scad" - (write-scad - (difference - (union - key-holes - pinky-connectors - pinky-walls - connectors - thumb - thumb-connectors - case-walls - thumbcaps - caps) - - (translate [0 0 -20] (cube 350 350 40))))) - -(spit "things/right-plate.scad" - (write-scad - (cut - (translate [0 0 -0.1] - (difference (union case-walls - pinky-walls - screw-insert-outers) - (translate [0 0 -10] screw-insert-screw-holes)))))) + (union + key-holes + pinky-connectors + pinky-walls + connectors + thumb + thumbcaps + thumb-connectors + (difference (union case-walls + ;screw-insert-outers + pro-micro-holder + ;usb-holder-holder + ;trrs-holder + ) + ;usb-holder-space + ;usb-jack + ;trrs-holder-hole + ;screw-insert-holes + )) + (translate [0 0 -20] (cube 350 350 40)))) +; +;(spit "things/right.scad" +; (write-scad model-right)) +; +;(spit "things/left.scad" +; (write-scad (mirror [-1 0 0] model-right))) (spit "things/test.scad" (write-scad - (difference trrs-holder trrs-holder-hole))) - -(defn -main [dum] 1) ; dummy to make it easier to batch + (difference + (union + key-holes + connectors + thumb + thumb-connectors + case-walls + ) + (translate [0 0 -20] (cube 350 350 40))))) +; +;(spit "things/right-test.scad" +; (write-scad +; (difference +; (union +; key-holes +; pinky-connectors +; pinky-walls +; connectors +; thumb +; thumb-connectors +; case-walls +; thumbcaps +; caps) +; +; (translate [0 0 -20] (cube 350 350 40))))) +; +;(spit "things/right-plate.scad" +; (write-scad +; (cut +; (translate [0 0 -0.1] +; (difference (union case-walls +; pinky-walls +; screw-insert-outers) +; (translate [0 0 -10] screw-insert-screw-holes)))))) +; +;(spit "things/test.scad" +; (write-scad +; (difference trrs-holder trrs-holder-hole))) +; +;(defn -main [dum] 1) ; dummy to make it easier to batch