ElAmigo Posted March 28 Posted March 28 (edited) Hello friends, I have the following code which sets all textstyles of all text and mtext in the model to Company: (defun c:ChangeAllTextStyles (/ ss obj entData) (setq ss (ssget "X" '((0 . "TEXT,MTEXT")))) ;; Select all TEXT and MTEXT objects in the drawing (if ss ;; If text objects are found (progn (repeat (sslength ss) ;; Iterate through each object in the selection set (setq obj (ssname ss 0)) ;; Get the object (setq entData (entget obj)) ;; Get the entity data (setq entData (subst (cons 7 "Company") (assoc 7 entData) entData)) ;; Change the text style to "Company" (entmod entData) ;; Apply the modification (ssdel obj ss) ;; Remove the object from the selection set ) (princ "\nAll text styles have been updated to 'Company'.") ) (princ "\nNo text objects found.") ) (princ) ;; Clean up the screen upon completion ) However, some text doesnt get the right font. When I click on it the text contents start with: \fArial|b0|i0; and then the actual text content. It gets removed when I change the text style manually but I couldn't get it fixed in my lisp. I hope someone can help. Edited March 28 by ElAmigo Quote
Steven P Posted March 28 Posted March 28 That is usually because the font was changed in the text editor rather than properties - you can use something like strip m text or look at Lee Mac to remove text formatting Quote
ElAmigo Posted March 28 Author Posted March 28 58 minutes ago, Steven P said: That is usually because the font was changed in the text editor rather than properties - you can use something like strip m text or look at Lee Mac to remove text formatting Thank you! I did a quick google search and found this: https://cadabyss.wordpress.com/2010/01/04/stripmtext-v5-0/. The download on this site doesn't work. And then I found the reply by Devitg on this forum: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/stripmtext-v5-0-lisp-routine/td-p/2673838 Then I could apply the code with: (defun c:striptest ( / ss) (setq ss (ssget "X" '((0 . "MTEXT")))) ;; Select all TEXT and MTEXT objects in the drawing (if ss (STRIPMTEXT ss "F") ) ) 1 Quote
Steven P Posted March 28 Posted March 28 (edited) Perfect! Stripmtext is a handy little tool Edited March 28 by Steven P Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.