;setup layers................................. (command "layer") (setq i 1) (while (< i 7) (command "m" i "c" i i) (setq i (1+ i)) ) (command "s" "0" "");..........................end setup layers (defun c:br ();THE COMMAND (setq cp (list 0.00 0.00 0.0) ep (list 24.0 0.00 0.0) np (list 0.00 24.0 0.0) wp (list -24.0 0.00 0.0) sp (list 0.00 -24.0 0.0) fp (list 0.0 0.0 24.0) bp (list 0.0 0.0 -24.0) was2 1.5 was3 (* was2 1.5) n 5 *bail* 0.5 ) ;;; Command: box ;;; ;;;Specify corner of box or [CEnter] <0,0,0>: ce ;;; ;;;Specify center of box <0,0,0>: ;;; ;;;Specify corner or [Cube/Length]: c ;;; ;;;Specify length: 1 (command "box" "CE" cp "c" 36) (command "box" "CE" ep "c" 12) (command "box" "CE" np "c" 12) (command "box" "CE" wp "c" 12) (command "box" "CE" sp "c" 12) (command "box" "CE" fp "c" 12) (command "box" "CE" bp "c" 12) (doeast n ep 8) (donorth n np 8) (dowest n wp 8) (dosouth n sp 8) (dofront n fp 8) (doback n bp 8) ) (defun dofront (k p d) (cond ((stop) t) (t (command "box" "CE" (mapcar '+ p (list 0 (- d) 0.0)) "c" (/ d was2))(turncyan) (command "box" "CE" (mapcar '+ p (list d 0 0.0)) "c" (/ d was2))(turncyan) (command "box" "CE" (mapcar '+ p (list 0 d 0.0)) "c" (/ d was2))(turncyan) (command "box" "CE" (mapcar '+ p (list 0 0 d)) "c" (/ d was2))(turncyan) (command "box" "CE" (mapcar '+ p (list (- d) 0 0.0)) "c" (/ d was2))(turncyan) (dosouth (- k 1) (mapcar '+ p (list 0 (- d) 0.0)) (/ d was3)) (doeast (- k 1) (mapcar '+ p (list d 0 0.0)) (/ d was3)) (donorth (- k 1) (mapcar '+ p (list 0 d 0.0)) (/ d was3)) (dowest (- k 1) (mapcar '+ p (list (- d) 0 0.0))(/ d was3)) (dofront (- k 1) (mapcar '+ p (list 0 0 d))(/ d was3)) ) ) ) (defun doback (k p d) (cond ((stop) t) (t (command "box" "CE" (mapcar '+ p (list 0 (- d) 0.0)) "c" (/ d was2))(turnmagenta) (command "box" "CE" (mapcar '+ p (list d 0 0.0)) "c" (/ d was2))(turnmagenta) (command "box" "CE" (mapcar '+ p (list 0 d 0.0)) "c" (/ d was2))(turnmagenta) (command "box" "CE" (mapcar '+ p (list 0 0 (- d))) "c" (/ d was2))(turnmagenta) (command "box" "CE" (mapcar '+ p (list (- d) 0 0.0)) "c" (/ d was2))(turnmagenta) (dosouth (- k 1) (mapcar '+ p (list 0 (- d) 0.0)) (/ d was3)) (doeast (- k 1) (mapcar '+ p (list d 0 0.0)) (/ d was3)) (donorth (- k 1) (mapcar '+ p (list 0 d 0.0)) (/ d was3)) (dowest (- k 1) (mapcar '+ p (list (- d) 0 0.0))(/ d was3)) (doback (- k 1) (mapcar '+ p (list 0 0 (- d)))(/ d was3)) ) ) ) (defun doeast (k p d) (cond ((stop) t) (t (command "box" "CE" (mapcar '+ p (list 0 (- d) 0.0)) "c" (/ d was2))(turngreen) (command "box" "CE" (mapcar '+ p (list d 0 0.0)) "c" (/ d was2))(turngreen) (command "box" "CE" (mapcar '+ p (list 0 d 0.0)) "c" (/ d was2))(turngreen) (command "box" "CE" (mapcar '+ p (list 0 0 d)) "c" (/ d was2))(turngreen);frontbox (command "box" "CE" (mapcar '+ p (list 0 0 (- d))) "c" (/ d was2))(turngreen);backbox (dosouth (- k 1) (mapcar '+ p (list 0 (- d) 0.0)) (/ d was3)) (doeast (- k 1) (mapcar '+ p (list d 0 0.0)) (/ d was3)) (donorth (- k 1) (mapcar '+ p (list 0 d 0.0)) (/ d was3)) (dofront (- k 1) (mapcar '+ p (list 0 0 d))(/ d was3)) (doback (- k 1) (mapcar '+ p (list 0 0 (- d)))(/ d was3)) ) ) ) (defun donorth (k p d) (cond ((stop) t) (t (command "box" "CE" (mapcar '+ p (list d 0 0.0)) "c" (/ d was2))(turnyellow) (command "box" "CE" (mapcar '+ p (list 0 d 0.0)) "c" (/ d was2))(turnyellow) (command "box" "CE" (mapcar '+ p (list (- d) 0 0.0)) "c" (/ d was2))(turnyellow) (command "box" "CE" (mapcar '+ p (list 0 0 d)) "c" (/ d was2))(turnyellow);frontbox (command "box" "CE" (mapcar '+ p (list 0 0 (- d))) "c" (/ d was2))(turnyellow);backbox (doeast (- k 1) (mapcar '+ p (list d 0 0.0)) (/ d was3)) (donorth (- k 1) (mapcar '+ p (list 0 d 0.0)) (/ d was3)) (dowest (- k 1) (mapcar '+ p (list (- d) 0 0.0))(/ d was3)) (dofront (- k 1) (mapcar '+ p (list 0 0 d))(/ d was3)) (doback (- k 1) (mapcar '+ p (list 0 0 (- d)))(/ d was3)) ))) (defun dowest (k p d) (cond ((stop) t) (t (command "box" "CE" (mapcar '+ p (list 0 d 0.0)) "c" (/ d was2))(turnred) (command "box" "CE" (mapcar '+ p (list (- d) 0 0.0)) "c" (/ d was2))(turnred) (command "box" "CE" (mapcar '+ p (list 0 (- d) 0.0)) "c" (/ d was2))(turnred) (command "box" "CE" (mapcar '+ p (list 0 0 d)) "c" (/ d was2))(turnred);frontbox (command "box" "CE" (mapcar '+ p (list 0 0 (- d))) "c" (/ d was2))(turnred);backbox (donorth (- k 1) (mapcar '+ p (list 0 d 0.0) )(/ d was3)) (dowest (- k 1) (mapcar '+ p (list (- d) 0 0.0))(/ d was3)) (dosouth (- k 1) (mapcar '+ p (list 0 (- d) 0.0)) (/ d was3)) (dofront (- k 1) (mapcar '+ p (list 0 0 d))(/ d was3)) (doback (- k 1) (mapcar '+ p (list 0 0 (- d)))(/ d was3)) ))) (defun dosouth (k p d) (cond ((stop) t) (t (command "box" "CE" (mapcar '+ p (list (- d) 0 0.0)) "c" (/ d was2))(turnblue) (command "box" "CE" (mapcar '+ p (list 0 (- d) 0.0 )) "c" (/ d was2))(turnblue) (command "box" "CE" (mapcar '+ p (list d 0 0.0 )) "c" (/ d was2))(turnblue) (command "box" "CE" (mapcar '+ p (list 0 0 d)) "c" (/ d was2))(turnblue);frontbox (command "box" "CE" (mapcar '+ p (list 0 0 (- d))) "c" (/ d was2))(turnblue);backbox (dowest (- k 1) (mapcar '+ p (list (- d) 0 0.0))(/ d was3)) (dosouth (- k 1) (mapcar '+ p (list 0 (- d) 0.0)) (/ d was3)) (doeast (- k 1) (mapcar '+ p (list d 0 0.0)) (/ d was3)) (dofront (- k 1) (mapcar '+ p (list 0 0 d))(/ d was3)) (doback (- k 1) (mapcar '+ p (list 0 0 (- d)))(/ d was3)) ))) (defun stop ();termination predicate (cond ((< k 1) t) ((> (randreal) *bail*) t) (t nil) ) ) (defun turnred () (command "chprop" (entlast) "" "la" 1 "") ) (defun turnyellow () (command "chprop" (entlast) "" "la" 2 "") ) (defun turngreen () (command "chprop" (entlast) "" "la" 3 "") ) (defun turnblue () (command "chprop" (entlast) "" "la" 5 "") ) (defun turncyan () (command "chprop" (entlast) "" "la" 4 "") ) (defun turnmagenta () (command "chprop" (entlast) "" "la" 6 "") ) ;................................................................ ;{randbell=============================================== ;init. seed (defun get_10th_seconds () (setq s (getvar "date")) (fix (* 864000.0 (- s (fix s)))) ) (setq *seedrand* (get_10th_seconds)) (defun randint (); integer between 0 and 2^16= 65,536 noninclusive ;WARING: DO YOUR MATH AGAIN: MAYBE SHOULD BE 32,768 (setq *seedrand* (+ (* (fix *seedrand*) 214013) 2531011)) (boole 1 (/ *seedrand* 65536) 32767) ) (defun c:randrtst () (setq tt 0) (command "pline") (while (< tt 2) (command (list tt (* 1.0 (randrec))));randbell works here too 5/19/06 (setq tt (+ tt 0.003)) ) (command "") ) (defun randab (a b)(+ a (* (- b a)(randreal))));rand real on [a,b] (defun randreal (); float between 0.0 and 1.0 noninclusive (/ (randint) 32768.0) ) (defun randbell (/ x y);looking for bell distribution (setq x (- (* (randreal) 2.0) 1.0) y (1- (exp (- (* x x)))) y (* y (rand1-1)) ) ) ;support for above (defun rand1-1 (/ y);trying to y mem. of [-1,1] (setq y (fix (* 2 (randreal))) y (1- (* 2 y)) ) ) (defun randrec (/ x);using 1/x (setq x (+ 0.2 (* 0.80 (randreal))) x (- (/ 1.0 x) 2.0) x (* x (rand1-1)) ; x (- 8.0 (/ x 8.0)) ) ) (princ "\nrandreal loaded (also has testing baggage on heap, dude)")(princ) ;}