(defun c:stopbolt()
(setq F (getvar "blipmode")) (setvar "blipmode" 0)
(setq p (getpoint "\n Insert point:"))
(setq D (getreal "\n Enter diameter [10] [13] [16] [20] [25]:"))
(setq A (getreal "Enter angle:"))
(setq B (* pi (/ A 180)))
(if (= D 10)
 (progn
  (setq D1 16) (setq D2 6) (setq L1 17) (setq D3 5) (setq L2 0.5)
  (setq L (getreal "Enter shoulder length [10] [15] [20]:"))
  (if (= L 10) 
   (setq E (getreal "Enter screw length [19] [24]:")))
  (if (= L 15)
   (setq E (getreal "Enter screw length [19] [24] [29]:")))
  (if (= L 20)
   (setq E (getreal "Enter screw length [19] [24] [29] [34]:")))
 ))
(if (= D 13)
 (progn
  (setq D1 18) (setq D2 8) (setq L1 20) (setq D3 6.6) (setq L2 0.7)
  (setq L (getreal "Enter shoulder length [10] [15] [20] [25] [30] [35]:"))
  (if (= L 10)
   (setq E (getreal "Enter screw length [22] [27]:")))
  (if (= L 15)
   (setq E (getreal "Enter screw length [27] [32]:")))
  (if (= L 20)
   (setq E (getreal "Enter screw length [27] [32] [37]:")))
  (if (= L 25)
   (setq E (getreal "Enter screw length [27] [32] [37] [42]:")))
  (if (= L 30)
   (setq E (getreal "Enter screw length [27] [32] [37] [42] [47]:")))
  (if (= L 35)
   (setq E (getreal "Enter screw length [37] [42] [47]:")))
 ))
(if (= D 16)
 (progn
  (setq D1 24) (setq D2 10) (setq L1 23) (setq D3 8.4) (setq L2 0.8)
  (setq L (getreal "Enter shoulder length [15] [20] [25] [30] [35] [40]:"))
  (if (= L 15)
   (setq E (getreal "Enter screw length [30] [35]:")))
  (if (= L 20)
   (setq E (getreal "Enter screw length [30] [35] [40]:")))
  (if (= L 25)
   (setq E (getreal "Enter screw length [30] [35] [40] [45]:")))
  (if (= L 30)
   (setq E (getreal "Enter screw length [30] [35] [40] [45] [50]:")))
  (if (= L 35)
   (setq E (getreal "Enter screw length [40] [45] [50]:")))
  (if (= L 40)
   (setq E (getreal "Enter screw length [30] [35] [40] [45] [50] [55]:")))
 ))
 (if (= D 20)
  (progn
   (setq D1 27) (setq D2 12) (setq L1 26) (setq D3 10) (setq L2 1.0)
  (setq L (getreal "Enter shoulder length [20] [25] [30] [35] [40] [50]:"))
  (if (= L 20)
   (setq E (getreal "Enter screw length [38] [43]:")))
  (if (= L 25)
   (setq E (getreal "Enter screw length [38] [43] [48]:")))
  (if (= L 30)
   (setq E (getreal "Enter screw length [38] [43] [48] [53]:")))
  (if (= L 35)
   (setq E (getreal "Enter screw length [43] [48] [53]:")))
  (if (= L 40)
   (setq E (getreal "Enter screw length [38] [43] [48] [53] [58]:")))
  (if (= L 50)
   (setq E (getreal "Enter screw length [38] [43] [48] [53] [58] [63]:")))
 ))
 (if (= D 25)
  (progn
   (setq D1 33) (setq D2 16) (setq L1 32) (setq D3 13.8) (setq L2 1.1)
  (setq L (getreal "Enter shoulder length [20] [25] [30] [35] [40] [50]:"))
  (if (= L 20)
   (setq E (getreal "Enter screw length [44] [49]:")))
  (if (= L 25)
   (setq E (getreal "Enter screw length [44] [49] [54]:")))
  (if (= L 30)
   (setq E (getreal "Enter screw length [44] [49] [54] [59]:")))
  (if (= L 35)
   (setq E (getreal "Enter screw length [49] [54] [59]:")))
  (if (= L 40)
   (setq E (getreal "Enter screw length [44] [49] [54] [59] [64]:")))
  (if (= L 50)
   (setq E (getreal "Enter screw length [44] [49] [54] [59] [64] [69]:")))
 ))
(setq Ds (getreal "Enter desired stroke:"))
(setq D4 (+ D1 2))
(setq D5 (+ D 2))
(setq p1 (polar p (+ B pi) L))
(setq p2 (polar p1 (+ B pi) 8))
(setq p3 (polar p B E))
(setq p4 (polar p3 (+ B pi) L2))
(setq p5 (polar p3 (+ B pi) L1))
(setq p6 (polar p (+ B (/ pi 2)) (* 0.5 D2)))
(setq p7 (polar p (- B (/ pi 2)) (* 0.5 D2)))
(setq p8 (polar p (+ B (/ pi 2)) (* 0.5 D)))
(setq p9 (polar p (- B (/ pi 2)) (* 0.5 D)))
(setq p10 (polar p1 (+ B (/ pi 2)) (* 0.5 D)))
(setq p11 (polar p1 (- 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 p2 (+ B (/ pi 2)) (* 0.5 D1)))
(setq p15 (polar p2 (- B (/ pi 2)) (* 0.5 D1)))
(setq p16 (polar p3 (+ B (/ pi 2)) (* 0.5 D3)))
(setq p17 (polar p3 (- B (/ pi 2)) (* 0.5 D3)))
(setq p18 (polar p4 (+ B (/ pi 2)) (* 0.5 D2)))
(setq p19 (polar p4 (- B (/ pi 2)) (* 0.5 D2)))
(setq p20 (polar p5 (+ B (/ pi 2)) (* 0.5 D3)))
(setq p21 (polar p5 (- B (/ pi 2)) (* 0.5 D3)))
(setq p22 (polar p5 (+ B (/ pi 2)) (* 0.5 D2)))
(setq p23 (polar p5 (- B (/ pi 2)) (* 0.5 D2)))
(setq p24 (polar p22 (+ B pi) L2))
(setq p25 (polar p23 (+ B pi) L2))
(setq p26 (polar p (+ B (/ pi 2)) (* 0.5 D5)))
(setq p27 (polar p (- B (/ pi 2)) (* 0.5 D5)))
(setq p28 (polar p8 (+ B pi) (- L Ds)))
(setq p29 (polar p9 (+ B pi) (- L Ds)))
(setq p30 (polar p26 (+ B pi) (- L Ds)))
(setq p31 (polar p27 (+ B pi) (- L Ds)))
(setq p32 (polar p28 (+ B (/ pi 2)) (* 0.5 (- D4 D))))
(setq p33 (polar p29 (- B (/ pi 2)) (* 0.5 (- D4 D))))
(setq p34 (polar p32 (+ B pi) (+ 8 Ds)))
(setq p35 (polar p33 (+ B pi) (+ 8 Ds)))
(command "line" p14 p12 p13 p15 "C" "")
(command "line" p10 p8 p9 p11 "")
(command "line" p6 p18 p16 p17 p19 p7 "")
(command "line" p16 p20 p24 "")
(command "line" p17 p21 p25 "")
(command "line" p18 p19 "")
(command "line" p22 p23 "")
(command "line" p26 p30 "")
(command "line" p27 p31 "")
(command "line" p28 p32 p34 "")
(command "line" p29 p33 p35 "")
(setvar "blipmode" F))
