Jump to content

Change text style of a AutoCAD drawing. Lisp routine will be update the AutoCAD drawing to a specified Style for all text elements in a drawing.This lisp routine will be update the AutoCAD drawing to a specified Style for all text elements in a drawing


Recommended Posts

Posted (edited)

This lisp routine will be update the AutoCAD drawing to a specified Style (NAMEOFSTYLE) for all text elements in a drawing:

 

(defun C:CHANGESTYLE-TEXT-OBJECTS (/ entities len count ent ent_data ent_name new_style_name)
 
(command "STYLE" "NAMEOFSTYLE" "" "" "" "" "" "")
(setq entities (ssget "X" '((0 . "*TEXT")))
      len      (sslength entities)
      count 0
);setq 
 
(while (< count len)
       (setq ent      (ssname entities count) 
             ent_data (entget ent)
             ent_name (cdr (assoc 7 ent_data))
       );setq
 
(setq new_style_name (cons 7 "NAMEOFSTYLE"))
(setq ent_data (subst new_style_name (assoc 7 ent_data) ent_data))
(entmod ent_data)
 
(setq count (+ count 1))
);while
 
;;;runs same routine again, picking up Mtext this time.
 
);defun
               

 

Edited by Remco Koedoot
Posted

Hmm open Properties 1st

 

(defun c:zzz ( / a) 
(setq a (ssget "X" '((0 . "*TEXT"))))
(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "_.Select P  ")
)

 

Can then change lots of stuff. Yes may need the make style 1st.

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...