Try:
Code:
;SqMetersField
;^C^C^P(or C:SqMetersField (load "SqMetersField.lsp"));SqMetersField
(defun c:SqMetersField (/ ufa actDoc tab obid tpt lin plineReactor)
;| (defun ufa (notifier-object reactor-object parameter-list)
(cond
((vlax-property-available-p notifier-object "Area")
(setq actDoc
(vla-get-ActiveDocument (vlax-get-acad-object)))
(vla-SAVE actDoc)
)
)
) |;
(setvar"cmdecho" 0)
(princ "\nSelect closed Object or Hatch ")
(setq ss (ssget "+.:E:S" '((0 . "lwpolyline,spline,circle,ellipse,hatch"))))
; :E Everything in aperture
; :S Force single object selection only
; The "+." puts (ssget) into "point" mode. It helps the ":S"
; single-mode act just like (entsel) by avoiding implied
; selection windows.
; (if ss
(setq ent (ssname SS 0)
EnTyp (cdr (assoc 0 (entget ent)))
obj (vlax-ename->vla-object ent)
obid (vla-get-objectid obj)
tpt (getpoint"\nSelect Area Text Point: ")
)
(setq lin (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos obid 2 0) ">%).Area \\f \"%lu2%pr3%ps[±, Sq Meters]%ct8[1e-004]%th44\">%"))
(command "mtext" tpt "w" "0" lin "")
(princ)
)