|
AVLISP |
 |
|
Join Date: |
|
09-28-2007 | |
Hello, this routine is very similar to a screen saver.
It is a small vector array in a square form that will be updated every time the cursor is moved. The small vectors will change direction and color.
(defun c:field (/ arlist clayer p1 square nx ny hcount vcount wp maxd cc lenlis cont x wdis wcol wpp wang pt1 pt2)
(setq arlist nil)
(command "cmdecho" "0")
(command "_undo" "_g")
(command "osmode" "0")
(command "orthomode" "0")
(command clayer "0")
(setq p1 (getpoint "\n Select lower left corner:"))
(setq square 15)
(setq nx square)
(setq ny square)
(setq hcount 0)
(setq vcount 0)
(setq wp p1)
(while (< vcount square)
(while (< hcount square)
(setq arlist (cons wp arlist))
(setq wp (polar wp 0 1))
(setq hcount (+ hcount 1))
)
(setq wp (polar p1 (/ pi 2) (+ vcount 1)))
(setq vcount (+ vcount 1))
(setq hcount 0)
)
(setq maxd (* square 1.0))
(setq cc 0)
(setq lenlis (length arlist))
(setq cont 1)
(while (= cont 1)
(setq x (grread T 2 0))
(if (= (car x) 5)
(progn
(setq tarp (cadr x))
(setq cc 0)
(command "regen")
(repeat lenlis
(setq wdis (distance tarp (nth cc arlist)))
(setq wdis (* wdis 100.0))
(setq wcol (/ wdis maxd))
(setq wpp (nth cc arlist))
(setq wang (angle wpp tarp))
(setq pt1 (polar wpp (- wang (/ pi 2)) 1));(* wdis 0.001)))
(setq pt2 (polar wpp (+ wang (/ pi 2)) 1));(* wdis 0.001)))
(grdraw pt1 pt2 (fix wcol))
(setq cc (+ cc 1))
)
)
(setq cont 0)
)
)
(command "_undo" "_e")
)
|