Hi ,
Hope this would help you with your aim of the code .
Code:
(defun c:Test (/ *error* l ss st vl e gr p)
(vl-load-com)
;;; Tharwat 11. Feb. 2013 ;;;
(defun *error* (x)
(if e
(entdel e)
)
(princ "*Cancel*")
)
(if
(and
(setq l
(not
(eq 4
(logand
4
(cdr
(assoc 70
(entget (tblobjname "LAYER" (getvar 'clayer)))
)
)
)
)
)
)
(progn (print "Select Dimension...")
(setq ss (ssget "_+.:S" '((0 . "*DIMENSION"))))
)
)
(progn
(setq st (vla-get-measurement
(setq vl (vlax-ename->vla-object (ssname ss 0)))
)
)
(setq
e (entmakex (list '(0 . "TEXT")
(cons 10 (setq p (cadr (grread t 15 0))))
(cons 11 p)
(cons 1 (rtos st 2))
(cons 8 (vla-get-layer vl))
(cons 40 (vla-get-textheight vl))
)
)
)
(while (eq (car (setq gr (grread t 15 0))) 5)
(redraw)
(entmod
(subst (cons 10 (cadr gr)) (assoc 10 (entget e)) (entget e))
)
)
)
(cond ((not l) (princ "\n Current layer is locked !!"))
(t (princ "\n Nothing selected or not a dimension !!"))
)
)
(princ "\n Written by Tharwat Al Shoufi")
(princ)
)