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)
)
代码如下。