(defun tan (xx)
(/ (sin xx) (cos xx))
)

(defun c:db (/ a b d1 d2 u1 u2 u3 p1 p2)

(setq oerr *error*)
(defun *error* (msg)
(setvar "osmode" osn)
(setq *error* oerr)
(command)
(princ)
)

(setq osn (getvar "osmode"))
(setvar "osmode" 512)
(setq a (getpoint "\n Point on the duct: "))
(setvar "osmode" 128)
(setq b (getpoint a "\n Point on opposite wall of duct: "))
(setq d1 (distance a b))
(setvar "osmode" 512)
(setq u1 (angle a b))
(setq u2 (+ u1 (* pi 0.5)))
(setq u3 (+ u2 (/ pi 3)))
(setq p1 (polar b u2 (* d1 (tan (/ pi 6)))))
(setq d2 (/ (distance a p1) 2))
(setq p2 (polar b u3 d2))
(setvar "osmode" 0)
(command "_.line" a p1 "")
(command "_.line" b p2 "")
(setvar "osmode" osn)
(princ)
)

(prompt "\n Type > db < to draw HVAC duct break: ")
(c:db)

Advertisements