Finish the 3D model for the led cube

This commit is contained in:
Aaron Mueller 2014-08-04 10:19:47 +02:00
parent a436628ce8
commit 92c57bd303
2 changed files with 1356 additions and 25 deletions

View file

@ -5,32 +5,42 @@
(defn print-scad [shape]
(spit "threedvis.scad" (write-scad shape)))
(defn led []
(union
(color [0.5 0.5 2]
(difference
(union
(cylinder 10 20)
(translate [0 0 10] (sphere 10))
(translate [0 0 -8] (cylinder 13 4)))
(translate [0 13 -7] (cube 30 5 10))))
(color [0.3 0.3 0.3]
(union
(translate [0 5 -30] (cylinder 1.5 50))
(translate [7 5 -60] (rotate (/ pi 4) [0 -1 0] (cylinder 1.5 20))))
(translate [14 5 -122] (cylinder 1.5 110))
(union
(translate [0 -5 -10] (cylinder 1.5 15))
(translate [0 -44 -17] (rotate (/ pi 2) [1 0 0] (cylinder 1.5 80)))))))
(defn led [edge]
(let [long-leg (cylinder 1.5 100)]
(union
(color [0.5 0.5 2]
(difference
(union
(cylinder 10 20)
(translate [0 0 10] (sphere 10))
(translate [0 0 -8] (cylinder 13 4)))
(translate [0 13 -7] (cube 30 5 10))))
(color [0.3 0.3 0.3]
(union
(translate [0 5 -30] (cylinder 1.5 50))
(translate [7 5 -60] (rotate (/ pi 4) [0 -1 0] (cylinder 1.5 20))))
(translate [14 5 -122] (cylinder 1.5 110))
(rotate (/ pi 6) [0 1 0] (union
(translate [4 -5 -10] (cylinder 1.5 15))
(if (not edge) (translate [4 -54 -17] (rotate (/ pi 2) [1 0 0] long-leg)))))
(if edge (translate [44 -4 -17] (rotate (/ pi 2) [0 1 0] long-leg)))))))
(defn one-pos []
(defn one-pos [endpos]
(union
(translate [0 0 0] (led))
(translate [0 0 100] (led))
(translate [0 0 200] (led))))
(translate [0 0 0] (led endpos))
(translate [0 0 100] (led endpos))
(translate [0 0 200] (led endpos))))
(defn one-column []
(union
(translate [0 0 0] (one-pos true))
(translate [0 100 0] (one-pos false))
(translate [0 200 0] (one-pos false))))
(print-scad
(union
(translate [0 0 0] (one-pos))
(translate [0 100 0] (one-pos))
(translate [0 200 0] (one-pos))))
(translate [-100 -100 -100]
(union
(translate [0 0 0] (one-column))
(translate [100 0 0] (one-column))
(translate [200 0 0] (one-column))
)))

1321
doc/threedvis/threedvis.scad Normal file

File diff suppressed because it is too large Load diff