【K:DynDrawCircle】Grread动态绘制圆并返回图元名称
;动态绘制圆@Kucha(defun K:DynDrawCircle (StaPt Col / K:GrvecsCircle Code TgtKey EntNam)
;grdraw绘制近似圆@LEEMAC
(defun K:GrvecsCircle (Cen Rad Col / ang inc)
(setq inc (/ (+ pi pi) 24.0)
ang 0.0
)
(repeat 24 (grdraw (polar Cen ang Rad) (polar Cen (setq ang (+ ang inc)) Rad) Col))
)
(while
(progn
(princ "\n→请指定半径<空格退出>: ")
(while (and (setq Code (grread T (+ 1 4 8))) (eq (car Code) 5))
(redraw)(K:GrvecsCircle StaPt (distance StaPt (cadr Code)) Col)
);显示预览
(setq TgtKey (cadr Code))
(cond
((eq (car Code) 3);点选
(redraw)
(setq EntNam (entmakeX (list '(0 . "CIRCLE") (cons 10 (trans StaPt 1 0)) (cons 40 (distance StaPt (cadr Code))))))
Nil ;退出循环
)
(T Nil)
)
)
)
EntNam
)
用法:
(K:DynDrawCircle (getpoint) 1)
感谢大佬分享~ 好帖子,学习了。顶一个
页:
[1]