Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
geodisic dome routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
of lisp routine perhaps...
thanks in advance
dzale@ffa-inc.com
Re: geodisic dome routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Fuller's dome geometry, a dodecahedron, or what?
Dave Pitzer
==========
"David Zale"
news
> does anyone have a clue about how to draw a geodesic dome shape? some sort
> of lisp routine perhaps...
> thanks in advance
> dzale@ffa-inc.com
>
Re: geodisic dome routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This has been gathering dust on my "L:" drive forever. Have fun.
-peter
;GEO.LSP
;Steven A. Schafer - 73417,2131
;Quantum Mechanics Corp.
;4 Jan 88
;NEG3 - Given a 3D point (x y z), NEG3 returns the point (-x -y -z).
(defun neg3 (p)
(mapcar '- p)
)
;NORM - Given a 3D point (x y z), NORM returns the point (x' y' z')
located a
;unit distance from (0 0 0) along the same vector direction as (x y z).
(defun norm (p)
(mapcar '(lambda (c) (/ c (sqrt (apply '+ (mapcar '* p p))))) p)
)
;FACE - This function takes as arguments three 3D points a, b, and c,
and an
;order number n. If n is zero, FACE draws the triangular 3D face with
vertices
;at a, b, c, and also the 3D face defined by (neg3 a), (neg3 b), (neg3
c).
;If n is greater than zero, FACE calculates the midpoints of the three
vectors
;ab, ac, and bc, uses NORM to convert them to unit vectors, and then
calls
;itself four times, once for each of the four smaller triangular faces
defined
;by: (1) a, ab, ac; (2) b, ab, bc; (3) c, ac, bc; (4) ab, ac, bc; using
an
;order number of n-1.
(defun face (a b c n / ab ac bc)
(if (> n 0)
(progn
(setq ab (norm (mapcar '+ a b)))
(setq ac (norm (mapcar '+ a c)))
(setq bc (norm (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
(command "3dface" a b c "" "")
(command "3dface" (neg3 a) (neg3 b) (neg3 c) "" "")
)
)
)
;GEO - GEO first calculates the vertices for two faces of an icosahedron
of
;unit radius (that is, an icosahedron centered at (0 0 0) having all of
its
;vertices located at unit distance from the center). The remaining 18
faces
;can be generated from the first two by means of simple reflections and
rota-
;tions about the origin. GEO then calls FACE recursively to generate
the
;faces of the geodesic sphere. Finally, the ARRAY command is used to
complete
;the sphere.
(defun geo (n / x y z u v p0 p1 p2 p3 cmd)
(setq cmd (getvar "cmdecho")) ;save 'cmdecho' setting
and
(setvar "cmdecho" 0) ;then turn 'cmdecho' off
(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 n)
(face p1 p2 p3 n)
(command "array" "w" "-1,-1" "1,1" "" "p" "0,0" 5 "" "")
(setvar "cmdecho" cmd) ;restore 'cmdecho'
setting
(princ)
)
Re:
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
First of all, Hi!
As a point of interest, I can't get the function (geo x) to work. Three
different errors on three successive tries. Does it work for you?
Any one else have a problem with this?
I'll put it in the VL IDE and try to debug it.
Dave Pitzer
=========
"Peter Tobey"
news:39C309FD.1B550F12@ix.netcom.com...
> David;
>
> This has been gathering dust on my "L:" drive forever. Have fun.
>
> -peter
>
> ;GEO.LSP
> ;Steven A. Schafer - 73417,2131
> ;Quantum Mechanics Corp.
> ;4 Jan 88
>
> ;NEG3 - Given a 3D point (x y z), NEG3 returns the point (-x -y -z).
>
> (defun neg3 (p)
> (mapcar '- p)
> )
>
> ;NORM - Given a 3D point (x y z), NORM returns the point (x' y' z')
> located a
> ;unit distance from (0 0 0) along the same vector direction as (x y z).
>
> (defun norm (p)
> (mapcar '(lambda (c) (/ c (sqrt (apply '+ (mapcar '* p p))))) p)
> )
>
> ;FACE - This function takes as arguments three 3D points a, b, and c,
> and an
> ;order number n. If n is zero, FACE draws the triangular 3D face with
> vertices
> ;at a, b, c, and also the 3D face defined by (neg3 a), (neg3 b), (neg3
> c).
> ;If n is greater than zero, FACE calculates the midpoints of the three
> vectors
> ;ab, ac, and bc, uses NORM to convert them to unit vectors, and then
> calls
> ;itself four times, once for each of the four smaller triangular faces
> defined
> ;by: (1) a, ab, ac; (2) b, ab, bc; (3) c, ac, bc; (4) ab, ac, bc; using
> an
> ;order number of n-1.
>
> (defun face (a b c n / ab ac bc)
> (if (> n 0)
> (progn
> (setq ab (norm (mapcar '+ a b)))
> (setq ac (norm (mapcar '+ a c)))
> (setq bc (norm (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
> (command "3dface" a b c "" "")
> (command "3dface" (neg3 a) (neg3 b) (neg3 c) "" "")
> )
> )
> )
>
> ;GEO - GEO first calculates the vertices for two faces of an icosahedron
> of
> ;unit radius (that is, an icosahedron centered at (0 0 0) having all of
> its
> ;vertices located at unit distance from the center). The remaining 18
> faces
> ;can be generated from the first two by means of simple reflections and
> rota-
> ;tions about the origin. GEO then calls FACE recursively to generate
> the
> ;faces of the geodesic sphere. Finally, the ARRAY command is used to
> complete
> ;the sphere.
>
> (defun geo (n / x y z u v p0 p1 p2 p3 cmd)
> (setq cmd (getvar "cmdecho")) ;save 'cmdecho' setting
> and
> (setvar "cmdecho" 0) ;then turn 'cmdecho' off
> (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 n)
> (face p1 p2 p3 n)
> (command "array" "w" "-1,-1" "1,1" "" "p" "0,0" 5 "" "")
> (setvar "cmdecho" cmd) ;restore 'cmdecho'
> setting
> (princ)
> )
Re:
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Nice to find you here. I'm looking forward to reading your review of the
book you described in another thread. It sounds like a book I'd like to
have.
I hadn't run GEO.LSP any time recently, but I knew it *used* to work, &
there's really very little to it - beyond an excellent grasp of the
geometry
written, GEO.LSP depends on selecting objects with a 'window', so for it
to work correctly you'll need to start by ZOOMing Center, centered at
0,0, with a height of 2.5 or so. Make sure you have no running object
snaps set, then enter (geo x) - where x is an integer - to run it.
Shading the resulting figure makes it a bit more interesting.
Basically, it generates an icosahedron-based geodesic sphere with a
specified "order" - the number of intermediary vertices inserted into
the edges of the base triangles. So (geo 1) draws a geodesic sphere with
each icosa face divided into 4 triangles, (geo 2) into 9, (geo 3) into
16, etc. Unless you've got a really powerful system, anything over 7 or
so is going to involve some waiting - (geo 7) generates about 1/3
million 3dfaces.
-peter
Re: Re: Geo.lsp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you SO much! I've had this routine like forever and it used to work great in earlier versions of AutuCAD. Then, it quit working, I assume because the lisp language was changed somewhere along the line.
I have been wanting to get this to work for SO many years now, you have no idea. I have been sold on geodesic domes since 1972, when the Dome Book 2 came out, and have been dreaming about living in a geodesic dome ever since that time.
Now, I just bought a property with a geodesic dome and I AM living in it. AutoCAD is my thing, since Version 2.18, and the first thing I want to do is now draw my new home in 3D. Now I CAN!
Thank you SO much!
Jack Willard
Re: Re: Geo.lsp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
There's a beautiful program called 3dhedron.lsp, by Petri Leskinen from Espoo, Finland. But with the changes in CAL it no longer works. If you still have an old version installed it's worth to take a look at it, including the DCL interface in which the polyhedra are previewed.
AutoCAD Expert's Visual LISP
Re: Re: Geo.lsp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I wrote whole bunch of geodesic spheres from 3pt and 4pt 3DFACES... All 3pt - triangular versions can be converted to 3DSOLID object - you just have to have A2012 or A2013 and just use SURFSCULPT command...
http://www.cadtutor.net/forum/showthread.php?68672
M.R.

