PDA

View Full Version : Nautilus Shell



CADTutor
5th May 2004, 03:20 pm
Nautilus Shell

This routine creates a 3D Mesh in the form of a nautilus shell. No user input is required, the shell parameters are fixed.


; create a nautilus shell
; mfuccaro@hotmail.com
; ----- July.2003 -----
;
(defun c:nautilus( / radius Rad_inc n m ang1M ang1N old )
(setq Rad_Inc 0.2 ;radius increment
n 25 ;mesh N size
m 60 ;mesh M size
ang1N (/ (* 2.0 pi) n) ;angular increment
ang1M (/ pi 20.0) ;angular increment
angN 0.0 ;angle in N direction
old (getvar "osmode"))
(command "3dmesh" (1+ n) m)
(setvar "osmode" 0)
(repeat (1+ n)
(setq Radius 0.0 ;radius of cross section
angM 0.0 ;angle in M direction
angN (+ angN ang1N))
(repeat m
(command
(setq Radius (+ Radius Rad_Inc)
angM (+ angM ang1M)
p (list (* (+ Radius (* Radius (cos angN))) (cos angM))
(* Radius (sin angN))
(* (+ Radius (* Radius (cos angN))) (sin angM)))))
) ;repeat m
) ;repeat n+1
(setvar "osmode" old)
(princ)
) ;defun
(princ "\nRoutine loaded. Type NAUTILUS at the command prompt.")
(princ)

Download nautilus.lsp (http://www.cadimage.net/cadtutor/lisp/files/nautilus.lsp) 1.03 KB

The result of this routine is illustrated below:

http://www.cadimage.net/cadtutor/lisp/nautilus-01.gif

See the original topic (http://www.cadtutor.net/forum/viewtopic.php?t=600) for more details.