;| C2GON.LSP (c) 2003 Tee Square Graphics Converts selected CIRCLE objects to many-sided polygons (closed LWPOLYLINE objects consisting of multiple straight line segments). |; (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 16)) (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 (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\n" " Type C2GON to start." ) )