hello
You can use this routine to convert circles to polygons ...
Bye, Pat
;;
;; C2GON.LSP (c) 2003 Tee Square Graphics
;; Converts selected CIRCLE objects to many-sided polygons
;; (closed LWPOLYLINE objects consisting of multiple straight line segments)
;;
;; Les polygones reguliers sont crees sur le MEME calque que les cercles
;;
(defun C:C2GON (/ ss n temp cir ent cen rad ltp clr ang verts)
(while (not (setq ss (ssget '((0 . "CIRCLE"))))))
(if (not sides)(setq sides 32))
(setq n (1- (sslength ss))
sides (if (setq temp (getint (strcat "\nNumber of sides <" (itoa sides) ">: ")))
temp sides
);;if
);;setq
(while (>= n 0)
(setq cir (ssname ss n)
n (1- n)
ent (entget cir)
cen (cdr (assoc 10 ent))
rad (cdr (assoc 40 ent))
ltp (assoc 6 ent)
clr (assoc 62 ent)
ang 0
verts nil
);;setq
(repeat sides
(setq verts (append verts (list (cons 10 (polar cen ang rad))))
ang (+ ang (* (/ pi sides) 2))
);;setq
);;repeat
(entmake
(append
(list
'(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
(assoc 8 ent)
(cons 90 sides)
'(70 . 129)
(if ltp ltp '(6 . "BYLAYER"))
(if clr clr '(62 . 256))
);;list
verts
);;append
);;entmake
;;;;;;;;;;;;; Suppression EVENTUELLE des cercles
;; (entdel cir)
;;;;;;;;;;;;;
(princ)
);;while
(alert
(strcat
(itoa (sslength ss))
" CIRCLE object(s) converted to "
(itoa sides)
"-sided polygon(s)."
);;strcat
);;alert
(princ)
)
;; (alert
;; (strcat
;; "C2GON.LSP - (c) 2003 Tee Square Graphics\n"
;; " Type C2GON to start."
;; )
;; )
(princ "\nTapez C2GON pour lancer ...\n")
Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks
Patrice BRAUD
