Colorize one LED for better understanding the bending of the legs
This commit is contained in:
parent
bde5bc33f7
commit
676474a277
2 changed files with 100 additions and 90 deletions
|
@ -5,6 +5,8 @@
|
|||
(defn print-scad [shape]
|
||||
(spit "threedvis.scad" (write-scad shape)))
|
||||
|
||||
(def first-led (atom 1))
|
||||
|
||||
(defn led [edge]
|
||||
(let [long-leg (cylinder 1.5 100)]
|
||||
(union
|
||||
|
@ -19,17 +21,23 @@
|
|||
(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))
|
||||
(translate [14 5 -117] (cylinder 1.5 100))
|
||||
(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 color-led [endpos]
|
||||
(let [pos (swap! first-led inc)]
|
||||
(if (= 6 pos)
|
||||
(color [1 0 0] (led endpos))
|
||||
(led endpos))))
|
||||
|
||||
(defn one-pos [endpos]
|
||||
(union
|
||||
(translate [0 0 0] (led endpos))
|
||||
(translate [0 0 100] (led endpos))
|
||||
(translate [0 0 200] (led endpos))))
|
||||
(translate [0 0 0] (color-led endpos))
|
||||
(translate [0 0 100] (color-led endpos))
|
||||
(translate [0 0 200] (color-led endpos))))
|
||||
|
||||
(defn one-column []
|
||||
(union
|
||||
|
|
|
@ -33,8 +33,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -80,8 +80,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -127,8 +127,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -178,8 +178,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -197,6 +197,7 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
translate ([0, 0, 100]) {
|
||||
color ([1, 0, 0, ]) {
|
||||
union () {
|
||||
color ([0.5, 0.5, 2, ]) {
|
||||
difference () {
|
||||
|
@ -225,8 +226,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -243,6 +244,7 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
translate ([0, 0, 200]) {
|
||||
union () {
|
||||
color ([0.5, 0.5, 2, ]) {
|
||||
|
@ -272,8 +274,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -323,8 +325,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -370,8 +372,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -417,8 +419,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -472,8 +474,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -519,8 +521,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -566,8 +568,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -617,8 +619,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -664,8 +666,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -711,8 +713,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -762,8 +764,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -809,8 +811,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -856,8 +858,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -911,8 +913,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -958,8 +960,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -1005,8 +1007,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -1056,8 +1058,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -1103,8 +1105,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -1150,8 +1152,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -1201,8 +1203,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -1248,8 +1250,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
@ -1295,8 +1297,8 @@ translate ([-100, -100, -100]) {
|
|||
}
|
||||
}
|
||||
}
|
||||
translate ([14, 5, -122]) {
|
||||
cylinder (h=110, r=1.5, center=true);
|
||||
translate ([14, 5, -117]) {
|
||||
cylinder (h=100, r=1.5, center=true);
|
||||
}
|
||||
rotate (a=29.999999999999996, v=[0, 1, 0]) {
|
||||
union () {
|
||||
|
|
Loading…
Reference in a new issue