Its a little rough but it works:

Code:

(defun negval (pnt / )
(mapcar '- pnt))
(defun vec->pnt (strt norm mag /)
(mapcar '+ strt (mapcar '(lambda (x) (* mag x))norm ))
)
(vec->pnt '(0 0 0) '(1 0 0) 1)
(defun normal (p /)
(mapcar '(lambda (i) (/ i (sqrt (apply '+ (mapcar '* p p))))) p))
(defun face (A B C n / ab ac bc)
(if (> n 0)
(progn
(setq AB (normal (mapcar '+ A B)))
(setq AC (normal (mapcar '+ A C)))
(setq BC (normal (mapcar '+ B C)))
(setq n (1- n))
(face A AB AC n)
(face B AB BC n)
(face C AC BC n)
(face AB AC BC n)
)
(progn
(vlax-invoke-method *ms* 'add3dface
(vlax-3d-point (vec->pnt ctr A rad))
(vlax-3d-point (vec->pnt ctr B rad))
(vlax-3d-point (vec->pnt ctr C rad))
(vlax-3d-point (vec->pnt ctr A rad))
)
(vlax-invoke-method *ms* 'add3dface
(vlax-3d-point (vec->pnt ctr (negval A) rad))
(vlax-3d-point (vec->pnt ctr (negval B) rad))
(vlax-3d-point (vec->pnt ctr (negval C) rad))
(vlax-3d-point (vec->pnt ctr (negval A) rad))
)
)
)
)
(defun c:geo8 ()
(vl-load-com)
(setq *ms* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(if (> 0 (setq f (getint "\nEnter nth Order: ")))
(setq f (- f)))
(setq ctr (getpoint "\nSelect Center of Sphere: "))
(setq rad (getreal "\nEnter Radius: "))
(setq pntA '(0 0 1))
(setq pntB '(0 1 0))
(setq pntC '(1 0 0))
(face pntA pntB pntC f)
(command "array" (ssget "X" ) "" "p" ctr 4 "" "")
)
(defun c:geoico ()
(vl-load-com)
(setq *ms* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(if (> 0 (setq f (getint "\nEnter nth Order: ")))
(setq f (- f)))
(setq ctr (getpoint "\nSelect Center of Sphere: "))
(setq rad (getreal "\nEnter Radius: "))
(setq x (sqrt (/ (+ 5.0 (sqrt 5.0)) 10.0))) ;these formulas calculate the
(setq y (sqrt (/ (- 3.0 (sqrt 5.0)) 10.0))) ;vertices of two icosahedral
(setq z (sqrt 0.2)) ;faces, the first having
(setq u (sqrt (/ (- 5.0 (sqrt 5.0)) 10.0))) ;vertices (0 0 1), (x y z),
(setq v (- (* x x))) ;(u v z), and the second with
(setq p0 (list 0.0 0.0 1.0)) ;vertices (x y z), (u v z),
(setq p1 (list x y z)) ;(x -y -z).
(setq p2 (list u v z))
(setq p3 (list x (- y) (- z)))
(face p0 p1 p2 f)
(face p1 p2 p3 f)
(command "array" (ssget "X" ) "" "p" ctr 5 "" "")
)

This was created with help of a lisp that I found.

Each order increases the process time by a factor of four.

Order 0 = Basic Form

I haven't tried going higher than 5 on the Order.

Have fun!

## Bookmarks