]> git.armaanb.net Git - atreides.git/commitdiff
Much more compact design.
authorPhil Hagelberg <phil@hagelb.org>
Sun, 19 May 2019 17:14:08 +0000 (10:14 -0700)
committerPhil Hagelberg <phil@hagelb.org>
Mon, 20 May 2019 20:05:09 +0000 (13:05 -0700)
case/case.rkt
case/logo-fragment.svg [new file with mode: 0644]
case/pcb-fragment.svg [new file with mode: 0644]

index eac15c1c7c5f0bf77a25cbe16b04b657dac30745..5f94b76aa05951e0ec484641465e06ba993ea06d 100644 (file)
@@ -1,8 +1,12 @@
 #lang racket
-;; Atreus case design mk 4
+;; Atreus 2 case design
 ;; Copyright © 2019 Phil Hagelberg and contributors
 ;; released under the GPLv3 or later
 
+;; TODO:
+;; * port notch on bottom plate and spacer
+;; * top layer
+
 (require xml)
 
 ;; glowforge uses 96 dpi, 25.4 mm in an inch
 
 (define switch-spacing 19.0)
 
-(define screw-radius 1.642) ; for M3 screws
+(define screw-radius 1.4) ; for M3 screws + kerf
 
-(define side-screw-distance (- (* switch-spacing (+ rows 1)) switch-height))
-(define bottom-screw-distance (- (* switch-spacing (+ cols 1)) switch-width))
+(define side-screw-distance (* switch-spacing rows))
+(define bottom-screw-distance (* switch-spacing cols))
 (define left corner-radius)
 (define bottom 95) ; outer bottom
 (define left-top (+ left (* side-screw-distance (sin angle))))
 (define top (- bottom (* side-screw-distance (cos angle))))
 (define right (- width corner-radius))
 (define right-top (- right (* side-screw-distance (sin angle))))
-(define mid-bottom (+ bottom (* bottom-screw-distance (sin angle))))
+(define mid-bottom (+ bottom (* bottom-screw-distance (sin angle)) -3))
 (define mid-offset 25)
-(define mid-left (- (/ width 2) mid-offset))
-(define mid-right (+ (/ width 2) mid-offset))
+(define mid-x (/ width 2))
+(define mid-left (- mid-x mid-offset))
+(define mid-right (+ mid-x mid-offset))
 
-(define hull-coords (list (list mid-right top)
-                          (list right-top top)
+(define hull-coords (list (list right-top top)
                           (list right bottom)
                           (list mid-right mid-bottom)
                           (list mid-left mid-bottom)
                           (list left bottom)
-                          (list left-top top)
-                          (list mid-left top)))
+                          (list left-top top)))
 
 ;;; screws
 (define screws
-  `(g () ,@(for/list ([s (append (take hull-coords 3)
+  `(g () ,@(for/list ([s (append (take hull-coords 2)
                                  ;; the bottom middle has only one screw but
                                  ;; two hull positions
                                  (list (list (/ width 2) mid-bottom))
-                                 (drop hull-coords 5))])
+                                 (drop hull-coords 4))])
              `(circle ((r ,(number->string screw-radius))
                        (cx ,(number->string (first s)))
                        (cy ,(number->string (second s))))))))
             (outline-points coords (sub1 theta) current-screw)))
       coords))
 
-(define outline `(polygon
-                  ((points ,(string-join (outline-points '() 90 0))))))
+(define port-depth 8)
+
+(define port-curve (list (format "~s,~s" mid-right (- top corner-radius))
+                         (format "~s,~s" (+ mid-x corner-radius)
+                                 (+ top port-depth
+                                    (- corner-radius)))
+                         (format "~s,~s" (- mid-x corner-radius)
+                                 (+ top port-depth
+                                    (- corner-radius)))
+                         (format "~s,~s" mid-left (- top corner-radius))))
+
+(define (outline with-port?)
+  `(polygon ((points ,(string-join (let ((noport (outline-points '() 90 0)))
+                                     (if with-port?
+                                         (append noport port-curve)
+                                         noport)))))))
 
 ;;; switches
 
-(define column-offsets '(8 5 0 6 11 52))
+(define column-offsets `(8 5 0 6 11 ,(+ 8 switch-spacing switch-spacing)))
 
 (define (switch row col)
   (let* ([x (* (+ 1 col) switch-spacing)]
 
 (define hand-height (+ (* switch-spacing rows) (- switch-spacing switch-height)
                        (list-ref column-offsets 0)))
-(define switch-x-offset -6)
-(define switch-y-offset (- bottom hand-height))
+(define switch-x-offset -6.5)
+(define switch-y-offset (- bottom hand-height -3.5))
 
 (define switches
   `(g ((transform ,(format "translate(~s, ~s) rotate(~s, ~s, ~s)"
   `(g ((transform ,(format "translate(~s,~s) scale(-1, 1)" width 0)))
       ,switches))
 
-(define doc
+(define logo-doc (call-with-input-file "logo-fragment.svg" read-xml))
+
+(define pcb-doc (call-with-input-file "pcb-fragment.svg" read-xml))
+
+(define (layer plate)
   (document (prolog '() false '())
             (xexpr->xml
              `(svg ((xmlns:svg "http://www.w3.org/2000/svg")
                     (height ,(number->string (* height scale)))
                     (width ,(number->string (* width scale))))
+                   ,@(if (eq? plate 'switch)
+                         `((g ((transform "translate(436, 115)")
+                               (stroke "red"))
+                              ,(xml->xexpr (document-element logo-doc))))
+                         '())
+                   ,@(if (eq? plate 'spacer)
+                         (list (xml->xexpr (document-element pcb-doc)))
+                         (list))
                    (g ((transform ,(format "scale(~s, ~s)" scale scale))
                        (stroke-width "1")
                        (stroke "black")
                        (fill-opacity "0"))
                       ,screws
-                      ,outline
-                      ,switches
-                      ,switches-right
-                      )))
+                      ,(outline (not (eq? plate 'switch)))
+                      ,@(if (eq? plate 'switch)
+                            (list switches switches-right)
+                            (list)))))
             '()))
 
-(call-with-output-file "case-mk4.svg"
-  (lambda (out)
-    (display "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" out)
-    (display-xml doc out))
-  #:exists 'replace)
+;; to laser cut these, you have to open them in inkscape, then save,
+;; and then upload; for some reason the glowforge crashes if you try to cut
+;; them directly.
+
+(define (write-out-layer layer-name)
+  (call-with-output-file (format "case2-~a.svg" (symbol->string layer-name))
+    (lambda (out)
+      (display "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" out)
+      (display-xml (layer layer-name) out))
+    #:exists 'replace))
+
+(write-out-layer 'switch)
+(write-out-layer 'bottom)
+(write-out-layer 'spacer)
diff --git a/case/logo-fragment.svg b/case/logo-fragment.svg
new file mode 100644 (file)
index 0000000..a480059
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<g
+     id="g10"
+     inkscape:groupmode="layer"
+     inkscape:label="ink_ext_XXXXXX"
+     transform="matrix(1.3333333,0,0,-1.3333333,0,0)"><path
+       inkscape:connector-curvature="0"
+       id="path1758"
+       style="fill:none;stroke-width:0.79936999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 13.726028,0.688685 h -1.836 c -1.824,7.559 -7.1399998,7.274 -9.4999998,0 H 0.55402823 l 5.42199997,16.313 h 2.328 l 5.4219998,-16.313" /><path
+       inkscape:connector-curvature="0"
+       id="path1760"
+       style="fill:none;stroke-width:0.79936999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 26.941028,11.489685 h -1.465 c -0.969,1.774 -0.074,3.996 -3.5,4.047 v -13.387 h 2.625 v -1.461 h -6.984 v 1.461 h 2.636 v 13.387 c -3.578,-0.051 -1.812,-1.754 -3.5,-4.047 h -1.464 v 5.512 h 11.652 v -5.512" /><path
+       inkscape:connector-curvature="0"
+       id="path1762"
+       style="fill:none;stroke-width:0.79936999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 41.089028,0.688685 h -2.175 l -4.762,6.989 h -2.535 v -6.989 h -1.715 v 8.45 h 5.375 c 1.199,0 2.14,0.25 2.824,0.75 0.692,0.507 1.039,1.324 1.039,2.449 m 0,0 c 0,1.109 -0.347,1.918 -1.039,2.426 -0.684,0.515 -1.625,0.773 -2.824,0.773 h -5.375 v 1.465 h 5.375 c 1.793,0 3.18,-0.395 4.164,-1.176 0.98,-0.773 1.473,-1.937 1.473,-3.488 0,-0.684 -0.121,-1.301 -0.36,-1.848 -0.242,-0.543 -0.574,-1.008 -0.988,-1.391 -0.418,-0.382 -0.918,-0.691 -1.5,-0.921 -0.574,-0.235 -1.207,-0.375 -1.887,-0.426 l 4.91,-7.063" /><path
+       inkscape:connector-curvature="0"
+       id="path1764"
+       style="fill:none;stroke-width:0.79936999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 54.328028,0.688685 h -10.426 v 16.313 h 10.426 v -1.465 h -8.711 v -5.836 h 6.422 v -1.461 h -6.422 v -6.09 h 8.711 v -1.461" /><path
+       inkscape:connector-curvature="0"
+       id="path1766"
+       style="fill:none;stroke-width:0.79936999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 68.328028,6.501685 c 0,-0.926 -0.106,-1.762 -0.313,-2.512 -0.199,-0.75 -0.515,-1.394 -0.949,-1.926 -0.426,-0.527 -0.969,-0.933 -1.625,-1.226 -0.66,-0.293 -1.438,-0.438 -2.34,-0.438 -0.906,0 -1.691,0.145 -2.348,0.438 -0.652,0.293 -1.187,0.699 -1.613,1.226 -0.418,0.532 -0.73,1.18 -0.937,1.938 -0.2,0.758 -0.301,1.597 -0.301,2.523 v 10.477 h 1.715 v -10.5 c 0,-0.492 0.039,-1.012 0.125,-1.563 0.09,-0.55 0.261,-1.05 0.511,-1.5 0.258,-0.449 0.614,-0.824 1.063,-1.125 0.457,-0.3 1.055,-0.449 1.785,-0.449 0.734,0 1.332,0.149 1.789,0.449 0.465,0.301 0.824,0.676 1.074,1.125 0.258,0.45 0.43,0.95 0.512,1.5 0.086,0.551 0.125,1.071 0.125,1.563 v 10.5 h 1.727 v -10.5" /><path
+       inkscape:connector-curvature="0"
+       id="path1768"
+       style="fill:none;stroke-width:0.79936999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 82.527028,4.938685 c 0,-0.683 -0.141,-1.304 -0.426,-1.863 -0.281,-0.551 -0.66,-1.023 -1.137,-1.426 -0.472,-0.398 -1.019,-0.707 -1.636,-0.926 -0.618,-0.214 -1.258,-0.324 -1.926,-0.324 -0.918,0 -1.758,0.172 -2.524,0.512 -1.671,0.945 -0.835,1.352 -1.824,-0.223 h -1.453 v 4.961 h 1.453 c 0,-0.558 0.129,-1.07 0.387,-1.535 0.258,-0.461 0.586,-0.855 0.988,-1.187 0.399,-0.336 0.856,-0.598 1.375,-0.789 0.524,-0.184 1.055,-0.274 1.598,-0.274 0.484,0 0.93,0.067 1.34,0.199 0.406,0.141 0.765,0.336 1.074,0.586 0.309,0.258 0.551,0.571 0.723,0.938 0.183,0.367 0.277,0.785 0.277,1.25 0,0.527 -0.117,0.976 -0.352,1.351 -0.222,0.375 -0.531,0.696 -0.925,0.961 -0.383,0.266 -0.817,0.492 -1.297,0.676 -0.485,0.191 -0.977,0.379 -1.477,0.563 -0.594,0.207 -1.183,0.425 -1.773,0.648 -0.594,0.234 -1.121,0.527 -1.59,0.875 -0.465,0.352 -0.844,0.777 -1.137,1.277 -0.293,0.508 -0.437,1.137 -0.437,1.887 0,0.668 0.14,1.258 0.425,1.773 0.282,0.528 0.653,0.969 1.114,1.329 0.457,0.355 0.988,0.628 1.597,0.812 0.61,0.192 1.235,0.285 1.875,0.285 3.387,-0.129 3.051,-1.586 3.762,-0.273 h 1.516 v -4.664 h -1.516 c 0,0.492 -0.101,0.949 -0.312,1.375 -0.2,0.433 -0.473,0.801 -0.825,1.101 -0.347,0.309 -0.75,0.551 -1.199,0.723 -0.449,0.184 -0.926,0.277 -1.426,0.277 -0.441,0 -0.863,-0.05 -1.261,-0.152 -0.399,-0.098 -0.75,-0.262 -1.051,-0.484 -0.301,-0.219 -0.543,-0.5 -0.723,-0.852 -0.176,-0.352 -0.265,-0.766 -0.265,-1.25 0,-0.426 0.105,-0.789 0.312,-1.086 0.219,-0.301 0.504,-0.57 0.863,-0.801 0.36,-0.226 0.77,-0.433 1.239,-0.625 0.476,-0.183 0.957,-0.371 1.449,-0.562 0.617,-0.219 1.23,-0.461 1.84,-0.727 0.605,-0.265 1.152,-0.586 1.636,-0.961 0.481,-0.375 0.879,-0.84 1.188,-1.386 0.309,-0.543 0.461,-1.207 0.461,-1.989" /></g>
diff --git a/case/pcb-fragment.svg b/case/pcb-fragment.svg
new file mode 100644 (file)
index 0000000..d8ac42b
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<g style="stroke-width:300;stroke:#000000" id="g6643"
+   transform="matrix(0.00959998,0,0,0.00959998,24.894758,-193.57612)">
+  <path d="m 90320,28273 5118,28740" id="path6377" inkscape:connector-curvature="0" />
+  <path d="M 6856,28273 H 90320" id="path6379" inkscape:connector-curvature="0" />
+  <path d="M 95438,57013 59218,63706" id="path6381" inkscape:connector-curvature="0" />
+  <path d="M 59218,63706 H 37958" id="path6383" inkscape:connector-curvature="0" />
+  <path d="M 37958,63706 1738,57013" id="path6385" inkscape:connector-curvature="0" />
+  <path d="M 1738,57013 6856,28273" id="path6387" inkscape:connector-curvature="0" />
+</g>