This seems to work:
Code:
(defun c:ShowRadius (/ Cyl SS1 SS2 SS3 en ed n Rad)
(setq Cyl (entsel "Select 3dSolid: "))
(if (and Cyl
(setq Cyl (car Cyl))
(= "3DSOLID" (cdr (assoc 0 (entget Cyl))))
) ;_ end of and
(progn
(command "_copy" Cyl "" "0,0,0" "0,0,0") ;Copy 3dSolid
(setq Cyl (entlast)) ;Get copied version's name
(command "_explode" "_last" "") ;Explode copied version
(setq SS1 (ssget "P")) ;Get selection set of exploded entities
(setq SS2 (ssget "P" '((0 . "REGION"))))
;Get sel-set of only Regions from Exploded
;; Remove all Regions from SS1
(setq n 0)
(while (< n (sslength SS2))
(setq SS1 (ssdel (ssname SS2 n) SS1))
(setq n (1+ n))
) ;_ end of while
(command "_explode" SS2 "") ;Explode Regions
(setq SS2 nil) ;Clear Selection Set
(gc) ;Force garbage collection
(setq SS2 (ssget "P")) ;Get selection set of exploded entities
(setq n 0
Rad nil
) ;_ end of setq
;;Step through SS2 search for Circle
(while (and (not Rad) (< n (sslength SS2)))
(setq en (ssname SS2 n))
(setq ed (entget en))
(if (= "CIRCLE" (cdr (assoc 0 ed)))
(setq Rad (cdr (assoc 40 ed)))
) ;_ end of if
(setq n (1+ n))
) ;_ end of while
(command "_erase" SS1 SS2 "") ;Delete all temporary objects
(setq SS1 nil
SS2 nil
) ;Clear select sets
(gc) ;Force garbage collection
;;Show radius
(if Rad
(princ (strcat "\nThe 3dSolid's radius is " (rtos Rad)))
(princ "\nThe 3dSolid does not seem to have a Circle")
) ;_ end of if
) ;_ end of progn
(princ
"\Function canceled, either no / incorrect object selected."
) ;_ end of princ
) ;_ end of if
(princ)
) ;_ end of defun