@ tuantrinhdp please try this way
I dare to modify MHUPP lisp .
the text size default to actual TEXTSIZE
I change GETINT , for precision, as it shall be an Integer
and setq osmode to 0
And use -boundary , with no options
;;----------------------------------------------------------------------------;;
;; Adds Area text
(defun C:Adds-Area-text (/
A AREA B H LL MAXPT MINPT MPT OSMODE PT TEXTSIZE UR X
)
(vl-load-com)
(setq textsize (getvar 'textsize))
(if (not(setq h (getreal "\nText Height: ")))
(setq h textsize)
)
(setq x (getint "\n Prescision"))
(setq osmode (getvar 'osmode))
(setvar 'osmode 0)
(while (setq pt (getpoint "\nPick Area: "))
;(vl-cmdf "_.-Boundary" "A" "I" "No" "X" "_non" PT "")
(vl-cmdf "_.-Boundary" PT "")
(setq a (entlast))
(setq b (vlax-ename->vla-object a))
(vla-put-closed b :vlax-true)
(setq area (rtos (vla-get-area b) 2 x))
(vla-getboundingbox b 'minpt 'maxpt)
(setq LL (vlax-safearray->list minpt)
UR (vlax-safearray->list maxpt)
MPT (mapcar '/ (mapcar '+ LL UR) '(2 2 2))
)
(entmake (list (cons 0 "TEXT")
(cons 10 MPT)
(cons 11 MPT)
(cons 40 h)
(cons 1 area)
(cons 71 0)
(cons 72 1)
(cons 73 2)
)
)
(entdel a)
);end while
(setvar 'osmode osmode)
(princ)
)
;|«Visual LISP© Format Options»
(100 2 1 2 T " " 100 6 0 0 1 nil T nil T)
;*** DO NOT add text below the comment! ***|;
adds-area-text.lsp
to put text at center area.dwg