;; Draw radius elbow with user difined diameter and radius as diameter fraction
;; Saved from here: http://www.cadtutor.net/forum/showthread.php?6814-Request-for-Lisp-to-draw-Duct-Elbow

(defun C:dc (/ bpt cpt dia pt rad tpt ulp urp x y)
(setvar "cmdecho" 0)

(setq dia (getdist "\nEnter diameter :\n")
rad (getreal "\nEnter duct radius as diameter fraction : \n")
)

(setq pt (getpoint "\nEnter insertion point of duct \n"))
(setq x (car pt)
y (cadr pt)
bpt (list x (- y (/ dia 2)))
tpt (list x (+ y (/ dia 2)))
cpt (list x (+ y (+ (* dia 0.5) (* dia rad))))
ulp (list (+ x (* dia rad)) (+ y (* dia 0.5) (* dia rad)))
urp (list (+ x dia (* dia rad)) (+ y (* dia 0.5) (* dia rad)))
)

(command "arc" "C" cpt tpt ulp "arc" "C" cpt
bpt urp
)

(command "line" tpt bpt "" "line" urp
ulp ""
)

(setvar "cmdecho" 1)
(princ)
)
(C:dc)

Advertisements