(defun C:deed(/ newsty sset numb obj dxfobjlist)
(setvar "cmdecho" 0)
;; newsty is set to string l80 for imput later
;;;be careful here, newsty must be a style that exists and
;;;is also a string value like "L80"
(setq newsty "L80")
;; selection set of objects
(setq sset (ssget '((0 . "TEXT,MTEXT"))))
(setq numb -1)
(repeat (sslength sset)
(setq numb(1+ numb))
;;;(setq obj(entget(ssname sset numb)))
;;;the best thing to do is get the entity name, then the entity list
(setq obj (ssname sset numb));<- entity name
(setq dxfobjlist (entget obj));<-entity dxflist
(setq dxfobjlist (subst (cons 7 newsty) (assoc 7 dxfobjlist) dxfobjlist))
;; need and if text if mtext here
(setq dxfobjlist (subst (cons 62 4) (assoc 62 dxfobjlist) dxfobjlist))
;; and another one here
;;;(progn (setq dxfobjlist(entget obj));<-- this is already a dxf object list,
;;;entget will give error
;;;also, don't need a progn
;;;These IF statements work fine. But, you could combine them together
;;;into one IF statement. Since everything in your selection set is
;;;either TEXT or MTEXT
(if (= "TEXT" (cdr(assoc 0 dxfobjlist)))
;then statement
(progn
(setq str(strcat "("(cdr(assoc 1 dxfobjlist)) ")"))
(setq dxfobjlist(subst (cons 1 str)(assoc 1 dxfobjlist) dxfobjlist))
(entmod dxfobjlist)
)
;;; )
;;; (if (= "MTEXT" (cdr(assoc 0 dxfobjlist)))
;else statement
(progn
(setq str(strcat "("(cdr(assoc 1 dxfobjlist)) ")"))
(setq dxfobjlist(subst (cons 1 str)(assoc 1 dxfobjlist) dxfobjlist))
(entmod dxfobjlist)
)
)
;;;after you ENTMOD the dxf list
;;;you ENTUPD the entity name
;;;(entmod dxfobjlist);<-- already done
(entupd obj);entity update
;(entmod obj);<-- already done,
(setvar "cmdecho" 1)
)
)
You might have to change the color change back to the command function since it won't work with mtext. Also, you can find a list of the DXF codes in Help...Developer Help, DXF Reference.