注意,以下代码可能会出现不可描述的问题,请注意一定要在新开的cad中进行测试。
该例子正常运行后会在绘图区绘制红色对角线一根。
代码采用的是高飞鸟的定时器方案,详见帖子
http://bbs.mjtd.com/forum.php?mo ... peid%26typeid%3D108
http://bbs.mjtd.com/forum.php?mo ... mp;extra=#pid604291
- (defun C:killTimer()
- (HFB_KillLispTimer)
- (princ)
- )
- (defun zj-get-scr-coods (/ half_h half_w pt_cen lst ptx pty)
- (setq pt_cen (trans (GETVAR "VIEWCTR") 1 2)
- ptx (car pt_cen)
- pty (cadr pt_cen)
- half_h (* 0.5 (GETVAR "VIEWSIZE"))
- half_w (* half_h (/ (car (GETVAR "SCREENSIZE")) (cadr (GETVAR "SCREENSIZE"))))
- )
- (LIST (LIST (- ptx half_w) (- pty half_h)) (LIST (+ ptx half_w) (+ pty half_h)))
-
- )
- (defun c:tt()
-
- (defun TimerCallback5 (hWnd nMsg nTimerid dwTime)
- (setq pts(zj-get-scr-coods))
- (redraw)
- (grdraw (car pts)(cadr pts) 1)
- )
- (HFB_KillLispTimer)
- (setq t5 (HFB_SetLispTimer "TimerCallback5" 50 ))
- (vl-bb-set 't5 t5)
- )
-
|