Converting text styles?

Discussion in 'AutoCAD' started by The Real JD, Feb 9, 2005.

  1. The Real JD

    The Real JD Guest

    Using AutoCAD 2000i...

    is there a scriptable way (or thru lisp) to take text styles in a drawing
    and convert them to another text style.. ie:

    i have text style

    ET25, & SYM25 that i want to convert to CW-25

    I guess i'm looking for something similar to the -laytrans command but for
    text styles.
    Any help would be appreciated. Thx!
     
    The Real JD, Feb 9, 2005
    #1
  2. The Real JD

    Walt Engle Guest

    Try the following:

    ; CHGSTY.LSP
    ; CHANGES text GLOBALLY
    (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)
    )
     
    Walt Engle, Feb 9, 2005
    #2
  3. The Real JD

    Gary Fowler Guest

    ; error: no function definition: EXTANG

    Gary
     
    Gary Fowler, Feb 9, 2005
    #3
  4. The Real JD

    Gary Fowler Guest

    ; error: no function definition: EXTANG

    Gary
     
    Gary Fowler, Feb 9, 2005
    #4
  5. The Real JD

    The Real JD Guest

    Walt,

    I got the same error...

    Using AutoCAD 2000i
     
    The Real JD, Feb 9, 2005
    #5
  6. The Real JD

    LINEABOVE Guest

    Question.
    I have found that when I use Mtext and do a "serious" purge, Text Styles
    which that are contained within Mtext are deleted. The Mtext is OK until I
    wish to edit. Then autocad complains that the text style cannot be found.

    Your lisp file interested me.
    When I run this lisp I get about 10 blank spaces at the Top of the List.

    Any idea how I can return the Text Style so that Mtext can find them
    OR
    How can I delete totally the reference to the missing styles ?
     
    LINEABOVE, Feb 11, 2005
    #6
  7. The Real JD

    T.Willey Guest

    I don't use mtext, so I have never seen the problem you mention. If you wouldn't mind posting an example, I would love to see this.

    One way might be to search for all the mtext entitys, compare the style of them to the style collection, which ever don't match, assign a style that is in the collection and change the layer or color so you know which ones were changed.

    Just a thought.
    Tim
     
    T.Willey, Feb 11, 2005
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.