AutoCAD LISP在直线中点绘制圆
2011-03-26 20:22 精诚所至 金石为开 阅读(682) 评论(0) 编辑 收藏 举报AutoCAD LISP在直线中点绘制圆,代码如下。
(defun c:mcir()
(setvar "cmdecho" 0)
(setq en (entsel "Select a LINE:"))
(setq en_data (entget (car en)))
(setq pts (assoc 10 en_data))
(setq pt1 (cdr pts))
(setq px1 (car pt1))
(setq py1 (cadr pt1))
(setq pte (assoc 11 en_data))
(setq pt2 (cdr pte))
(setq px2 (car pt2))
(setq py2 (cadr pt2))
(setq mx (/ (+ px1 px2) 2))
(setq my (/ (+ py1 py2) 2))
(setq mpt (list mx my))
(setq mr (getdist mpt "\nCircle Radius:"))
(command "circle" mpt mr)
(prin1)
)
(prompt "**************<<C:mcir>>**************")
(prin1)
代码完。