Ok, after further tweaking I have finally got this to produce the results that I want. It may not be pretty and I'm sure that there are many ways to accomplish the same results a different way but , Hey, it works. This routine will allow the user to select a lwpolyline and insert a attributed block and have it keep track of the square footage even if the lwployline is altered. Just place in a "mnl" file and walla.... Now I know that I still have a lot to learn but you have to start somewhere.
(defun c:AreaTag ( / curEnt curObj curPoint square_feet2 label_object plinereactor)
(vl-load-com)
(setq curEnt (car (entsel "\npick space to label: ")))
(setq curObj (vlax-ename->vla-object curEnt)
curArea (vla-get-area curObj)
)
(setq square_feet2 (strcat (rtos (/ (vla-get-area curObj) 144) 2 2 ) " Sq. Ft. "))
(setq curPoint (getpoint "\npick label insertion point: "))
(setvar "attdia" 0)
(setvar "attreq" 0)
(command "-insert" "test" curpoint "" "" "")
(setq entext (entlast))
(chgsqft)
(setq label_object (vla-get-handle (vlax-ename->vla-object (ssname (ssget "l") 0))))
(esq_xdata curEnt "SSA_XDATA" (list '1005) (list (cdr (assoc 5 (entget entext)))))
(setq plinereactor (vlr-object-reactor (list curObj) label_object '((:vlr-modified . print-area))))
(vlr-pers plinereactor)
)
(defun print-area (pline reactor null_list / attributes square_feet_attribute square_feet block_reference)
(setq block_reference (vlr-data reactor) block_reference (handent block_reference) block_reference
(vlax-ename->vla-object block_reference)
)
(setq attributes (vlax-invoke block_reference 'getattributes));;not necessary to change this, but it's easier to read,
(foreach att attributes
(if (eq (vla-get-tagstring att) "SQUARE_FEET");;<<<---change to value your attribute uses
(progn
(setq square_feet (strcat (rtos (/ (vla-get-area pline) 144) 2 2 )))
(setq remove (atof square_feet))
(setq square_feet (strcat (@rtoc remove 2) " Sq. Ft. "))
(vla-put-textstring att square_feet)
)
)
)
)
(defun esq_xdlist (ename rname / data elist)
(setq elist (entget ename (list rname)))
(setq data (cdr (car (cddr (cadr (assoc -3 elist))))))
)
(defun esq_xdata (ename rname l_code l_valeur / xd_list elist xd_type input)
(setq elist (entget ename))
(regapp rname)
(setq xd_list (list '(1002 . "}")))
(repeat (length l_code)
(setq xd_type (car l_code)
l_code (cdr l_code)
input (car l_valeur)
l_valeur (cdr l_valeur)
xd_list (cons (cons xd_type input) xd_list)
)
)
(setq xd_list (cons '(1002 . "{") xd_list))
(setq xd_list (cons rname xd_list))
(setq xd_list (list -3 xd_list))
(setq elist (cons xd_list elist))
(entmod elist)
(prin1)
)
(defun @rtoc (N Prec / Sign Str i j);This section places a "," in the number if applicable
(setq Prec (max 0 Prec)
Sign (if (minusp N) "-" "")
Str (rtos (abs N) 2 Prec)
i (vl-string-search "." Str)
)
(if (not i)(setq i (strlen Str))) ; <-- Here
(setq j i)
(if (zerop (setq i (rem i 3)))(setq i 3))
(while (< i j)
(setq Str (strcat (substr Str 1 i) "," (substr Str (1+ i)))
i (+ i 4)
j (1+ j)
)
)
(strcat Sign Str)
)
(defun changeAtt (ent tag val / entl ins)
(setq ins ent)
(while (and ent
(/= "SEQEND" (cdr (assoc 0 (setq entl (entget ent))))))
(if (and (= (cdr (assoc 0 entl)) "ATTRIB")
(= (cdr (assoc 2 entl)) tag))
(entmod (subst (cons 1 val) (assoc 1 entl) entl)))
(setq ent (entnext ent)))
(entupd ins)
)
(defun chgsqft ()
(cond ((setq sset (ssget "X" '((2 . "TEST") (66 . 1))))
(setq a 0)
(repeat (sslength sset)
(setq ent (ssname sset a)
a (1+ a)
)
(setq remove1 (atof square_feet2))
(setq square_feet2 (strcat (@rtoc remove1 2) " Sq. Ft. "))
(changeAtt ent "SQUARE_FEET" square_feet2) ;<- change value
)
)
)
(princ)
)