Here goes:
Code:
(vl-load-com)
(defun c:FLD2TXT (/ ss n bn an ad s)
(prompt
"Select the objects you wish to remove the field links from: "
) ;_ end of prompt
(setq ss (ssget '((0 . "INSERT,MTEXT,DIMENSION,TEXT,MULTILEADER")))) ;Get selection set from user
(setq n 0) ;Initialize counter
;; Step through selection set one entity at a time
(while (< n (sslength ss))
(setq bn (ssname ss n)) ;Get the nth entity in the selection set
(setq ad (entget bn)) ;Get the entity's data
(cond
((= "INSERT" (cdr (assoc 0 ad))) ;Check if block
(setq an (entnext bn)) ;Get the next enity after bn
;; Step through each next entity until it is not an attribute
(while (and an ;Check if entity is found
(setq ad (entget an)) ;Get data
(= "ATTRIB" (cdr (assoc 0 ad))) ;Check if attribute
) ;_ end of and
(setq s (cdr (assoc 1 ad))) ;Get text value
(entmod (list (assoc -1 ad) (cons 1 ""))) ;Modify the entity
(entmod (list (assoc -1 ad) (cons 1 s))) ;Modify the entity
(entupd an) ;Update screen to show change
(setq an (entnext an)) ;Get next entity
) ;_ end of while
)
((= "MULTILEADER" (cdr (assoc 0 ad))) ;Check if block
(setq ad (vlax-ename->vla-object bn)
s (vla-get-TextString ad)
)
(vla-put-TextString ad "")
(vla-put-TextString ad s)
)
;; Anything else
(t
(setq s (cdr (assoc 1 ad))) ;Get text value
(entmod (list (assoc -1 ad) (cons 1 ""))) ;Modify the entity
(entmod (list (assoc -1 ad) (cons 1 s))) ;Modify the entity
(entupd an) ;Update screen to show change
)
)
(setq n (1+ n)) ;Increment counter
) ;_ end of while
(setq ss nil) ;Clear selection set
(gc) ;Clear unused memory
(princ)
) ;_ end of defun
It should now also work for Multileaders and Annotative Text.