I update the format of a field inside of an mtext:
Code:
(defun c: putfield ()
(vl-load-com)
(setq elemname (car (entsel "\nSelect Text, MText, or Attributed Block with Field Expression: ")))
(princ "\n")
(setq elemdata (entget elemname))
(setq tval (cdr (assoc 1 elemdata)))
(setq dict (vlax-vla-object->ename (vla-GetExtensionDictionary (vlax-ename->vla-object elemname))))
(setq flst (entget (cdr (assoc 360 (entget (cdr (last (dictnext dict "ACAD_FIELD"))))))))
(setq fexp (cdr (assoc 2 flst)))
(princ (strcat "\nField Expression of Text Value \"" tval "\": " fexp "\n"))
(setq newstr "\\AcObjProp Object(%<\\_ObjIdx 0>%).Area \\f \"%lu2\%ps[, m²]%ct8[0.0001]\"")
(setq flst (subst (cons 2 newstr) (assoc 2 flst) flst))
(entmod flst)
;; (entupd flst)
(entupd elemname)
(vla-update (vlax-ename->vla-object elemname))
(vla-Regen (vla-get-ActiveDocument (vlax-get-acad-object)) acActiveViewport)
;; (command "regen")
(princ)
)
regen or regenall: no change
But the visible value do not change
If i open the mtexteditor and edit the field i can see the new format, if i update the field the new format will be applied.
How can i update the mtext/field?