CAD AutoLisp 两点创建同心圆
选择两点,计算两点距离角度半径,输入圆的个数创建圆
lisp
(defun C:TT()
;输入
(setq p1 (getpoint "Get1"))
(setq p2 (getpoint "Get2"))
(setq cen (getint "Getc"))
;计算
(setq dist (distance p1 p2));长度
(setq ang (angle p1 p2));角度
(setq r (/ dist (- (* cen 2)2)));半径
(setq pt p1);备份p1点
;两个循环
(repeat cen
(repeat cen
(command "circle" "NON" p1 r)
(command "delay" 50 );延迟毫秒
(setq p1 (polar p1 ang (* r 2)))
)
(setq p1 (polar pt (+ (* (/ pi 180) 60) ang)(* r 2)));
(setq pt p1);备份p1点
(setq cen (1- cen))
)
)