这里有一例,楼主可以自己调试
(defun c:tc()
(setvar "cmdecho" 0)
(setq en1 (car (entsel "\n选择圆1:")))
(setq en2 (car (entsel "\n选择圆2:")))
(setq en1data (entget en1))
(setq en2data (entget en2))
(setq cen1 (cdr (assoc 10 en1data))) ;取得第一个圆en1圆心点
(setq cen2 (cdr (assoc 10 en2data))) ;取得第二个圆en2圆心点
(setq r1 (cdr (assoc 40 en1data))) ;取得第一个圆en1半径
(setq r2 (cdr (assoc 40 en2data))) ;取得第二个圆en2半径
(setq ang (angle cen1 cen2)) ;计算en1至en2中心点角度值
(setq p1 (polar cen1 (+ ang (/ pi 2)) r1))
(setq p2 (polar cen1 (- ang (/ pi 2)) r1))
(setq p3 (polar cen2 (+ ang (/ pi 2)) r2))
(setq p4 (polar cen2 (- ang (/ pi 2)) r2))
;---------------------------?绘制切线
(command "line" "tan" p1 "tan" p4 "")
(setq en3 (entlast))
(command "line" "tan" p2 "tan" p3 "")
(setq en4 (entlast))
(setq nn (getint "\n重复次数:"))
(if (null nn) (setq nn 8))
(command "trim" en3 en4 "" (list en2 (polar cen2 ang (* -1 r2))) "") ;修剪第二个圆
(command "array" en3 en4 (polar cen2 ang r2) "" "p" cen1 nn "" "") ;将完成图形作环形数组
(prin1)
)