AutoLISP等分圆内相切弧
2011-03-28 19:07 精诚所至 金石为开 阅读(357) 评论(0) 编辑 收藏 举报AutoLISP等分圆内相切弧,代码如下。
(defun c:test()
(setvar "cmdecho" 0)
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(setq cen (getpoint "\n中心点:"))
(setq srr (getvar "circlerad"))
(setq str_rr (strcat "\n圆半径<" (rtos srr 2) ">:"))
(setq rr (getdist cen str_rr))
(if (null rr) (setq rr srr))
(command "circle" cen rr)
(setq nn (getint "\n输入等分数<6>:"))
(if (null nn) (setq nn 6))
(setq dd (/ rr (/ nn 2)))
(setq pt1 (polar cen pi rr))
(setq pt2 (polar cen 0 rr))
(setq pta pt1)
(repeat nn
(setq pta (polar pta 0 dd))
(command "pline" pt1 "a" "a" -180 pta pt2 "")
)
(setvar "osmode" os)
(prin1)
)
代码完。