AutoCAD LISP绘制多个等半径圆相切,代码如下:
(defun c:test()
(setq baspt (getpoint "请输入基准点:"))
(setq rad (getdist "\n请输入小圆半径:"))
(setq num (getint "\n请输入相切的小圆数量:"))
(setq ang1 (/ (* pi 2) (* num 2)))
(setq kk (/ rad (sin ang1)))
(setq ang2 (- (/ pi 2) ang1))
(setq cenpt (polar baspt ang2 kk))
(command "circle" baspt rad)
(command "array" (entlast) "" "p" cenpt num 360 "Y")
(prin1)
)
(prompt "\n <<TEST>>自动等圆相切绘制")
(prin1)
代码完。