;Tip1734: TDN.LSP Ductwork turndown (c)2001, Paul Bilodeau

(defun C:TDN ()
(setvar "cmdecho" 0)
(setq COSMODE (getvar "osmode"))
(setq CLY (getvar "CLAYER"))
(setvar "osmode" 0)
(setvar "osmode" 1)
(setq CPT (getpoint "\nPick ENDPOINT of Line: "))
(setq LNENT (nentselp CPT))
(setvar "osmode" 0)
(setq LNDATA (entget (car LNENT)))
(setq C10 (cdr (assoc 10 LNDATA)))
(setq C11 (cdr (assoc 11 LNDATA)))
(if (equal C10 CPT)
(setq ANG (angle CPT C11))
(setq ANG (angle CPT C10))
)
(if (equal ARAD NIL)
(setq CRAD 0)
(setq CRAD ARAD))
(initget 6)
(setq ARAD (getreal (strcat
"\nRadius of Turndown: : ")))
(if (= ARAD NIL)
(setq ARAD CRAD))
(setq STANG (+ ANG (/ pi 4)))
(setq APT1 (polar CPT STANG ARAD))
(setvar "CLAYER" (cdr (assoc 8 LNDATA)))
(command "_.arc" APT1 "C" CPT "A" 270)
(setvar "osmode" COSMODE)
(setvar "CLAYER" CLY)
(princ)
) ;ends defun

Advertisements