;-------dtor-----
(defun dtor (x)
   (* pi (/ x 180.0))
)
;--------ko.lsp---------
(defun C:ko ()
(setq p (getpoint "\nPlease insert point:"))
(setq L (getdist p "Please insert end point :"))
(setq d (getreal "\nPlease enter the diameter of the K.O:"))
(setq A (getreal "Please enter the K.O locating angle:"))
(setq B (dtor A))
(setq c 2)
(cond ((= A 0)
      (setq A1 90))
      ((= A 90)
      (setq A1 0))
      ((= A 180)
      (setq A1 270))
      ((= A 270)
      (setq A1 360))
      (t)
)
(setq p1 (polar p (- B pi) L))
(setq p2 (polar p (- B pi)(- L c)))
(setq p3 (polar p (- B pi) c))
(setq tp (polar p (- B pi)(/ L 2)))
(setq p5 (polar p (- B (/ pi 2))(+ (/ d 2) c)))
(setq p4 (polar p (+ B (/ pi 2))(+ (/ d 2) c)))
(setq p7 (polar p3 (- B (/ pi 2))(/ d 2)))
(setq p6 (polar p3 (+ B (/ pi 2))(/ d 2)))
(setq p8 (polar p2 (- B (/ pi 2))(/ d 2)))
(setq p9 (polar p2 (+ B (/ pi 2))(/ d 2)))
(setq p10 (polar p1 (- B (/ pi 2))(+ (/ d 2) c)))
(setq p11 (polar p1 (+ B (/ pi 2))(+ (/ d 2) c)))
(command "line" p5 p7 p8 p10 "")
(command "line" p4 p6 p9 p11 "")
(command "line" p8 p9 "")
(command "line" p6 p7 "")
(command "text" "m" tp 8 A1 "K.O")
(princ)
)
