Jump to content

Geodesic Sphere


Guest Vaker

Recommended Posts

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • fuccaro

    7

  • CADTutor

    5

  • hyposmurf

    2

  • allardl

    2

I wrote a short demo program.

How it works: consider a sphere containing a triangle. The middle of each edge is projected on the sphere and based on these points and the initial 3 corners 4 new triangles are created. This iterative process is repeated generating more and more triangles approximating better and better the spherical surface.

 

geo.gif

 

After you run the program you may pan/zoom/orbit, you may move the objects on to an other layer or you may even delete them. By running the program again you will get the next level - or you will cause the computer to hang-up.

Have fun!

;| GEOdhesical "surface" demo
   [email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email]
__________________Dec. 2004_____|;
(defun c:geo( / tr1 pl a i c m t1)
 (if (not *tr*) (init))
 (foreach t1 *tr*
   (setq pl (list (nth 1 t1) (nth 2 t1) (nth 3 t1) (nth 1 t1)) i 0 m nil)
   (repeat 3
     (setq a (nth i pl) b (nth (setq i (1+ i)) pl)
       c (c:cal "plt(a,b,0.5)")
       c (c:cal "pld(orig,c,100)")
       m (cons c m))
     )
   (setq tr1 (cons (make3dpoly m) tr1)
     tr1 (cons (make3dpoly (list (nth 1 t1) (nth 0 m) (nth 2 m))) tr1)
     tr1 (cons (make3dpoly (list (nth 2 t1) (nth 2 m) (nth 1 m))) tr1)
     tr1 (cons (make3dpoly (list (nth 3 t1) (nth 1 m) (nth 0 m))) tr1))
   )
 (setq *tr* tr1)
 (command "color" (setq *color* (1+ *color*)))
 (strcat "Done, " (if (< (length *tr*) 17) "" "you may try to ")
     "run the program again"
     (if (> (length *tr*) 1023) " AT YOUR OWN RISK!!!" ""))
 )

(defun make3dpoly (vertlist / point)
 (entmake (list '(0 . "POLYLINE")'(66 . 1)'(100 . "AcDb3dPolyline")'(70 . 9)))
 (foreach point vertlist
   (entmake (list (cons 0 "VERTEX")'(100 . "AcDb3dPolylineVertex")'(70 . 32)(cons 10 point))))
 (entmake '((0 . "SEQEND")))
 (cons (entlast) vertlist)
 )

(defun init( / osmode rs d rc)
 (setvar "CMDECHO" 0)
 (if (not (member "geomcal.arx" (arx))) (arxload "geomcal"))
 (setq rs 100.0    ;radius of sphere
   d 45.0        ;distance of cutting plane from the origin
   rc (sqrt (- (* rs rs) (* d d)))
   *tr* nil    ;list of triangles
   orig '(0 0 0)    ;center of the sphere -global variable!
   *color* 0)
 (setq *tr* (cons (make3dpoly (mapcar
              '(lambda(x) (reverse (cons d (reverse (polar '(0 0) (* x (/ PI 3)) rc)))))
              '(0 2 4))) *tr*))
 )

Link to comment
Share on other sites

Outstanding Fuccaro :star: you get a star for that one.

 

Am I right in thinking that the routine creates one quarter of a hemisphere? So a full hemisphere is possible by Polar Array.

 

I have two small requests. Is it possible to have each subsequent iteration delete the objects from the previous one? I did 4 iterations and ended up with a lot of stuff I needed to delete - maybe this should be an option the user is prompted for. Or perhaps it may just be easier to put each iteration on a new layer. Also, is it possible to draw the triangle as 3D Faces rather than 3D Ploylines? This would then create a geodesic dome that could be shaded or rendered.

 

:thumbsup:

Link to comment
Share on other sites

Ah, I just thought of a third thing. In order to facilitate a Polar Array, could the generated form be orientated so that one of the apexes was in the upper Z position with the opposite curve on the base plane? :)

Link to comment
Share on other sites

CADTutor

Before you start a new iteration you may delete/recolor/relayer some or all of the objects. The triangles are recorded into a list (called *tr*) and the program will work without problems based on those data (tested).

All of the "triangles" are in fact closed plines so using the REGION command you should be able to convert them from a snap. The only problem I anticipate: the operation can be very time consuming for say 1024 triangles...

So I will think again before to upgrade the program to the "two stars" level :)

The program doesn't generate a quarter of a hemisphere. I placed almost randomly the initial triangle in the sphere. By changing value of "d" in the "init" routine the plane containing the triangle will be placed at other distance from the center point.

Why to array and render the dome? It is simpler to draw a sphere and render that one.

Well, it is a just limited demo program I found interesting to write -nothing more.

Link to comment
Share on other sites

OK, I appreciate that this is just your way of exercising your brain :lol:

 

I just thought that if you were writing a routine to create a part of a geodesic sphere, it might just as well be useable. I know, I ask too much :roll: ...again.

Link to comment
Share on other sites

In Architecture the geodesic dome is a very important structure. Many architects have used it but probably the most celebrated was Buckminster Fuller. See Spaceship Earth as an example. It would be very useful to have a routine that could create a geodesic dome. I'm sure many of my students would use it and others interested in architecture. Simply using AutoCAD's own spheres is not the same as the structure is quite different.

Link to comment
Share on other sites

In the link about the Spaceship Earth I recognize an other approach. Starting from a triangle with the corners on the sphere the center point is projected "out" to the surface. Four new triangles are generated based on the corners of the first triangle and the projection. I will try to write a program for this -the triangles generated by the Lisp I posted previously are not identical. This is what happens when a some one tries an architectural work after he studied mechanics :D .

About the Eden Project: the sphere is covered by a hexagonal mesh -even simpler to generate.

 

Interesting theme...

8)

Link to comment
Share on other sites

  • 2 years later...

I am new to autocad and I've been tasked to make a geodesic dome and i came across this script and how exactly do i do that? I've tried using the various scripting editors within autocad and so far nothing works.

 

Like I said I'm new to autocad so I don't have the faintest idea how to run scripts or things of that sort. editing objects is mostly what I know how to do so any assistance would be greatly appreciated.

Link to comment
Share on other sites

That worked great. Thanks alot. I'm sure I'll have more questions as I work further into AutoCAD.

 

EDIT: So I was using the lsp script and it functioned fantastically, except I got a little carried away pushing it and no matter what i do to get it to reset to the initial piece it keeps going from where it left of and it breaking autoCAD. Is there a way to get it to reset to the default value?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...