Originally Posted by
jmcshane
Hi,
I am looking to extract the contents of a piece of mtext.
Would anybody have any ideas why, when using this line of code to select mtext :
(setq AddText (cdr (assoc 1 (entget (car (entsel "nPlease Select Text :"))))))
that it returns a value of : {fArial|b0|i0|c238|p34;C}11 on some pieces of mtext
and in other cases it returns the contents of the text without all without all the stuff
between the {}, which is what I am actually looking for?
I have attached a sample of two pieces of mtext to demonstrate.
Thanks in Advance.
John
Try part of this, I use it to strip text in tables to the default font
Code:
(foreach dp EntDxf
(if (= (car dp) 1)
(if (= (wcmatch (cdr dp) "`{*") T)
(progn
(setq leftside (vl-string-left-trim
"{\\abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ|0123456789 "
(cdr dp)
) ;_ end of vl-string-left-trim
leftside2 (vl-string-left-trim ";" leftside)
rightside (vl-string-right-trim "}" leftside2)
) ;_ end of setq
(setq EntDxf (subst (cons 1 rightside) dp EntDxf))
(entmod EntDxf)
(entupd (cdr (assoc -1 EntDxf)))
) ;end progn
) ;end if
) ;end if
"RIGHTSIDE" is the variabl or part that you want, it contains the text without all that other "junk"