change circle size...

change circle size...

bibleje
Advocate Advocate
4,722 Views
4 Replies
Message 1 of 5

change circle size...

bibleje
Advocate
Advocate

I would like to change the diameter of all the circles of a drawing (several hundred) from one diameter to another.  I haven't use LISP in a long long time so I am needing a jump starter here.  Would someone please get me started?  Thank you.

 

In Him

John E. Bible

AutoCad 2017

0 Likes
Accepted solutions (1)
4,723 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

Here you are.

 

(defun c:CircleDiameter ( / ss d ed )

  (if (and (setq d (getdist "\nNew diameter: "))
	   (setq d (/ d 2.))
	   (setq ss (ssget "_:L" '((0 . "CIRCLE"))))
	   )
    (repeat (setq i (sslength ss))
      (setq ed (entget (ssname ss (setq i (1- i)))))
      (entmod (subst (cons 40 d)
		     (assoc 40 ed)
		     ed))))
  (princ)
)
0 Likes
Message 3 of 5

ВeekeeCZ
Consultant
Consultant

Or one more for ACADs 2011+, a bit shorter.

 

(defun c:CircleDiameter ( / ss d)

  (if (and (setq d (getdist "\nNew diameter: "))
	   (setq d (/ d 2.))
	   (setq ss (ssget "_:L" '((0 . "CIRCLE"))))
	   )
    (repeat (setq i (sslength ss))
      (setpropertyvalue (ssname ss (setq i (1- i))) "Radius" d)))
  (princ)
)
0 Likes
Message 4 of 5

bibleje
Advocate
Advocate

Excellent!  Thank you sir.

0 Likes
Message 5 of 5

Kent1Cooper
Consultant
Consultant

You can also do that without a routine, using QSELECT to find either all  Circles, or all Circles of a specific radius or diameter, or all Circles of less than or more than a designated radius or diameter, and then collectively change their radii or diameters to the same desired value in the Properties palette.

Kent Cooper, AIA