; tubing.lsp - a program that draws a side view of rectangle or square tubing ; copyright 2007 by Charles Robbins (alert "tubing.lsp - copyright 2007 by Charles Robbins. Type tubing to start") ; start the program (defun c:tubing () ; drawing setup (setq osm (getvar "osmode")) ; gets osnap settings and assigns them to osm (setvar "osmode" 0) ; turns osnap settings off ; user input (setq sp (getpoint "\nPick the starting point ")) (initget 1 "s r") (setq q1 (getkword "\nIs the extruded tube square or rectangular? [s r] ")) (if (= q1 "s")(progn (setq len (getreal "\nWhat is the length of the square tube? ")) (setq width len) ) ) (if (= q1 "r")(progn (setq len (getreal "\nWhat is the length of the rectangular tube? ")) (setq width (getreal "\nWhat is the width of the rectangular tube? ")) ) ) (setq thk (getreal "\nWhat is the thickness of the tube? ")) ; do the math (setq x1 (car sp) x2 (+ x1 thk) x4 (+ x1 width) x3 (- x4 thk) y1 (cadr sp) y2 (+ y1 thk) y4 (+ y1 len) y3 (- y4 thk) ) ; point assignments (setq p1 (list x1 y1) p2 (list x4 y1) p3 (list x4 y4) p4 (list x1 y4) p5 (list x2 y2) p6 (list x3 y2) p7 (list x3 y3) p8 (list x2 y3) ) ; lets draw (command "pline" p1 p2 p3 p4 "c") (command "pline" p5 p6 p7 p8 "c") ; end the program (setvar "osmode" osm) ; turns osnap settings back on )