(defun c:lea ()
(setvar "osmode" 512)
 (setq pig (getpoint "LEADER leader start:"))
(setvar "osmode" 0)
 (prompt "\nTo point:")
 (setvar "orthomode" 0)
 (set_layer dim)
 (command "line" pig pause "")
 (setq pi1 (getvar "lastpoint"))
 (setq ang (angtos (angle pig pi1) 0 2))
 (setq sca (getvar "dimscale"))
 (setq dis (* (getvar "dimscale") 1.8))
 (command "insert" "*arr" pig sca ang)
 (prompt "To point:")
 (setvar "orthomode" 1)
 (command "line" "" pause "")
 (setq pi2 (getvar "lastpoint"))
(setq a1 (car pi2) a2 (car pi1) a3 (cadr pi2) a4 (cadr pi1))
(if (> (abs (- a1 a2)) (abs (- a3 a4)))
(setq pi3 (list a1 a4))
(setq pi3 (list a2 a3))
)
(prompt "\nDimension text <")(princ st)(prompt ">:")
(setq st (getstring T ""))
(if (= st "") (setq st st1) (setq st1 st))
(if (> (- a1 a2) 0)
(command "text" "j" "ml" (polar pi3 (angle pi1 pi3) dis) "" "0" st)
(command "text" "j" "mr" (polar pi3 (angle pi1 pi3) dis) "" "0" st)
)(princ)
)
