+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 33

Thread: geodesic dome

  1. #1
    Forum Newbie
    Using
    AutoCAD 2005
    Join Date
    Apr 2012
    Posts
    2

    Default geodesic dome

    Registered forum members do not see this ad.

    Hi,
    I was trying to create a routine to make a geodesic dome through lisp,as i am a beginner need some guidance for how to go about it

    so far i have managed to this what i have uploaded but i have realized that this is not the right way.geodasic 16042012.lspgeodasic 16042012.lsp

  2. #2
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    891

    Default

    This is totally do-able as almost all geodesic domes can be reduced to mathematical equations. But it's a lot trickier than you'd first think. I did some research into this in the last year and it's a real challenge. But there are solutions I've seen and there were more than one. Have fun and good luck.
    Last edited by Bill Tillman; 28th Apr 2012 at 12:01 pm.
    It's deja vu, all over again.

  3. #3
    Senior Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2012
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    358

    Default

    Here, I've followed this link and made this code... It's geodesic sphere based on icosahedron divisions...

    Code:
    (defun faceseg (p1 p2 p3 seg / 3DF 3DFACES 3DFI 3DFV D K N P12 P12V P30 P30V P30O P31 P31V V12)
      (setq d (/ (distance p1 p2) (float seg)))
      (setq k 0)
      (setq v12 (mapcar '* (list d d d) (mapcar '/ (mapcar '- p2 p1) (list (distance p1 p2) (distance p1 p2) (distance p1 p2)))))
      (repeat seg
        (setq p30 (mapcar '+ p3 (mapcar '* (list (* d (float k)) (* d (float k)) (* d (float k))) (mapcar '/ (mapcar '- p1 p3) (list (distance p1 p3) (distance p1 p3) (distance p1 p3))))))
        (setq p31 (mapcar '+ p3 (mapcar '* (list (* d (float (setq k (1+ k)))) (* d (float k)) (* d (float k))) (mapcar '/ (mapcar '- p1 p3) (list (distance p1 p3) (distance p1 p3) (distance p1 p3))))))
        (setq p12 (mapcar '+ p31 v12))
        (setq 3df (list p30 p31 p12))
        (setq 3dfaces (cons 3df 3dfaces))
        (setq n 0)
        (repeat (- k 1)
          (setq p30v (mapcar '+ p30 (mapcar '* (list (setq n (1+ n)) n n) v12)))
          (setq p31v (mapcar '+ p31 (mapcar '* (list n n n) v12)))
          (setq p12v (mapcar '+ p12 (mapcar '* (list n n n) v12)))
          (setq p30o (mapcar '+ p30 (mapcar '* (list (- n 1) (- n 1) (- n 1)) v12)))
          (setq 3dfv (list p30v p31v p12v))
          (setq 3dfi (list p30o p31v p30v))
          (setq 3dfaces (cons 3dfv 3dfaces))
          (setq 3dfaces (cons 3dfi 3dfaces))
        )
      )
      3dfaces
    )
    
    (defun projfaces2sph (3dfaces rad / 3DFACESP 3DFP P1 P1P P2 P2P P3 P3P)
      (foreach 3df 3dfaces
        (setq p1 (car 3df) p2 (cadr 3df) p3 (caddr 3df))
        (setq p1p (mapcar '* (list rad rad rad) (mapcar '/ p1 (list (distance '(0.0 0.0 0.0) p1) (distance '(0.0 0.0 0.0) p1) (distance '(0.0 0.0 0.0) p1)))))
        (setq p2p (mapcar '* (list rad rad rad) (mapcar '/ p2 (list (distance '(0.0 0.0 0.0) p2) (distance '(0.0 0.0 0.0) p2) (distance '(0.0 0.0 0.0) p2)))))
        (setq p3p (mapcar '* (list rad rad rad) (mapcar '/ p3 (list (distance '(0.0 0.0 0.0) p3) (distance '(0.0 0.0 0.0) p3) (distance '(0.0 0.0 0.0) p3)))))
        (setq 3dfp (list p1p p2p p3p))
        (setq 3dfacesp (cons 3dfp 3dfacesp))
      )
      3dfacesp
    )
    
    (defun c:geodesic-icosa ( / ALLFACES ICOSAF1 ICOSAF10 ICOSAF11 ICOSAF12 ICOSAF13 ICOSAF14 ICOSAF15 ICOSAF16 ICOSAF17 ICOSAF18 ICOSAF19 ICOSAF2 ICOSAF20 ICOSAF3 ICOSAF4 ICOSAF5 ICOSAF6 ICOSAF7 ICOSAF8 ICOSAF9 M PT PTICOSALST PTICOSALSTN R RAD SEG TAO)
      (setq tao (/ (+ (sqrt 5.0) 1.0) 2.0))
      (setq pticosalst (list 
                         (list 1.0 tao 0.0) (list -1.0 tao 0.0) (list 1.0 (- tao) 0.0) (list -1.0 (- tao) 0.0)
                         (list 0.0 1.0 tao) (list 0.0 -1.0 tao) (list 0.0 1.0 (- tao)) (list 0.0 -1.0 (- tao))
                         (list tao 0.0 1.0) (list (- tao) 0.0 1.0) (list tao 0.0 -1.0) (list (- tao) 0.0 -1.0)
                       )
      )
      (setq rad (getdist '(0.0 0.0 0.0) "\nPick radius : "))
      (setq r (distance '(0.0 0.0 0.0) (car pticosalst)))
      (setq m (/ rad r))
      (setq pticosalstn (mapcar '(lambda (pt) (list (* m (car pt)) (* m (cadr pt)) (* m (caddr pt)))) pticosalst))
      (initget 6)
      (setq seg (getint "\nInput number of face segmentation per edge of icosahedron : "))
      (setq icosaf1 (projfaces2sph (faceseg (nth 0 pticosalstn) (nth 1 pticosalstn) (nth 4 pticosalstn) seg) rad))
      (setq icosaf2 (projfaces2sph (faceseg (nth 1 pticosalstn) (nth 4 pticosalstn) (nth 9 pticosalstn) seg) rad))
      (setq icosaf3 (projfaces2sph (faceseg (nth 9 pticosalstn) (nth 4 pticosalstn) (nth 5 pticosalstn) seg) rad))
      (setq icosaf4 (projfaces2sph (faceseg (nth 5 pticosalstn) (nth 4 pticosalstn) (nth 8 pticosalstn) seg) rad))
      (setq icosaf5 (projfaces2sph (faceseg (nth 8 pticosalstn) (nth 4 pticosalstn) (nth 0 pticosalstn) seg) rad))
      (setq icosaf6 (projfaces2sph (faceseg (nth 9 pticosalstn) (nth 5 pticosalstn) (nth 3 pticosalstn) seg) rad))
      (setq icosaf7 (projfaces2sph (faceseg (nth 3 pticosalstn) (nth 5 pticosalstn) (nth 2 pticosalstn) seg) rad))
      (setq icosaf8 (projfaces2sph (faceseg (nth 2 pticosalstn) (nth 5 pticosalstn) (nth 8 pticosalstn) seg) rad))
      (setq icosaf9 (projfaces2sph (faceseg (nth 0 pticosalstn) (nth 1 pticosalstn) (nth 6 pticosalstn) seg) rad))
      (setq icosaf10 (projfaces2sph (faceseg (nth 1 pticosalstn) (nth 11 pticosalstn) (nth 6 pticosalstn) seg) rad))
      (setq icosaf11 (projfaces2sph (faceseg (nth 11 pticosalstn) (nth 7 pticosalstn) (nth 6 pticosalstn) seg) rad))
      (setq icosaf12 (projfaces2sph (faceseg (nth 7 pticosalstn) (nth 10 pticosalstn) (nth 6 pticosalstn) seg) rad))
      (setq icosaf13 (projfaces2sph (faceseg (nth 10 pticosalstn) (nth 0 pticosalstn) (nth 6 pticosalstn) seg) rad))
      (setq icosaf14 (projfaces2sph (faceseg (nth 11 pticosalstn) (nth 3 pticosalstn) (nth 7 pticosalstn) seg) rad))
      (setq icosaf15 (projfaces2sph (faceseg (nth 3 pticosalstn) (nth 2 pticosalstn) (nth 7 pticosalstn) seg) rad))
      (setq icosaf16 (projfaces2sph (faceseg (nth 2 pticosalstn) (nth 7 pticosalstn) (nth 10 pticosalstn) seg) rad))
      (setq icosaf17 (projfaces2sph (faceseg (nth 1 pticosalstn) (nth 9 pticosalstn) (nth 11 pticosalstn) seg) rad))
      (setq icosaf18 (projfaces2sph (faceseg (nth 3 pticosalstn) (nth 9 pticosalstn) (nth 11 pticosalstn) seg) rad))
      (setq icosaf19 (projfaces2sph (faceseg (nth 2 pticosalstn) (nth 8 pticosalstn) (nth 10 pticosalstn) seg) rad))
      (setq icosaf20 (projfaces2sph (faceseg (nth 0 pticosalstn) (nth 8 pticosalstn) (nth 10 pticosalstn) seg) rad))
      (setq allfaces (append icosaf1 icosaf2 icosaf3 icosaf4 icosaf5 icosaf6 icosaf7 icosaf8 icosaf9 icosaf10 icosaf11 icosaf12 icosaf13 icosaf14 icosaf15 icosaf16 icosaf17 icosaf18 icosaf19 icosaf20))
      (foreach face allfaces
        (entmake (list (cons 0 "3DFACE")(cons 10 (car face))(cons 11 (cadr face))(cons 12 (caddr face))(cons 13 (caddr face))))
      )
      (princ)
    )
    Hope you'll like it...
    Regards, M.R.
    Last edited by marko_ribar; 23rd Apr 2012 at 03:58 pm.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  4. #4
    Senior Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2012
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    358

    Default

    Here are codes based on octahedron and tetrahedron...

    Code:
    (defun faceseg (p1 p2 p3 seg / 3DF 3DFACES 3DFI 3DFV D K N P12 P12V P30 P30V P30O P31 P31V V12)
      (setq d (/ (distance p1 p2) (float seg)))
      (setq k 0)
      (setq v12 (mapcar '* (list d d d) (mapcar '/ (mapcar '- p2 p1) (list (distance p1 p2) (distance p1 p2) (distance p1 p2)))))
      (repeat seg
        (setq p30 (mapcar '+ p3 (mapcar '* (list (* d (float k)) (* d (float k)) (* d (float k))) (mapcar '/ (mapcar '- p1 p3) (list (distance p1 p3) (distance p1 p3) (distance p1 p3))))))
        (setq p31 (mapcar '+ p3 (mapcar '* (list (* d (float (setq k (1+ k)))) (* d (float k)) (* d (float k))) (mapcar '/ (mapcar '- p1 p3) (list (distance p1 p3) (distance p1 p3) (distance p1 p3))))))
        (setq p12 (mapcar '+ p31 v12))
        (setq 3df (list p30 p31 p12))
        (setq 3dfaces (cons 3df 3dfaces))
        (setq n 0)
        (repeat (- k 1)
          (setq p30v (mapcar '+ p30 (mapcar '* (list (setq n (1+ n)) n n) v12)))
          (setq p31v (mapcar '+ p31 (mapcar '* (list n n n) v12)))
          (setq p12v (mapcar '+ p12 (mapcar '* (list n n n) v12)))
          (setq p30o (mapcar '+ p30 (mapcar '* (list (- n 1) (- n 1) (- n 1)) v12)))
          (setq 3dfv (list p30v p31v p12v))
          (setq 3dfi (list p30o p31v p30v))
          (setq 3dfaces (cons 3dfv 3dfaces))
          (setq 3dfaces (cons 3dfi 3dfaces))
        )
      )
      3dfaces
    )
    
    (defun projfaces2sph (3dfaces rad / 3DFACESP 3DFP P1 P1P P2 P2P P3 P3P)
      (foreach 3df 3dfaces
        (setq p1 (car 3df) p2 (cadr 3df) p3 (caddr 3df))
        (setq p1p (mapcar '* (list rad rad rad) (mapcar '/ p1 (list (distance '(0.0 0.0 0.0) p1) (distance '(0.0 0.0 0.0) p1) (distance '(0.0 0.0 0.0) p1)))))
        (setq p2p (mapcar '* (list rad rad rad) (mapcar '/ p2 (list (distance '(0.0 0.0 0.0) p2) (distance '(0.0 0.0 0.0) p2) (distance '(0.0 0.0 0.0) p2)))))
        (setq p3p (mapcar '* (list rad rad rad) (mapcar '/ p3 (list (distance '(0.0 0.0 0.0) p3) (distance '(0.0 0.0 0.0) p3) (distance '(0.0 0.0 0.0) p3)))))
        (setq 3dfp (list p1p p2p p3p))
        (setq 3dfacesp (cons 3dfp 3dfacesp))
      )
      3dfacesp
    )
    
    (defun c:geodesic-octa ( / ALLFACES M OCTAF1 OCTAF2 OCTAF3 OCTAF4 OCTAF5 OCTAF6 OCTAF7 OCTAF8 PT PTICOSALST PTOCTALST PTOCTALSTN R RAD SEG TAO)
      (setq tao (sqrt 2.0))
      (setq ptoctalst (list 
                         (list -1.0 -1.0 0.0) (list 1.0 -1.0 0.0) (list 1.0 1.0 0.0) (list -1.0 1.0 0.0)
                         (list 0.0 0.0 tao) (list 0.0 0.0 (- tao))
                       )
      )
      (setq rad (getdist '(0.0 0.0 0.0) "\nPick radius : "))
      (setq r (distance '(0.0 0.0 0.0) (car ptoctalst)))
      (setq m (/ rad r))
      (setq ptoctalstn (mapcar '(lambda (pt) (list (* m (car pt)) (* m (cadr pt)) (* m (caddr pt)))) ptoctalst))
      (initget 6)
      (setq seg (getint "\nInput number of face segmentation per edge of octahedron : "))
      (setq octaf1 (projfaces2sph (faceseg (nth 0 ptoctalstn) (nth 1 ptoctalstn) (nth 4 ptoctalstn) seg) rad))
      (setq octaf2 (projfaces2sph (faceseg (nth 1 ptoctalstn) (nth 2 ptoctalstn) (nth 4 ptoctalstn) seg) rad))
      (setq octaf3 (projfaces2sph (faceseg (nth 2 ptoctalstn) (nth 3 ptoctalstn) (nth 4 ptoctalstn) seg) rad))
      (setq octaf4 (projfaces2sph (faceseg (nth 0 ptoctalstn) (nth 3 ptoctalstn) (nth 4 ptoctalstn) seg) rad))
      (setq octaf5 (projfaces2sph (faceseg (nth 0 ptoctalstn) (nth 1 ptoctalstn) (nth 5 ptoctalstn) seg) rad))
      (setq octaf6 (projfaces2sph (faceseg (nth 1 ptoctalstn) (nth 2 ptoctalstn) (nth 5 ptoctalstn) seg) rad))
      (setq octaf7 (projfaces2sph (faceseg (nth 2 ptoctalstn) (nth 3 ptoctalstn) (nth 5 ptoctalstn) seg) rad))
      (setq octaf8 (projfaces2sph (faceseg (nth 0 ptoctalstn) (nth 3 ptoctalstn) (nth 5 ptoctalstn) seg) rad))
      (setq allfaces (append octaf1 octaf2 octaf3 octaf4 octaf5 octaf6 octaf7 octaf8))
      (foreach face allfaces
        (entmake (list (cons 0 "3DFACE")(cons 10 (car face))(cons 11 (cadr face))(cons 12 (caddr face))(cons 13 (caddr face))))
      )
      (princ)
    )
    Code:
    (defun faceseg (p1 p2 p3 seg / 3DF 3DFACES 3DFI 3DFV D K N P12 P12V P30 P30V P30O P31 P31V V12)
      (setq d (/ (distance p1 p2) (float seg)))
      (setq k 0)
      (setq v12 (mapcar '* (list d d d) (mapcar '/ (mapcar '- p2 p1) (list (distance p1 p2) (distance p1 p2) (distance p1 p2)))))
      (repeat seg
        (setq p30 (mapcar '+ p3 (mapcar '* (list (* d (float k)) (* d (float k)) (* d (float k))) (mapcar '/ (mapcar '- p1 p3) (list (distance p1 p3) (distance p1 p3) (distance p1 p3))))))
        (setq p31 (mapcar '+ p3 (mapcar '* (list (* d (float (setq k (1+ k)))) (* d (float k)) (* d (float k))) (mapcar '/ (mapcar '- p1 p3) (list (distance p1 p3) (distance p1 p3) (distance p1 p3))))))
        (setq p12 (mapcar '+ p31 v12))
        (setq 3df (list p30 p31 p12))
        (setq 3dfaces (cons 3df 3dfaces))
        (setq n 0)
        (repeat (- k 1)
          (setq p30v (mapcar '+ p30 (mapcar '* (list (setq n (1+ n)) n n) v12)))
          (setq p31v (mapcar '+ p31 (mapcar '* (list n n n) v12)))
          (setq p12v (mapcar '+ p12 (mapcar '* (list n n n) v12)))
          (setq p30o (mapcar '+ p30 (mapcar '* (list (- n 1) (- n 1) (- n 1)) v12)))
          (setq 3dfv (list p30v p31v p12v))
          (setq 3dfi (list p30o p31v p30v))
          (setq 3dfaces (cons 3dfv 3dfaces))
          (setq 3dfaces (cons 3dfi 3dfaces))
        )
      )
      3dfaces
    )
    
    (defun projfaces2sph (3dfaces rad / 3DFACESP 3DFP P1 P1P P2 P2P P3 P3P)
      (foreach 3df 3dfaces
        (setq p1 (car 3df) p2 (cadr 3df) p3 (caddr 3df))
        (setq p1p (mapcar '* (list rad rad rad) (mapcar '/ p1 (list (distance '(0.0 0.0 0.0) p1) (distance '(0.0 0.0 0.0) p1) (distance '(0.0 0.0 0.0) p1)))))
        (setq p2p (mapcar '* (list rad rad rad) (mapcar '/ p2 (list (distance '(0.0 0.0 0.0) p2) (distance '(0.0 0.0 0.0) p2) (distance '(0.0 0.0 0.0) p2)))))
        (setq p3p (mapcar '* (list rad rad rad) (mapcar '/ p3 (list (distance '(0.0 0.0 0.0) p3) (distance '(0.0 0.0 0.0) p3) (distance '(0.0 0.0 0.0) p3)))))
        (setq 3dfp (list p1p p2p p3p))
        (setq 3dfacesp (cons 3dfp 3dfacesp))
      )
      3dfacesp
    )
    
    (defun c:geodesic-tetra ( / ALLFACES M PT PTTETRALST PTTETRALSTN R RAD SEG TETRAF1 TETRAF2 TETRAF3 TETRAF4)
      (setq pttetralst (list 
                         (list -1.0 -1.0 -1.0) (list 1.0 -1.0 1.0) (list 1.0 1.0 -1.0) (list -1.0 1.0 1.0)
                       )
      )
      (setq rad (getdist '(0.0 0.0 0.0) "\nPick radius : "))
      (setq r (distance '(0.0 0.0 0.0) (car pttetralst)))
      (setq m (/ rad r))
      (setq pttetralstn (mapcar '(lambda (pt) (list (* m (car pt)) (* m (cadr pt)) (* m (caddr pt)))) pttetralst))
      (initget 6)
      (setq seg (getint "\nInput number of face segmentation per edge of tetrahedron : "))
      (setq tetraf1 (projfaces2sph (faceseg (nth 0 pttetralstn) (nth 1 pttetralstn) (nth 2 pttetralstn) seg) rad))
      (setq tetraf2 (projfaces2sph (faceseg (nth 1 pttetralstn) (nth 2 pttetralstn) (nth 3 pttetralstn) seg) rad))
      (setq tetraf3 (projfaces2sph (faceseg (nth 2 pttetralstn) (nth 3 pttetralstn) (nth 0 pttetralstn) seg) rad))
      (setq tetraf4 (projfaces2sph (faceseg (nth 3 pttetralstn) (nth 0 pttetralstn) (nth 1 pttetralstn) seg) rad))
      (setq allfaces (append tetraf1 tetraf2 tetraf3 tetraf4))
      (foreach face allfaces
        (entmake (list (cons 0 "3DFACE")(cons 10 (car face))(cons 11 (cadr face))(cons 12 (caddr face))(cons 13 (caddr face))))
      )
      (princ)
    )
    Regards, Marko Ribar, d.i.a. (architect)

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  5. #5
    Junior Member CM Hew's Avatar
    Discipline
    Civil
    CM Hew's Discipline Details
    Occupation
    Project Manager
    Discipline
    Civil
    Using
    AutoCAD 2011
    Join Date
    Apr 2009
    Location
    BSB, Brunei
    Posts
    17

    Default

    Marko,

    Very Interesting. I did a trial run using the lisp and here is the result for both Icosa and Octa (five divisions)

    icosa and octa 5 divisions.jpg

    Enjoy trying out the lisp.

    Thanks

  6. #6
    Senior Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2012
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    358

    Default explanation

    Note that if you really want to create objects with each edge equal, triangles of tetra, octa and icosa shouldn't be divided by it's edge divisions, but you'll have to project center of each triangle to sphere and connect these new vertices - so tetrahedron would transform to its inverse tetrahedron (4 sides becomes 4 vertices), octahedron to cube (8 sides becomes 8 vertices of new cube that will have now 6 sides - so if you project again centers of these sides you'll get back 6 vertices of octahedron) - these two are complements and if you transform icosahedron (20 sides becomes 20 vertices), it'll transform to dodecahedron that has 12 sides exactly as number of vertices of icosahedron - these two are complements...

    Still my interpolation of icosa, octa and tetra isn't quite as expected as it's straight projection on sphere all vertices made from net of divisions of main equal sided triangles... Compared with MAX geospheres and there were different results... So here you have my versions as explained from above linked article, and eventually if you have 3DS MAX you'll have its built-in algorithm for these Fullers geospheres...

    M.R.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  7. #7
    Forum Newbie
    Using
    AutoCAD 2005
    Join Date
    Apr 2012
    Posts
    2

    Default

    Hi, YOUR HELP IS MUCH APPRECIATED BUT AS I AM A BEGINNER AND AM HAVING REALLY HARD TIME UNDERSTANDING YOUR CODES CAN YOU PLEASE WRITE DOWN pseudo code of some thing to explain how it is down,anyway i have done this if you can have a look and tell me if there is any possible lead from here. cheers for help.
    Attached Files

  8. #8
    Senior Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2012
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    358

    Default

    I don't know what are you trying to accomplish... You already have built-in command AI_DOME for making dome mesh object... Or simply type 3D at command prompt and you'll get all surface based object primitives... As for explanation of my codes, I simply translated what's written in above link article ab geodesic sphere - followed steps... Only part that I was struggling is part of division of main triangle of base object - sub-function and making correct list of new divided triangles... Projecting these triangles on sphere was easy part using (mapcar) function... Also difficult part was that I had to inspect all vertexes (especially for icosahedron) and write down correct 3 point combination for main faces of icosahedron - has 20 of them as you can see from the code...
    If you still want to make the code that will imitate AI_DOME command I suggest that you use (polar) function and try to make one segment of dome and after that use array - polar command to make arrayed copies of this segment... For finding points of every next upper 3dface use (polar (cenx ceny (R*sin(A))) B (R*cos(A))) where A is angle in vertical elevation and B angle in horizontal elevation - top view, cenx and ceny coordinates of center of dome (R*sin(A)) - z coordinate of center and R main radius of dome...

    M.R.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  9. #9
    Senior Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2012
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    358

    Default

    Here is geodesic-icosa.lsp with witch you can cut sphere to make dome hemisphere if segmentation is even number... Orientation of main icosahedron changed - now is aligned with 3ds MAX version - again there are differences between MAX and this code as with MAX there are equal lengths along arcs over main edges and along arcs over 1 direction of net division of main triangle (horizontal divisions)... This my version is pure projection of net divisions of triangles onto geodesic sphere - all lengths are different but main divisions that are to be projected are equal just like it's shown in posted link with tutorial...

    Code:
    (defun faceseg (p1 p2 p3 seg / 3DF 3DFACES 3DFI 3DFV D K N P12 P12V P30 P30V P30O P31 P31V V12)
      (setq d (/ (distance p1 p2) (float seg)))
      (setq k 0)
      (setq v12 (mapcar '* (list d d d) (mapcar '/ (mapcar '- p2 p1) (list (distance p1 p2) (distance p1 p2) (distance p1 p2)))))
      (repeat seg
        (setq p30 (mapcar '+ p3 (mapcar '* (list (* d (float k)) (* d (float k)) (* d (float k))) (mapcar '/ (mapcar '- p1 p3) (list (distance p1 p3) (distance p1 p3) (distance p1 p3))))))
        (setq p31 (mapcar '+ p3 (mapcar '* (list (* d (float (setq k (1+ k)))) (* d (float k)) (* d (float k))) (mapcar '/ (mapcar '- p1 p3) (list (distance p1 p3) (distance p1 p3) (distance p1 p3))))))
        (setq p12 (mapcar '+ p31 v12))
        (setq 3df (list p30 p31 p12))
        (setq 3dfaces (cons 3df 3dfaces))
        (setq n 0)
        (repeat (- k 1)
          (setq p30v (mapcar '+ p30 (mapcar '* (list (setq n (1+ n)) n n) v12)))
          (setq p31v (mapcar '+ p31 (mapcar '* (list n n n) v12)))
          (setq p12v (mapcar '+ p12 (mapcar '* (list n n n) v12)))
          (setq p30o (mapcar '+ p30 (mapcar '* (list (- n 1) (- n 1) (- n 1)) v12)))
          (setq 3dfv (list p30v p31v p12v))
          (setq 3dfi (list p30o p31v p30v))
          (setq 3dfaces (cons 3dfv 3dfaces))
          (setq 3dfaces (cons 3dfi 3dfaces))
        )
      )
      3dfaces
    )
    (defun projfaces2sph (3dfaces rad / 3DFACESP 3DFP P1 P1P P2 P2P P3 P3P)
      (foreach 3df 3dfaces
        (setq p1 (car 3df) p2 (cadr 3df) p3 (caddr 3df))
        (setq p1p (mapcar '* (list rad rad rad) (mapcar '/ p1 (list (distance '(0.0 0.0 0.0) p1) (distance '(0.0 0.0 0.0) p1) (distance '(0.0 0.0 0.0) p1)))))
        (setq p2p (mapcar '* (list rad rad rad) (mapcar '/ p2 (list (distance '(0.0 0.0 0.0) p2) (distance '(0.0 0.0 0.0) p2) (distance '(0.0 0.0 0.0) p2)))))
        (setq p3p (mapcar '* (list rad rad rad) (mapcar '/ p3 (list (distance '(0.0 0.0 0.0) p3) (distance '(0.0 0.0 0.0) p3) (distance '(0.0 0.0 0.0) p3)))))
        (setq 3dfp (list p1p p2p p3p))
        (setq 3dfacesp (cons 3dfp 3dfacesp))
      )
      3dfacesp
    )
    (defun tg (a)
      (/ (sin a) (cos a))
    )
    (defun c:geodesic-icosa ( / ALLFACES ICOSAF1 ICOSAF10 ICOSAF11 ICOSAF12 ICOSAF13 ICOSAF14 ICOSAF15 ICOSAF16 ICOSAF17 ICOSAF18 ICOSAF19 ICOSAF2 ICOSAF20 ICOSAF3 ICOSAF4 ICOSAF5 ICOSAF6 ICOSAF7 ICOSAF8 ICOSAF9 M PT PTICOSALST PTICOSALSTN R RAD SEG TAO)
      (setq tao (/ (+ (sqrt 5.0) 1.0) 2.0))
      (setq pticosalst (list 
                         (list 0.0 0.0 (sqrt (+ (expt tao 2) 1.0))) 
                         (list (* tao (+ (tg (/ pi 10.0)) (tg (/ pi 5.0)))) 0.0 (/ tao (sqrt (+ (expt tao 2) 1.0))))
                         (list (* tao (tg (/ pi 10.0))) tao (/ tao (sqrt (+ (expt tao 2) 1.0)))) (list (/ (- 1.0) (tg (/ pi 5.0))) 1.0 (/ tao (sqrt (+ (expt tao 2) 1.0))))
                         (list (/ (- 1.0) (tg (/ pi 5.0))) -1.0 (/ tao (sqrt (+ (expt tao 2) 1.0)))) (list (* tao (tg (/ pi 10.0))) (- tao) (/ tao (sqrt (+ (expt tao 2) 1.0))))
                         (list (/ 1.0 (tg (/ pi 5.0))) 1.0 (/ (- tao) (sqrt (+ (expt tao 2) 1.0)))) (list (* (- tao) (tg (/ pi 10.0))) tao (/ (- tao) (sqrt (+ (expt tao 2) 1.0))))
                         (list (* (- tao) (+ (tg (/ pi 10.0)) (tg (/ pi 5.0)))) 0.0 (/ (- tao) (sqrt (+ (expt tao 2) 1.0))))
                         (list (* (- tao) (tg (/ pi 10.0))) (- tao) (/ (- tao) (sqrt (+ (expt tao 2) 1.0)))) (list (/ 1.0 (tg (/ pi 5.0))) -1.0 (/ (- tao) (sqrt (+ (expt tao 2) 1.0))))
                         (list 0.0 0.0 (- (sqrt (+ (expt tao 2) 1.0))))
                       )
      )
      (setq rad (getdist '(0.0 0.0 0.0) "\nPick radius : "))
      (setq r (distance '(0.0 0.0 0.0) (car pticosalst)))
      (setq m (/ rad r))
      (setq pticosalstn (mapcar '(lambda (pt) (list (* m (car pt)) (* m (cadr pt)) (* m (caddr pt)))) pticosalst))
      (initget 6)
      (setq seg (getint "\nInput number of face segmentation per edge of icosahedron : "))
      (setq icosaf1 (projfaces2sph (faceseg (nth 0 pticosalstn) (nth 1 pticosalstn) (nth 2 pticosalstn) seg) rad))
      (setq icosaf2 (projfaces2sph (faceseg (nth 0 pticosalstn) (nth 2 pticosalstn) (nth 3 pticosalstn) seg) rad))
      (setq icosaf3 (projfaces2sph (faceseg (nth 0 pticosalstn) (nth 3 pticosalstn) (nth 4 pticosalstn) seg) rad))
      (setq icosaf4 (projfaces2sph (faceseg (nth 0 pticosalstn) (nth 4 pticosalstn) (nth 5 pticosalstn) seg) rad))
      (setq icosaf5 (projfaces2sph (faceseg (nth 0 pticosalstn) (nth 5 pticosalstn) (nth 1 pticosalstn) seg) rad))
      (setq icosaf6 (projfaces2sph (faceseg (nth 1 pticosalstn) (nth 2 pticosalstn) (nth 6 pticosalstn) seg) rad))
      (setq icosaf7 (projfaces2sph (faceseg (nth 2 pticosalstn) (nth 6 pticosalstn) (nth 7 pticosalstn) seg) rad))
      (setq icosaf8 (projfaces2sph (faceseg (nth 2 pticosalstn) (nth 3 pticosalstn) (nth 7 pticosalstn) seg) rad))
      (setq icosaf9 (projfaces2sph (faceseg (nth 3 pticosalstn) (nth 7 pticosalstn) (nth 8 pticosalstn) seg) rad))
      (setq icosaf10 (projfaces2sph (faceseg (nth 3 pticosalstn) (nth 4 pticosalstn) (nth 8 pticosalstn) seg) rad))
      (setq icosaf11 (projfaces2sph (faceseg (nth 4 pticosalstn) (nth 5 pticosalstn) (nth 9 pticosalstn) seg) rad))
      (setq icosaf12 (projfaces2sph (faceseg (nth 4 pticosalstn) (nth 8 pticosalstn) (nth 9 pticosalstn) seg) rad))
      (setq icosaf13 (projfaces2sph (faceseg (nth 5 pticosalstn) (nth 9 pticosalstn) (nth 10 pticosalstn) seg) rad))
      (setq icosaf14 (projfaces2sph (faceseg (nth 5 pticosalstn) (nth 1 pticosalstn) (nth 10 pticosalstn) seg) rad))
      (setq icosaf15 (projfaces2sph (faceseg (nth 1 pticosalstn) (nth 10 pticosalstn) (nth 6 pticosalstn) seg) rad))
      (setq icosaf16 (projfaces2sph (faceseg (nth 11 pticosalstn) (nth 6 pticosalstn) (nth 7 pticosalstn) seg) rad))
      (setq icosaf17 (projfaces2sph (faceseg (nth 11 pticosalstn) (nth 7 pticosalstn) (nth 8 pticosalstn) seg) rad))
      (setq icosaf18 (projfaces2sph (faceseg (nth 11 pticosalstn) (nth 8 pticosalstn) (nth 9 pticosalstn) seg) rad))
      (setq icosaf19 (projfaces2sph (faceseg (nth 11 pticosalstn) (nth 9 pticosalstn) (nth 10 pticosalstn) seg) rad))
      (setq icosaf20 (projfaces2sph (faceseg (nth 11 pticosalstn) (nth 10 pticosalstn) (nth 6 pticosalstn) seg) rad))
      (setq allfaces (append icosaf1 icosaf2 icosaf3 icosaf4 icosaf5 icosaf6 icosaf7 icosaf8 icosaf9 icosaf10 icosaf11 icosaf12 icosaf13 icosaf14 icosaf15 icosaf16 icosaf17 icosaf18 icosaf19 icosaf20))
      (foreach face allfaces
        (entmake (list (cons 0 "3DFACE")(cons 10 (car face))(cons 11 (cadr face))(cons 12 (caddr face))(cons 13 (caddr face))))
      )
      (princ)
    )
    M.R.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  10. #10
    Senior Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2012
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    358

    Default

    Registered forum members do not see this ad.

    Here are differences between these codes and MAX algorithm...
    See attached *.dwg files...

    M.R.
    Tschus...
    Attached Files

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

Similar Threads

  1. How to build 4v geodesic dome in autocad 2012?
    By kingviser in forum AutoCAD 3D Modelling & Rendering
    Replies: 12
    Last Post: 31st Aug 2012, 06:58 pm
  2. easy way to make a geodesic dome
    By 64lesabre in forum AutoCAD 3D Modelling & Rendering
    Replies: 6
    Last Post: 10th Aug 2012, 11:38 am
  3. Need Help With Geodesic Dome
    By brian nguyen in forum AutoCAD 3D Modelling & Rendering
    Replies: 8
    Last Post: 21st May 2010, 06:28 pm
  4. geodesic dome
    By sagaro in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 26th Jan 2010, 07:16 am
  5. skylight detail for a geodesic dome
    By micks_27986 in forum AutoCAD 3D Modelling & Rendering
    Replies: 4
    Last Post: 10th Feb 2009, 03:07 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts