;;; ;;; Insulation.lsp ;;; ;;; Copyright (C) 1997 by Brian Lunn, Denzil Hill ;;; ;;; Permission to use, copy, modify, and distribute this software ;;; for any purpose and without fee is hereby granted, provided ;;; that the above copyright notice appears in all copies and ;;; that both that copyright notice and the limited warranty and ;;; restricted rights notice below appear in all supporting ;;; documentation. ;;; ;;; Brian Lunn,Denzil Hill provides this program "as is" and with ;;; all faults. Brian Lunn,Denzil Hill specifically disclaim any ;;; implied warranty of merchantability or fitness for a particular ;;; use. Brian Lunn,Denzil Hill do not warrant that the operation ;;; of the program will be uninterrupted or error free. This ;;; program provides the simpliest way to draw insulation. ;;; ;;; (alert "Insulation.lsp - Copyright (C) 1997 by Brian Lunn, Denzil Hill. Type insul to start.") ;;; Start the program (defun c:INSUL (/) ;;; Drawing Setup (setq osm (getvar "osmode")) (setvar "osmode" 0) ;;; Lead question (initget 1 "w c") (setq q1 (getkword "/nDo you wish to do Wall or Ceiling [W or C]...?")) ;;; Wall (if (= q1 "w") (progn (print "Pick the line that the insulation will follow...?") (setq ss1 (ssget)) (setq a (getreal "What is the insulation thickness...?")) ;;; Figure line lenght (setq sp (cdr (assoc 10 (entget (ssname ss1 0))))) (setq lep (cdr (assoc 11 (entget (ssname ss1 0))))) (setq ysp (cadr sp)) (setq yep (cadr lep)) (setq h (abs (- ysp yep))) ;;; Loop computations (setq div (/ h (* 0.8 a))) (setq div1 (fix div)) ;;;number of loops (setq m (/ div div1)) (setq w (* m a)) ;;;width of one loop ;;; Time to loop (setq counter1 0) (while (< counter1 div1) (setq x0 (car sp)) (setq x1 (+ x0 (* 0.379 a))) (setq x2 (+ x0 (* 0.45 a))) (setq x3 (+ x0 (* 0.5 a))) (setq x4 (+ x0 (* 0.55 a))) (setq x5 (+ x0 (* 0.621 a))) (setq x6 (+ x0 a)) (setq y0 (cadr sp)) (setq y1 (+ y0 (* 0.056 w))) (setq y2 (+ y0 (* 0.100 w))) (setq y3 (+ y0 (* 0.281 w))) (setq y4 (+ y0 (* 0.455 w))) (setq y5 (+ y0 (* 0.545 w))) (setq y6 (+ y0 (* 0.719 w))) (setq y7 (+ y0 (* 0.9 w))) (setq y8 (+ y0 (* 0.944 w))) (setq pt0 sp) (setq pt1 (list x3 y2)) (setq pt2 (list x2 y1)) (setq pt3 (list x0 y3)) (setq pt4 (list x1 y5)) (setq pt5 (list x5 y4)) (setq pt6 (list x6 y6)) (setq pt7 (list x4 y8)) (setq pt8 (list x3 y7)) (command "arc" pt4 pt3 pt2) (command "line" pt1 pt2 "") (command "line" pt4 pt5 "") (command "line" pt7 pt8 "") (command "arc" pt5 pt6 pt7) (setq sp (list (car sp) (+ (cadr sp)(* 0.8 w))(caddr sp))) (setq counter1 (+ counter1 1.0)) ) ) ) ;;; Ceiling (if (= q1 "c") (progn (print "Pick the line that the insulation will follow...?") (setq ss1 (ssget)) (setq a (getreal "What is the insulation thickness...?")) ;;; Figure line length (setq sp (cdr (assoc 10 (entget (ssname ss1 0))))) (setq lep (cdr (assoc 11 (entget (ssname ss1 0))))) (setq xsp (car sp)) (setq xep (car lep)) (setq h (abs (- xsp xep))) ;;; Loop computations (setq div (/ h (* 0.8 a))) (setq div1 (fix div)) ;;;number of loops (setq m (/ div div1)) (setq w (* m a)) ;;;width of one loop ;;; Time to loop (setq counter1 0) (while (< counter1 div1) (setq x0 (car sp)) (setq x1 (+ x0 (* 0.056 w))) (setq x2 (+ x0 (* 0.100 w))) (setq x3 (+ x0 (* 0.281 w))) (setq x4 (+ x0 (* 0.455 w))) (setq x6 (+ x0 (* 0.545 w))) (setq x7 (+ x0 (* 0.719 w))) (setq x8 (+ x0 (* 0.9 w))) (setq x9 (+ x0 (* 0.944 w))) (setq y0 (cadr sp)) (setq y1 (+ y0 (* 0.379 a))) (setq y2 (+ y0 (* 0.45 a))) (setq y3 (+ y0 (* 0.5 a))) (setq y4 (+ y0 (* 0.55 a))) (setq y5 (+ y0 (* 0.621 a))) (setq y6 (+ y0 a)) (setq pt0 sp) (setq pt1 (list x2 y3)) (setq pt2 (list x1 y4)) (setq pt3 (list x3 y6)) (setq pt4 (list x6 y5)) (setq pt5 (list x4 y1)) (setq pt6 (list x7 y0)) (setq pt7 (list x9 y2)) (setq pt8 (list x8 y3)) (command "arc" pt4 pt3 pt2) (command "line" pt1 pt2 "") (command "line" pt4 pt5 "") (command "line" pt7 pt8 "") (command "arc" pt5 pt6 pt7) (setq sp (list (+ (car sp)(* 0.8 w)) (cadr sp) (caddr sp))) (setq counter1 (+ counter1 1.0)) ) ) ) ;;; End of program (setvar "osmode" osm) )