• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Visual LISP, AutoLISP and General Customization

    Reply
    *Zale, David

    geodisic dome routine

    304 Views, 7 Replies
    09-15-2000 05:36 PM
    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
    Please use plain text.
    *Pitzer, Dave

    Re: geodisic dome routine

    09-15-2000 05:39 PM in reply to: *Zale, David
    Define "geodesic" dome. (seriously). Are you referring to Bukminster
    Fuller's dome geometry, a dodecahedron, or what?

    Dave Pitzer
    ==========

    "David Zale" wrote in message
    news:smileyvery-happy:7BF3FCFCB4561FA16FBD695113C046A@in.WebX.SaUCah8kaAW...
    > 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
    >
    Please use plain text.
    *Tobey, Peter

    Re: geodisic dome routine

    09-15-2000 10:49 PM in reply to: *Zale, David
    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)
    )
    Please use plain text.
    *Pitzer, Dave

    Re:

    09-16-2000 12:50 PM in reply to: *Zale, David
    Peter,

    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" wrote in message
    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)
    > )
    Please use plain text.
    *Tobey, Peter

    Re:

    09-16-2000 05:04 PM in reply to: *Zale, David
    Hi Dave;

    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 . There's no error checking, & no usage notes. As it's
    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
    Please use plain text.
    Contributor
    Posts: 11
    Registered: ‎03-24-2004

    Re: Re: Geo.lsp

    09-18-2012 09:40 AM in reply to: *Tobey, Peter

    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

    Please use plain text.
    Valued Contributor
    Posts: 82
    Registered: ‎02-07-2001

    Re: Re: Geo.lsp

    09-18-2012 10:15 AM in reply to: jack_willard

    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.

    http://www.freecadapps.com/swdetails.php?orgvalue=ACG&page=&review=4428&rowcolor=ffffcc&value=ACG-3D...

    Reinaldo N. Togores
    AutoCAD Expert's Visual LISP
    Please use plain text.
    Active Contributor
    marko_ribar
    Posts: 31
    Registered: ‎12-04-2011

    Re: Re: Geo.lsp

    09-20-2012 05:21 AM in reply to: Rtogores

    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-geodesic-dome/page4&highlight=geodesic+dome&p=#31

     

    M.R.

    Please use plain text.