AutoLISP修改圆直径
2011-03-29 15:51 精诚所至 金石为开 阅读(682) 评论(0) 编辑 收藏 举报AutoLISP修改圆直径,代码如下。
(defun c:test()
(princ "\n选取要修改的圆:")
(setq ss (ssget))
(setq old_rr (getvar "circlerad"))
(setq str_rr (strcat "\n新直径<" (rtos (* old_rr 2) 2) ">:"))
(setq rr (getdist str_rr))
(if (null rr)
(setq rr old_rr)
(setq rr (/ rr 2))
)
(setq n 0)
(repeat (sslength ss)
(setq ssn (ssname ss n))
(setq ssdata (entget ssn))
(if (= (cdr (assoc 0 ssdata)) "CIRCLE")
(progn
(setq new_rr (cons 40 rr))
(setq old_rr (assoc 40 ssdata))
(setq ssdata (subst new_rr old_rr ssdata))
(entmod ssdata)
)
)
(setq n (1+ n))
)
(prin1)
)
代码如下。
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)