运用grread函数跟踪鼠标坐标,绘制鼠标轨迹,代码如下。
(defun c:test ()
(setq p (getpoint))
(setq n 0)
(while
(progn
(setq input (grread t))
(cond ((= (car input) 5)
(setq p1 (cadr input))
(if (= n 0)
(command "LINE" p p1 "")
(command "LINE" "@" p1 "")
)
(setq n (1+ n))
T
)
((= (car input) 3)
(if (= n 0)
(command "LINE" p p1 "")
(command "LINE" "@" p1 "")
)
nil
)
)
)
)
)
代码完。
同时绘制双线并且实现绘制过程的实时预览,这个功能说来容易做起来难。