@J.Sullivan wrote:
.... if I have 12 circles in various locations in model space and I want to replace them with let's say a square. ....
It depends on what you mean by that, in detail. If you want to replace each selected Circle with a square as an orthogonal Polyline closed rectangle with its edge length the same as the Circle's diameter, this seems to do that:
(defun C:C2S ; = Circle(s) {to} Square(s)
(/ ss n cir cdata ctr rad)
(if (not (setq ss (ssget "_I" '((0 . "CIRCLE"))))); use pre-selection if present
(setq ss (ssget '((0 . "CIRCLE")))); if not, ask User
); if
(if ss
(repeat (setq n (sslength ss)) ; then
(setq
cir (ssname ss (setq n (1- n)))
cdata (entget cir)
ctr (cdr (assoc 10 cdata))
rad (cdr (assoc 40 cdata))
); setq
(command "_.rectang"
"_non" (mapcar '- ctr (list rad rad))
"_non" (mapcar '+ ctr (list rad rad))
"_.matchprop" cir (entlast) "" ; for Layer, linetype, etc.
); command
(entdel cir)
); repeat
); if
(princ)
)
If you have a pre-selection including any Circle(s), it does those; if not, it asks you to select, and accepts only Circles in the selection.
But maybe you want to replace all Circles, regardless of size, with the same size square. Or with squares of the same areas as the Circles they replace. Or maybe the square is a Block. Or maybe you want to replace all selected Circles collectively with one square somehow [doesn't seem likely, but the wording would support that], in which case what would determine its size and location? Or maybe you don't want the squares orthogonally oriented. Or maybe you want the squares on the current Layer, regardless of the Circles' Layer(s). Or maybe....
Kent Cooper, AIA