(defun c:mdim()
(defun setup()
(setq ch (getstring
"\n where will you put the dimension,(u)p or (r)dght side? "))
(setq el (getreal "extension line Length : "))
(setq base (gerpoint "\n select the base point: "))
(setq x1 (eval (car base)))
(setq y1 (eval (cadr base)))
(setq aa (getint "choice decimal point <0-3>"))

(setq off ( / tt 2))
(setq g (getreal "\n DISTANCE BETWEEN EXT. AND POINT : "))
 (command "style" "" "" tt "" "" "" "" "")
(if (or (eq ch "u")
(eq ch "U")) (up) (right)))
(defun up()
(setq pt2 (getpoint "\n pick up the point to set the dimension: "))
(setq x2 (eval (car pt2)))
(setq y2 (eval (cadr pt2)))
(setq x (abs (- x2 x1)))
setq xt (fix x))
setq xtd (fix (* (-x xt) 10000)))
(if (>= xtd 1000) (setq k "."))
(if (and (< xtd 1000) (> xtd 99)) (setq k ".0"))
(if (and (< xtd 100) (> xtd 9)) (setq k ".00"))
(if (< xtd 10) (setq k ".000"))
(setq xt1 (itoa xt))
(setq xt2 (itoa xtd))
(setq xval (getstring (strcat "\n TEXT<" xt1 k xt2 "> :")))
(if (eq xval "") (setq xval (rtos x aa )))
(setq pp (list x2 (+ y2 2)))
(setq p1 (list (+ x2 off) (+ y2 el g g)))
(setq ang (/ pi 2))
(command "line" pp (polar pp ang el) "")
(command "text" pl 90 xval)
(setq s (getstring "\n do you want to continue it <y>? "))
(while (or (eq s "") (eq s "y") (eq s "Y")) (up))                          )

                                                                       (defun right()
(setq pt2 (getpoint "\n pick up the point to set the dimension: "))
(setq x2 (eval (car pt2)))
(setq y2 (eval (cadr pt2)))
(setq y (abs (- y2 y1)))
(setq yt (fix y))
(setq ytd (fix (* (- y yt) (10000)))
(if (>= ytd 1000) (set  l "."))
(if (and (< ytd 1000 ) (> ydt 99)) (setq l ".0"))
(if (and (< ytd 100) (< ytd 9)) (setq l ".00"))
(if (< ytd 10) (setq l ".000"))
(setq yt1 (itoa yt))
(setq yt2 (itoa ytd))
(setq yval (getstring (strcat "\n TEXT<" yt1 l yt2 "> :")))
(if (eq yval "") (setq yval (rtos y 2 aa)))
(setq pp (list (+ x2 2) y2))
(setq p1 (list (+ x2 el g g) (- y2 off)))
(setq angl (* pi 2))
(command "line " pp (polar pp angl el) "")
(command "text " p1 0 yval)
(setq s (getstring "\n do you want to continue it <y>? "))
(while (or (eq s "") (eq s "y") (eq s"Y")) (right))                      )         
(defun c:vdim ()
(defun setup  ()
(setq ch (getstring                                                             "\n where will you put the dimension,(B)ttom or (L)eft side? "))
(setq el (getreal "Extention line lenght : "))
(setq base (getpoint "\n select the base point: "))
(setq x1 (eval (car base)))
(setq y1 (eval (cadr base)))
(setq aa (getint "choice decimal point <0-3>"))
(setq tt (getreal "\n TEXT HEIGET: "))
(setq off ( / tt 2))
(setq g  (getreal '\n DISTANCE BETWEEN EXT. AND POINT :"))
(COMMAND "style" "" "" tt "" "" "" "" "" )
(if (or (eq ch "B") (eq ch "b")) (bottom) (left))                              )
(defun bottom()
(setq pt2 (getpoint "\n pick up the point to the set the dimension: "))
(setq x2 (eval (car pt2)))
(setq y2 (eval (cadr pt2)))
(setq x (abs (- x2 x1 )))
(setq xt (fix x))
(setq xtd (fix (* (- x xt) 10000)))
(if (>= xtd 1000) (setq k "."))
(if (and (< xtd 1000) (> xtd 99)) (setq k ".0"))
(if (and (< xtd 100) (> xtd 9)) (setq k ".00"))
(if (< xtd 10) (setq k ".000"))
(setq xt1 (itoa xt))
(setq xt2 (itoa xtd))
(setq xval (getstring (strcat "\n TEXT<"xt1 k xt2 "> :")))
(if (eq xval "") (setq xval (rtos x 2 aa)))
(setq pp (list x2 (- y2 2)))
(setq p1 (list (+ x2 off) (- x2 el g g)))
(setq ang (* (/ pi 2) 3))
(command "line" pp (polar pp ang el) "")
(command "text" "r" p1 90 xval)
(setq s (getstring "\n do you want to contiune it <Y>? "))
(while (or (eq s "") (eq s "Y") (eq s "Y")) (bottom))                   )                                                                               (defun left()
(setq pt2 (getpoint "\n pick up the point to set the dimension: "))
(setq x2 (eval (car pt2)))
(setq y2 (eval (cadr pt2)))
(setq y (abs (- y2 y1)))
(setq yt (fix y))
(setq ytd (fix (* (- y yt) ( 10000)))
(if (>= ytx 1000) (setq L "."))
(if (and (< ytd 1000) (> ytd 99)) (setq L ".0"))
(if (and (< ytd 100) (> ytd 9 )) (setq L ".00"))
(if (< ytd 10) (setq L ".000"))
(setq yt1 (itoa yt))
(setq yt2 (itoa ytd))
(setq yval (getstring (strcat "\n TEXT<" yt1 l yt2 "> :")))
(if (eq yval "") (setq yval (rtos y 2 aa)))
(setq pp (list (- x2 2) y2))
(setq p1 (list (- x2 el g g) (- y2 off)))
(setq angl pi)
(command "line" "r" pp (polar pp angl el) "')
(command "text" "r" p1 0 yval)
(setq s (getstring "\n do you want to continue it <Y>? "))
(while (or (eq s "") (eq s "y") (eq s "Y")) (left))                         )                                                                               (setup)                                                                    ) 

