home *** CD-ROM | disk | FTP | other *** search
- ;;; SPIRAL.LSP
- ;;; ¬⌐┼v (C) 1992 Autodesk ñ╜Ñq
- ;;;
- ;;; Ñ╗│n┼ΘºK╢O¿╤▒z╢iªµÑ⌠ª≤Ñ╬│~╗▌¿D¬║½■¿⌐íB¡╫º∩ñ╬╡oªµ, ª²¼O░╚╜╨┐φ┤`ñU¡z
- ;;; ¡∞½h :
- ;;;
- ;;; 1) ñWªC¬║¬⌐┼v│qºi░╚╗▌ÑX▓{ªb¿Cñ@Ñ≈½■¿⌐∙╪íC
- ;;; 2) ¼█├÷¬║╗í⌐·ñσÑ≤ñ]Ñ▓╢╖⌐·╕ⁿ¬⌐┼v│qºiñ╬Ñ╗╢╡│\Ñi│qºiíC
- ;;;
- ;;; Ñ╗│n┼Θ╢╚┤ú¿╤º@¼░└│Ñ╬ñW¬║░╤ª╥, ª╙Ñ╝┴n⌐·⌐╬┴⌠ºtÑ⌠ª≤½O├╥; ╣∩⌐≤Ñ⌠ª≤»S«φ
- ;;; Ñ╬│~ñº╛A║┘⌐╩, ÑHñ╬░╙╖~╛P░Γ⌐╥┴⌠ºtÑX¿π¬║½O├╥, ªbª╣ñ@╖ºñ⌐ÑHº_╗{íC
- ;;;
- ;;; --------------------------------------------------------------------------;
- ;;; DESCRIPTION
- ;;;
- ;;; This is a programming example.
- ;;;
- ;;; Designed and implemented by Kelvin R. Throop in January 1985
- ;;;
- ;;; This program constructs a spiral. It can be loaded and called
- ;;; by typing either "spiral", "3dspiral" or the following:
- ;;; (cspiral <# rotations> <base point> <horiz growth per rotation>
- ;;; <points per circle> <start radius>
- ;;; <vert growth per rotation>).
- ;;;
- ;;; --------------------------------------------------------------------------;
-
- (defun myerror (s) ; If an error (such as CTRL-C) occurs
- ; while this command is active...
- (if (/= s "Function cancelled")
- (princ (strcat "\n┐∙╗~: " s))
- )
- (setvar "cmdecho" ocmd) ; Restore saved modes
- (setvar "blipmode" oblp)
- (setq *error* olderr) ; Restore old *error* handler
- (princ)
- )
-
- (defun cspiral (ntimes bpoint hfac lppass strad vfac
- / ang dist tp ainc dhinc dvinc circle dv)
-
- (setvar "blipmode" 0) ; turn blipmode off
- (setvar "cmdecho" 0) ; turn cmdecho off
- (setq circle (* 3.141596235 2))
- (setq ainc (/ circle lppass))
- (setq dhinc (/ hfac lppass))
- (if vfac (setq dvinc (/ vfac lppass)))
- (setq ang 0.0)
- (if vfac
- (setq dist strad dv 0.0)
- (setq dist 0.0)
- )
- (if vfac
- (command "3dpoly") ; start spiral ...
- (command "pline" bpoint) ; start spiral from base point and...
- )
- (repeat ntimes
- (repeat lppass
- (setq tp (polar bpoint (setq ang (+ ang ainc))
- (setq dist (+ dist dhinc))
- )
- )
- (if vfac
- (setq tp (list (car tp) (cadr tp) (+ dv (caddr tp)))
- dv (+ dv dvinc)
- )
- )
- (command tp) ; continue to the next point...
- )
- )
- (command "") ; until done.
- (princ)
- )
-
- ;;;
- ;;; Interactive spiral generation
- ;;;
-
- (defun C:SPIRAL (/ olderr ocmd oblp nt bp cf lp)
- (setq olderr *error*
- *error* myerror)
- (setq ocmd (getvar "cmdecho"))
- (setq oblp (getvar "blipmode"))
- (setvar "cmdecho" 0)
- (initget 1) ; bp must not be null
- (setq bp (getpoint "\nñññ▀┬I: "))
- (initget 7) ; nt must not be zero, neg, or null
- (setq nt (getint "\n▒█┬αª╕╝╞: "))
- (initget 3) ; cf must not be zero, or null
- (setq cf (getdist "\n¿Cª╕▒█┬α¬║íu╝W╢qív: "))
- (initget 6) ; lp must not be zero or neg
- (setq lp (getint "\n¿Cª╕▒█┬α¿╧Ñ╬¬║íu┬Iív╝╞ <30>: "))
- (cond ((null lp) (setq lp 30)))
- (cspiral nt bp cf lp nil nil)
- (setvar "cmdecho" ocmd)
- (setvar "blipmode" oblp)
- (setq *error* olderr) ; Restore old *error* handler
- (princ)
-
- )
-
- ;;;
- ;;; Interactive spiral generation
- ;;;
-
- (defun C:3DSPIRAL (/ olderr ocmd oblp nt bp hg vg sr lp)
- (setq olderr *error*
- *error* myerror)
- (setq ocmd (getvar "cmdecho"))
- (setq oblp (getvar "blipmode"))
- (setvar "cmdecho" 0)
- (initget 1) ; bp must not be null
- (setq bp (getpoint "\nñññ▀┬I: "))
- (initget 7) ; nt must not be zero, neg, or null
- (setq nt (getint "\n▒█┬αª╕╝╞: "))
- (initget 7) ; sr must not be zero, neg, or null
- (setq sr (getdist bp "\n░_⌐lÑb«|: "))
- (initget 1) ; cf must not be zero, or null
- (setq hg (getdist "\n¿Cª╕▒█┬α¬║íuñ⌠Ñ¡╝W╢qív: "))
- (initget 3) ; cf must not be zero, or null
- (setq vg (getdist "\n¿Cª╕▒█┬α¬║íu½½¬╜╝W╢qív: "))
- (initget 6) ; lp must not be zero or neg
- (setq lp (getint "\n¿Cª╕▒█┬α¿╧Ñ╬¬║íu┬Iív╝╞ <30>: "))
- (cond ((null lp) (setq lp 30)))
- (cspiral nt bp hg lp sr vg)
- (setvar "cmdecho" ocmd)
- (setvar "blipmode" oblp)
- (setq *error* olderr) ; Restore old *error* handler
- (princ)
-
- )
-
- ;;; --------------------------------------------------------------------------;
- (princ "\n\tíuC:SPIRALív╗PíuC:3DSPIRALívñw╕ⁿñJíC ")
- (princ)