(defun C:MDIM2 (/ ch el base x1 y1 aa tt off g )
  (defun setup1()
  (setq base (getpoint "\n Select the base point: "))
  (setq x1 (eval (car base)))
  (setq y1 (eval (cadr base)))
  (setq tt (getreal "\n Enter text heigh:"))
  (setq off ( / tt 2))
  (setq el (getreal "\n Enter Line Length : "))
  (setq g (getreal "\n Enter space:"))
  (setq D(getint "\n Enter number of digits:"))
  (defun up1()
     (setq pt2 (osnap (getpoint "\n  Pick up the point to set the dimension:                 ") "endp,int,node"))
     (setq x2 (eval (car pt2)))
     (setq y2 (eval (cadr pt2)))
     (setq x (abs (- x2 x1)))
     (setq pp (list x2 (+ y2 g)))
     (setq p1 (list (+ x2 off) (+ y2 el g g)))
     (setq ang (/ pi 2))
     (setq xval (rtos x 2 D))
     (command "line" pp (polar pp ang el) "")
     (command "text" p1 tt 90 xval)
     (up1)
  )
  (defun right1()
     (setq pt2 (osnap (getpoint "\n Pick up the point to set the dimension:                 ") "endp,int,node"))
     (setq x2 (eval (car pt2)))
     (setq y2 (eval (cadr pt2)))
     (setq y (abs (- y2 y1)))
     (setq yval (rtos y 2 D))
     (setq pp (list (+ x2 g) y2))
     (setq p1 (list (+ x2 el g g) (- y2 off)))
     (setq ang1 (* pi 2))
     (command "line" pp (polar pp ang1 el) "")
     (command "text" p1 tt 0 yval)
      (RIGHT1))
  (defun bottom1()
     (setq pt2 (osnap (getpoint "\n Pick up the point to set the dimension:                 ") "endp,int,node"))
     (setq x2 (eval (car pt2)))
     (setq y2 (eval (cadr pt2)))
     (setq x (abs (- x2 x1)))
     (setq xval (rtos x 2 D))
     (setq pp (list x2 (- y2 g)))
     (setq p1 (list (+ x2 off) (- (- y2 el) g 1)))
     (setq ang (* (/ pi 2) 3))
     (command "line" pp (polar pp ang el) "")
     (command "text" "r" p1 tt 90 xval)
    (bottom1))
  (defun left1()
     (setq pt2 (osnap (getpoint "\n Pick up the point to set the dimension:                 ")  "endp,int,node"))
     (setq x2 (eval (car pt2)))
     (setq y2 (eval (cadr pt2)))
     (setq y (abs (- y2 y1)))
     (setq yval (rtos y 2 D))
     (setq pp (list (- x2 g) y2))
     (setq p1 (list (- (- x2 el) g 1) (- y2 off)))
     (setq ang1 pi)
     (command "line" pp (polar pp ang1 el) "")
     (command "text" "r" p1 tt 0 yval)
     (left1))
   )
)
