;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; ;;;; Copyright (c) Jun. 1996 by Takehiko Nagakura. ;;;; ;;;; All rights reserved. ;;;; ;;;; ;;;; ;;;; Do not copy, use, modify or distribute this software ;;;; ;;;; without written permission by Nagakura. Nagakura will ;;;; ;;;; not be responsible for any consequence of its use. ;;;; ;;;; ;;;; ;;;; Takehiko Nagakura (e-mail: takehiko@mit.edu) ;;;; ;;;; Massachusetts Institute of Technology ;;;; ;;;; 77 Massachusetts Ave. 10-472M, Cambridge, MA 02139 ;;;; ;;;; ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Last updated Feb 2, 2001 by TN ;;;; ; This file is an add-on to function01.lsp. Thus, ; you need to load function01.lsp before running this program. ; ; It animates the stool by simple draw-erase loop. ; ; Use of functions ; ; (c:demoani) ; this function converts degree to radian, scale it, and compute sine wave. (defun dsin (deg speed max) (* max (sin (* (/ deg 180.0) pi speed)))) ; this function simply holts the process for given seconds. It uses ; AutoCAD system variable "date" which is represented in fractional Julian Date (defun wait (sec / day start_time) (setq day (/ sec 60.0 60.0 24.0)) ; convert the sec to day (setq start_time (getvar "date")) (while (< (- (getvar "date") start_time) day) ) ; while ) (defun c:demoani(/ count holt) (setq halt 0.06) (command "ucs" "w") (command "ucsicon" "off") (command "cmdecho" 0) (command "zoom" (list -500 -500) (list 500 500)) ;1) rotate the stool once (setq count 0) (while (< count 40) (command "erase" "all" "") (stool 0 0 (* 9 count) 60 100 35 25) (setq count (+ count 1)) (wait halt) ) ; while ;2) bounce the stool (setq count 0) (while (< count 90) (command "erase" "all" "") (stool (dsin count 4 400) (dsin count 8 400) 0 60 100 35 25) (setq count (+ count 1)) (wait halt) ) ; while ;3) stretch width (setq count 0) (while (< count 90) (command "erase" "all" "") (stool 0 0 0 (+ 360 (dsin (- count 22.5) 4 300)) 100 35 25) (setq count (+ count 1)) (wait halt) ) ; while ;4) stretch hight (setq count 0) (while (< count 90) (command "erase" "all" "") (stool 0 (+ 150 (dsin (- count 22.5) 4 150)) 0 60 (+ 400 (dsin (- count 22.5) 4 300)) 35 25) (setq count (+ count 1)) (wait halt) ) ; while ;5) do yahoo (setq count 0) (while (< count 90) (command "erase" "all" "") (stool 0 ;xpos 0 ;ypos 0 ;rotation 60 ;width 100 ;hight 35 ;tank_hight (+ 25 (dsin (- count) 4 24))) ;seat_radius (setq count (+ count 1)) (wait halt) ) ; while ) ;(c:demoani) ; When this file is loaded, I will print its usage for the users. (prompt "(c:demoani)") ; Below prevents "nil" to be printed at then end of loading. (princ)