(defun c:dat1 (/ x1 x2 p1 p2 p3 p4 p5 p6 p7 dimsc dimtx txhig txhi txh x y olderr txsty)
  (setq	olderr	*ERROR*
	*error*	ai_abort)
  (setvar "mirrtext" 0)
  (setvar "cmdecho" 0)
  (setq dimsc (getvar "dimscale"))
  (setq dimtx (getvar "dimtxt")
	txsty (getvar "textstyle"))
  (setq txhig (* dimsc dimtx)
        txhi (/ txhig 1.5)
        txh (* txhi 0.8))
  (setq y (* 3 txhi)
        x (* 8 txhi))
  (setq p6 (getpoint "select first point of the leader:")
	p7 (getpoint p6 "select second point of the leader:")
	x1 (car p6)
	x2 (car p7))
  (command "-style" "my" "txt" "" "1" "0" "" "" "")
  (if (> x2 x1)
   (progn
  (setq p1 (list (+ (car p7) (* 0.8 txhi)) (- (cadr p7) (* 1.2 txhi))))
  (setq p2 (list (+ (CAR p1) x) (cadr p1)))
  (setq p3 (list (car p1) (- (cadr p1) y)))
  (setq p4 (list (+ (car p1) (* 1.2 txhi)) (- (cadr p1) txhi))
        p5 (list (+ (car p1) (* 0.3 txh)) (- (cadr p4) (* 0.4 txh))))
  (command "text" "j" "tl" p5 txhig "0" "DATUM" ""))
    (progn
      (setq p1 (list (- (car p7) (* 0.8 txhi)) (- (cadr p7) (* 1.2 txhi))))
      (setq p2 (list (- (CAR p1) x) (cadr p1)))
      (setq p3 (list (car p1) (- (cadr p1) y)))
      (setq p4 (list (- (car p1) (* 1.2 txhi)) (- (cadr p1) txhi))
            p5 (list (- (car p1) (* 0.3 txh)) (- (cadr p4) (* 0.4 txh))))
      (command "text" "j" "tr" p5 txhig "0" "DATUM" "")
  )
  )
  (command "qleader" p6 p7 "" "" "OFFSET" "" "")
  (command "line" p3 p1 p2 "")
  (command "rectang" p1 p4)
  (setvar "textstyle" txsty)
  (setq *error* olderr)
  (princ)
)