@zph wrote:
I am having issues with editing an Mtext value.
Variable ssText is a selection set containing one MTEXT entity.
Variable ssList is the result of (entget (ssname ssText 0)).
Variable nVal is the new text value.
I've attempted both of the following options without success.
la-object (ssname x 0)) nVal))
Where am I messing up?
number (1) should work
(setq nval "banana")
(if (setq ssText (ssget '((0 . "MTEXT"))))
(repeat (sslength ssText)
(setq ssList (entget (ssname ssText 0)))
(entmod (subst (cons 1 nVal) (assoc 1 ssList) ssList))
(ssdel (ssname ssText 0) ssText)
)
)
One thing though, you don't really need to assign the list to a variable unless you are modifying the entity's definition data many times over. Also, consider DXF 3 (250 characters) when using the above method.
number (2) on the other hand will not work if the variable ssText remains as an Type: Pickset (selection set), instead convert the pickset to a Type: VLA-object.
(if (ssget '((0 . "MTEXT")))
(progn
(vlax-for
x (setq ssText
(vla-get-ActiveSelectionSet
(vla-get-ActiveDocument
(vlax-get-acad-object))))
(vla-put-textstring x nVal)
)
(vla-delete ssText)
)
)
HTH
EDIT: Oh my, I'm 5 posts too late.
EDIT: Saw the attachment just now, please tell us what is the intent after Mtext selection?