lisp画相切圆代码
(defun c:xq1 (/ c1 r1 nu an1 an2 kk c2)(setvar "cmdecho" 0)
(setq c1 (getpoint "\n小圆圆心:"))
(setq r1 (getdist c1 "\n小圆半径:"))
(setq nu (getint "\n相切圆数量:"))
(setq an1 (/ pi nu))
(setq an2 (- (* pi 0.5) an1))
(setq kk (/ r1 (sin an1)))
(setq c2 (polar c1 an2 kk))
(command "circle" c1 r1)
(command "array" (entlast) "" "p" c2 nu 360 "Y")
(prin1))
(defun c:xq2 (/ nu c2 kk an1 an2 c1 r1)
(setvar "cmdecho" 0)
(setq nu (getint "\n相切圆数量:"))
(setq c2 (getpoint "\n大圆圆心:"))
(setq kk (getdist c2 "\n大圆半径:"))
(setq an1 (/ pi nu))
(setq an2 (+ (* pi 0.5) an1))
(setq c1 (polar c2 (- 0 an2) kk))
(setq r1 (* kk (sin an1)))
(command "circle" c1 r1)
(command "array" (entlast) "" "p" c2 nu 360 "y")
(prin1))
(prompt "作者:leimc")
(prompt "\n输入命令 xq1或xq2 开始绘图")
学习了一下~~~~~~~~~ 试了一下,有几个地方还是没有搞懂~~~~~~~在学习中呀
页:
[1]