;;;; copy right statement ;;;; ;;;; ;;;; ;;;; Nov 2, 1996, copyright by Takehiko Nagakura. All rights reserved. ;;;; ;;;; Written by takehiko nagakura, Massachusetts Institue of Technology. ;;;; ;;;; Do not use, copy, or distribute without permission by Takehiko ;;;; ;;;; Nagakura. Nagakura will not be responsible for any consequence ;;;; ;;;; of running this program. ;;;; ;;;; ;;;; ;;;; For information, send e-mail to takehiko@mit.edu ;;;; ;;;; ;;;; ;;;; Last updated Nov 2, 1996 ;;;; ;;;; ;;;; ; Sample lisp file for 4.207 prepared by Takehiko Nagakura. ; This file defines a function to draw a parametric bathroom stool. ; ; Use of functions ; (stool xpos ypos rot tank_width tank_height) ; (c:demo) ; First, I set up 2 layers I need. ; This has to be processed only at once when the file is loaded. (command "layer" "new" "axis" "color" "red" "axis" "") (command "layer" "new" "outline" "color" "white" "outline" "") ; This function allows a parametric stool to be drawn at ; a specified location with rotation ; Notice that I am using 3 local variables, w1, w2 and w3. (defun stool (xpos ypos rot tank_width tank_height / w1 w2 yb) ; 0) set up local parameters (setq w1 (/ tank_width 2.0)) ; half width for outline of back (setq w2 (- w1 8)) ; half width for the joint portion (setq yb (- -26 tank_height)) ; y coordinates of the bottom of tank ; 1) set up local coordinate system (command "ucs" "origin" (list xpos ypos 0)) (command "ucs" "z" rot) ; 2) Axis is drawn on layer "axis" (command "layer" "set" "axis" "") (command "line" (list -25 0) (list 25 0) "") (command "line" (list 0 -50) (list 0 35) "") ; 3) Outline of the stool is drawn on layer "outline" (command "layer" "set" "outline" "") (command "line" (list (- w1) -26) (list w1 -26) (list w1 yb) (list (- w1) yb) "c") (command "pline" (list (- w2) -26) (list -17 -2) "arc" (list 17 -2) "line" (list w2 -26) "" ) ; 4) reset the ucs to avoid side effect. (command "ucs" "world") ) ; end of defun ; Now I test the function defined above with various ; parameter values. ; You can call this function from Autocad command line prompt, too. ; Setting up zooming area just for the sake of showing my demo neatly. (defun c:demo () (command "limits" (list -150 -100) (list 300 300)) (command "zoom" "extents") (stool -80 0 0 36 14) (stool 0 0 0 40 5) (stool 80 0 0 60 30) (stool 180 0 0 100 15) (stool -80 120 30 36 14) (stool 0 120 30 40 5) (stool 80 120 30 60 30) (stool 180 120 30 100 15) (stool -80 200 150 36 14) (stool 0 200 150 40 5) (stool 80 200 150 60 30) (stool 180 200 150 100 15) (redraw) ) ;(c:demo)