;; 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 width 260)
(define height 232)
-
(define cols 6) ; per hand
(define rows 4)
(define angle (degrees->radians 10))
(define alps-switch-height 13.087)
(define cherry-switch-width 13.62)
(define cherry-switch-height 13.72)
-(define cherry? true)
+(define cherry? false)
(define switch-height (if cherry? cherry-switch-height alps-switch-height))
(define switch-width (if cherry? cherry-switch-width alps-switch-width))
(define mid-left (- mid-x mid-offset))
(define mid-right (+ mid-x mid-offset))
-(define upper-height 75)
+(define upper-height 80)
(define left-upper-top (+ left-top (* upper-height (sin angle))))
(define right-upper-top (- right-top (* upper-height (sin angle))))
(define upper-top (- top (* upper-height (cos angle))))
[y (- sy (* (sin (degrees->radians theta)) corner-radius))]
[coords (cons (format "~s,~s" x y) coords)])
(if (to-next-screw? theta current-screw)
- (begin (printf "~a~n" current)
- (outline-points coords theta (add1 current-screw)))
+ (outline-points coords theta (add1 current-screw))
(outline-points coords (sub1 theta) current-screw)))
coords))
-(define port-depth 8)
+(define (outline)
+ `(polygon ((points ,(string-join (outline-points '() 90 0))))))
+
+;;; board
-(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 board-doc (call-with-input-file "pine64-fragment.svg" read-xml))
-(define (outline with-port?)
- `(polygon ((points ,(string-join (let ((noport (outline-points '() 90 0)))
- (if with-port?
- (append noport port-curve)
- noport)))))))
+;; screen viewable: 116x68
+
+(define screen-slots
+ (let ((x 170)
+ (y "-65"))
+ (list `(rect ((x ,(format "~s" x))
+ (y ,y)
+ (height "20")
+ (width "2.55")))
+ `(rect ((x ,(format "~s" (+ x 35.6)))
+ (y ,y)
+ (height "20")
+ (width "2.55"))))))
;;; switches
(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
(stroke "red"))
,(xml->xexpr (document-element logo-doc))))
'())
- ,@(if (eq? plate 'spacer)
- (list (xml->xexpr (document-element pcb-doc)))
- (list))
+ (g ((transform ,(format "translate(100.14, -765) scale(~s, ~s)"
+ scale scale)))
+ ,(xml->xexpr (document-element board-doc)))
(g ((transform ,(format "scale(~s, ~s) translate(0, ~s)"
- scale scale upper-height))
+ scale scale (- upper-height 1.4)))
(stroke-width "1")
(stroke "black")
(fill-opacity "0"))
,screws
- ,(outline (not (eq? plate 'switch)))
+ ,@screen-slots
+ ,(outline)
,@(if (eq? plate 'switch)
(list switches switches-right)
(list)))))
;; qiv --watch deck-switch.svg
(write-out-layer 'switch)
-;; (write-out-layer 'bottom)
-;; (write-out-layer 'spacer)
+(write-out-layer 'bottom)
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <g id="g50">
+ <circle
+ transform="scale(-1)"
+ r="1.4013965"
+ cy="-292.54999"
+ cx="-123.93"
+ id="path847"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.09720702;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <circle
+ transform="scale(-1)"
+ r="1.4013966"
+ cy="-222.54997"
+ cx="-123.93"
+ id="path847-4"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.09720702;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <circle
+ transform="scale(-1)"
+ r="1.4013966"
+ cy="-292.54999"
+ cx="-5.530683"
+ id="path847-1"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.09720702;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <!-- this hole already exists, but we can use it for alignment -->
+ <!-- <circle -->
+ <!-- transform="scale(-1)" -->
+ <!-- r="1.4013966" -->
+ <!-- cy="-222.54997" -->
+ <!-- cx="-5.530683" -->
+ <!-- id="path847-5" -->
+ <!-- style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.09720702;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> -->
+ <rect
+ transform="scale(-1)"
+ y="-288.11554"
+ x="-15.224185"
+ height="17.211929"
+ width="28.366371"
+ id="rect876"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.24762903;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-295.0882"
+ x="-86.282448"
+ height="5.3371143"
+ width="51.207447"
+ id="rect878"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.14999999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-224.03889"
+ x="-94.911888"
+ height="5.3108878"
+ width="59.823772"
+ id="rect880"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.1762262;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-266.625"
+ x="-131.74718"
+ height="18.607777"
+ width="22.358181"
+ id="rect882"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.14999999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-286.625"
+ x="-144.74718"
+ height="16.607777"
+ width="28.358181"
+ id="rect882"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.14999999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-233.26974"
+ x="-46.397751"
+ height="5.8755026"
+ width="6.3085027"
+ id="rect884"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.17849734;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-243.925"
+ x="-4.819654"
+ height="8.9432726"
+ width="3.0291729"
+ id="rect886"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.14999999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-295.93082"
+ x="-28.770374"
+ height="5.86167"
+ width="18.475203"
+ id="rect888"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.13832989;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-269.04993"
+ x="-27.826923"
+ height="5.0344701"
+ width="17.84285"
+ id="rect890"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.16415074;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-245.03999"
+ x="-24.834372"
+ height="5.0486212"
+ width="14.857372"
+ id="rect890-4"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.14999999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ viewBox="0 0 210 297"
+ version="1.1"
+ id="svg8"
+ sodipodi:docname="pine64.svg"
+ inkscape:version="0.92.1 r15371">
+ <defs
+ id="defs2" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.5180232"
+ inkscape:cx="310.28237"
+ inkscape:cy="111.81058"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1440"
+ inkscape:window-height="872"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g50">
+ <rect
+ transform="scale(-1)"
+ y="-296.8793"
+ x="-126.95955"
+ height="78.758621"
+ width="125.75861"
+ id="rect10"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.2413817;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <circle
+ transform="scale(-1)"
+ r="1.4013965"
+ cy="-292.54999"
+ cx="-123.93"
+ id="path847"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.09720702;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <circle
+ transform="scale(-1)"
+ inkscape:transform-center-y="-28.849266"
+ inkscape:transform-center-x="-0.72123166"
+ r="1.4013966"
+ cy="-222.54997"
+ cx="-123.93"
+ id="path847-4"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.09720702;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <circle
+ transform="scale(-1)"
+ r="1.4013966"
+ cy="-292.54999"
+ cx="-5.530683"
+ id="path847-1"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.09720702;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <circle
+ transform="scale(-1)"
+ r="1.4013966"
+ cy="-222.54997"
+ cx="-5.530683"
+ id="path847-5"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.09720702;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-288.11554"
+ x="-15.224185"
+ height="17.211929"
+ width="28.366371"
+ id="rect876"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.24762903;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-295.0882"
+ x="-86.282448"
+ height="5.3371143"
+ width="51.207447"
+ id="rect878"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.14999999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-224.03889"
+ x="-94.911888"
+ height="5.3108878"
+ width="59.823772"
+ id="rect880"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.1762262;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-266.625"
+ x="-131.74718"
+ height="18.607777"
+ width="22.358181"
+ id="rect882"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.14999999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-233.26974"
+ x="-46.397751"
+ height="5.8755026"
+ width="6.3085027"
+ id="rect884"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.17849734;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-243.925"
+ x="-4.819654"
+ height="8.9432726"
+ width="3.0291729"
+ id="rect886"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.14999999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-295.93082"
+ x="-28.770374"
+ height="5.86167"
+ width="18.475203"
+ id="rect888"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.13832989;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-269.04993"
+ x="-27.826923"
+ height="5.0344701"
+ width="17.84285"
+ id="rect890"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.16415074;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1)"
+ y="-245.03999"
+ x="-24.834372"
+ height="5.0486212"
+ width="14.857372"
+ id="rect890-4"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.14999999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+ </g>
+</svg>