AutoCAD LISP绘制圆内接五边形
2011-03-26 20:42 精诚所至 金石为开 阅读(515) 评论(0) 编辑 收藏 举报AutoCAD LISP绘制圆内接五边形,代码如下。
(defun c:test()
(setvar "cmdecho" 0)
(setq en (entsel "Select CIRCLE:"))
(setq en_data (entget (car en)))
(setq cenpt (cdr (assoc 10 en_data)))
(setq rr (cdr (assoc 40 en_data)))
(command "polygon" 5 cenpt "i" rr)
(prin1)
)
(prompt "********<<C:TEST>>**********")
(prin1)
代码完。
修改一下,绘制任意内接多边形,代码如下。
(defun c:test()
(setvar "cmdecho" 0)
(setq en (entsel "Select CIRCLE:"))
(setq bian (getint "输入边数:"))
(setq en_data (entget (car en)))
(setq cenpt (cdr (assoc 10 en_data)))
(setq rr (cdr (assoc 40 en_data)))
(command "polygon" bian cenpt "i" rr)
(prin1)
)
(prompt "********<<C:TEST>>**********")
(prin1)
代码完。