(defun c:epinb()
(setq F (getvar "blipmode")) (setvar "blipmode" 0)
(setq p (getpoint "\n Insert point:"))
(setq D (getreal "\n Enter epinb diameter [0.1-6]:"))
(setq L (getreal "\n Enter epinb length:"))
(setq N (getreal "\n Enter working length:"))
(setq A (getreal "\n Enter epinb angle:"))
(setq B (* pi (/ A 180.0)))
(if (and (> D 0) (<= D 2.0))
 (progn (setq D1 3.0) (setq H 4.0) (setq D2 6.0)))
(if (and (> D 2.0) (<= D 2.5))
 (progn (setq D1 4.0) (setq H 6.0) (setq D2 8.0)))
(if (and (> D 2.5) (<= D 3.5))
 (progn (setq D1 6.0) (setq H 6.0) (setq D2 10.0)))
(if (and (> D 3.5) (<= D 4.5))
 (progn (setq D1 8.0) (setq H 8.0) (setq D2 13.0)))
(if (and (> D 4.5) (<= D 6.0))
 (progn (setq D1 10.0) (setq H 8.0) (setq D2 15.0)))
(setq D3 (+ 1 D2))
(setq R 2.0)
(setq X (sqrt (- 4 (expt (- (+ (* 0.5 D) 2) (* 0.5 D1)) 2))))
(setq p1 (polar p B H))
(setq p2 (polar p B L))
(setq p3 (polar p2 (- B pi) N))
(setq p22 (polar p3 B (* -1 X)))
(setq p4 (polar p3 (+ B (/ pi 2)) (* 0.5 D)))
(setq p5 (polar p3 (- B (/ pi 2)) (* 0.5 D)))
(setq p6 (polar p3 (+ B (/ pi 2)) (+ 2 (* 0.5 D))))
(setq p7 (polar p3 (- B (/ pi 2)) (+ 2 (* 0.5 D))))
(setq p8 (polar p22 (+ B (/ pi 2)) (* 0.5 D1)))
(setq p9 (polar p22 (- B (/ pi 2)) (* 0.5 D1)))
(setq p10 (polar p2 (+ B (/ pi 2)) (* 0.5 D)))
(setq p11 (polar p2 (- B (/ pi 2)) (* 0.5 D)))
(setq p12 (polar p1 (+ B (/ pi 2)) (* 0.5 D1)))
(setq p13 (polar p1 (- B (/ pi 2)) (* 0.5 D1)))
(setq p14 (polar p1 (+ B (/ pi 2)) (* 0.5 D2)))
(setq p15 (polar p1 (- B (/ pi 2)) (* 0.5 D2)))
(setq p16 (polar p1 (+ B (/ pi 2)) (* 0.5 D3)))
(setq p17 (polar p1 (- B (/ pi 2)) (* 0.5 D3)))
(setq p18 (polar p (+ B (/ pi 2)) (* 0.5 D2)))
(setq p19 (polar p (- B (/ pi 2)) (* 0.5 D2)))
(setq p20 (polar p (+ B (/ pi 2)) (* 0.5 D3)))
(setq p21 (polar p (- B (/ pi 2)) (* 0.5 D3)))
(command "line" p20 p16 p17 p21 "")
(command "line" p18 p14 "")
(command "line" p19 p15 "")
(command "line" p12 p8 p9 p13 "")
(command "line" p4 p10 p11 p5 "")
(command "arc" p8 "C" p6 p4)
(command "arc" p5 "C" p7 p9)
(setvar "blipmode" F))
