;;; bathtub.lsp ;;; copyright 2007 by allen peterson (alert "bathtub.lsp - copyright 2007 by Allen Peterson II \ntype tub to start the program") ;;; start the program (defun c:tub ( ) ;;; drawing setup (setq osm (getvar "osmode") ) ; gets osnap settings and assigns to osm (setvar "osmode" 0) ; turns osnap settings off ;;; user input (setq sp (getpoint "\nPick the starting point ")) (setq lgt (getreal "\nWhat is the length? ")) (setq thk (getreal "\nWhat is the thickness? ")) (setq wdt (getreal "\nWhat is the width? ")) (setq rad (getreal "\nThe angle interior radius is? ")) ;;; do the math (setq rad2 (/ (- wdt (* 2.0 thk)) 2.0)) (setq x1 (car sp) x2 (+ x1 thk) x3 (+ x2 rad) x5 (+ x1 lgt) x4 (- x5 rad2 thk) y1 (cadr sp) y2 (+ y1 thk) y3 (+ y2 rad) y6 (+ y1 wdt) y5 (- y6 thk) y4 (- y5 rad) ) ;;; point assignments (setq p1 (list x1 y1) p2 (list x5 y1) p3 (list x5 y6) p4 (list x1 y6) p5 (list x3 y2) p6 (list x4 y2) p7 (list x4 y5) p8 (list x3 y5) p9 (list x2 y4) p10 (list x2 y3) ) ;;; lets draw (command "line" p1 p2 "") (command "line" p2 p3 "") (command "line" p3 p4 "") (command "line" p4 p1 "") (command "line" p5 p6 "") (command "line" p7 p8 "") (command "line" p9 p10 "") (command "arc" p10 "e" p5 "r" rad ) (command "arc" p6 "e" p7 "r" rad2 ) (command "arc" p8 "e" p9 "r" rad ) ;;; end the program (setvar "osmode" osm) ; turns osnap settings back on )