Selecting text to change text style

schuler

Usenet Archive
Joined
Jul 14, 2003
Messages
1
Reaction score
0
I am trying to select all text in a drawing and change the style to a predefined style. Not sure how to select only text (ssget?). I am kinda new to Lisping...any help would be appreciated.
Thanks.
 
Just so you know I edit the function, so you'll see a prompt to select, but the utility will do it for you.

 

(ssget "x" '((0 . "TEXT")));select all..

 

 

 

"Rudy Tovar" <> wrote:

I wrote a loonnggg time ago, but it will do what you need. Remember that blocks have to be access another way.

 

 

(defun c:ST (/ a1 a2 n index b1 b2 d1 d2 b3 ww)
  (graphscr)
  (setq #style "?")

 

  (prompt "Select entities to be changed ")
  (terpri)
  (setq a1 (ssget "x" '((0 . "TEXT"))))
  (setq a2 (entsel "\nPoint to entity on target STYLE OR ENTER FOR NEW STYLE:"))   (terpri)   (setq n (sslength a1))   (setq index 0)   (if (= a2 nil)     (setq get 1)   )   (while get     (terpri)     (prompt "Enter new Style <")     (princ #style)     (setq d2 (getstring ">: "))     (terpri)     (setq d2 (strcase d2))     (setq d2 (cons 7 d2))

 

    (setq get nil)
  )

 

  (if a2
    (progn
      (setq b2 (entget (car a2)))

 

      (setq d2 (assoc 7 b2))
    )
  )
  (repeat n
    (setq b1 (entget (ssname a1 index)))     (setq d1 (assoc 7 b1))     (setq b3 (subst d2 d1 b1))     (entmod b3)     (setq index (+ index 1))
  )

 

  (princ)

 

)

 

 

"schuler" <> wrote:

I am trying to select all text in a drawing and change the style to a predefined style. Not sure how to select only text (ssget?). I am kinda new to Lisping...any help would be appreciated.
Thanks.
 
schuler said:
I am trying to select all text in a drawing and change the style to a predefined style. Not sure how to select only text (ssget?). I am kinda new to Lisping...any help would be appreciated.
Thanks.

Try the following I have been using for over 10 years:
(defun c:chgsty
(prompt "GLOBAL TEXT STYLE CHANGE.")
(terpri)
(setvar "cmdecho" 0)
(initget 1 "SE ST ")
(setq G (strcase (substr (getkword "SElection/<STyle>: ")1 2))) (cond ((= G "SE") (setq A (ssget)) (setq B (sslength A)) (initget 1) (setq C (getstring "\nEnter new text style: ")) (extang C) (while (> B 0) (setq B (1- B)) (setq D (ssname A B)) (setq D (entget D)) (setq E (assoc 7 D)) (setq F (cons 7 C)) (setq D (subst F E D)) (setq H (assoc 51 D)) (setq I (cons 51 J)) (entmod (subst I H D)) ) (setq A nil) ) ((or (= G "ST") (= G "")) (initget 1) (setq A (strcase (getstring "\nEnter text style to change: "))) (initget 1) (setq C (getstring "\nEnter new text style: ")) (setq D (entnext)) (extang C) (while D (princ ".") (setq E (entget D)) (if (and (= "TEXT" (cdr (assoc 0 E))) (= A (cdr (assoc 7 E)))) (progn (setq F (assoc 7 E)) (setq G (cons 7 C)) (setq E (subst G F E)) (setq H (assoc 51 E)) (setq I (cons 51 J)) (entmod (subst I H E)) ) ) (setq D (entnext D)) ) ) ) (princ)
)

WE
 
Use the change properies dialog box, select all, and then select the text font and size you want. NO programming required. You can also use a lisp called ssx thats ran froam a command to get items in a drawing like lines, individual block names, circles, text, etc and then erase/change/move/etc as needed. Basically it is a filter ran within an existing autocad command.

either way works for you.
 
Walt said:
Try the following I have been using for over 10 years:

WE

P.S. this is my copyrighted lsp function, but you can have it. It changes all text globally. If you add this to your acad.mnu, you will find it very useful.

WE
 

Latest threads

Back
Top