changing text

Discussion in 'AutoCAD' started by nseyet, Feb 27, 2008.

  1. nseyet

    nseyet Guest

    Is there a way to change single line text to mtext in 2008 AutoCAD?
     
    nseyet, Feb 27, 2008
    #1
  2. There's a lisp below that works on older versions. Don't know about 08.
    --


    MichaelB
    www.michaelbulatovich.ca



    ---------------------------------------------------------------------------

    ;;; Text2MText
    ;;; (c) 1995 CR/LF GmbH, Essen/Germany
    ;;; Custom AutoCAD Programming since 1986
    ;;;
    ;;; CR/LF GmbH -----------
    ;;; Obere Fuhr 27 | CR / | |
    ;;; D-45136 Essen || / LF | |
    ;;; Tel.: ++49 201 254566 || <-------+ |
    ;;; Fax: ++49 201 256669 | -----------
    ;;; CIS: 100015,1632 -----------
    ;;; Internet:
    ;;;
    ;;; This program is copyrighted. It may be distributed freely however.
    ;;;
    ;;; Benefit:
    ;;; This file implements an AutoCAD command to combine selected text lines
    ;;; to a single mtext object.
    ;;;
    ;;; Usage:
    ;;; Load this file with AutoCAD's APPLOAD command.
    ;;; Enter TEXT2MTEXT.
    ;;; Pick the reference text. The mtext object will use this entity's
    ;;; properties including style, text height, layer a.s.o.
    ;;; Select the other text entities to append to the reference text.
    ;;; Done.
    ;;;
    ;;; Restrictions:
    ;;; Select the text to combine by clicking. Using crossing or windowing
    ;;; may result in an unwanted text sequence.
    ;;;

    (defun c:text2mtext (/ dxf ss index ent mtext)
    (defun dxf (tag obj) (cdr (assoc tag obj)))
    (cond
    ((not (setq reftext (car (entsel "Pick reference text"))))
    (princ "Nothing selected"))
    ((not (= (dxf 0 (setq reftext (entget reftext))) "TEXT"))
    (princ "Not a text"))
    ((not (setq ss (ssget)))
    (princ "Nothing selected"))
    (T
    (setq index 0.0
    mtext '((0 . "MTEXT") (100 . "AcDbEntity") (100 . "AcDbMText"))
    mtext (append mtext
    (list (assoc 8 reftext) (assoc 10 reftext)
    (assoc 7 reftext) (assoc 40 reftext)
    (cons 41 (abs (- (caar (textbox reftext))
    (caadr (textbox reftext)))))
    (cons 3 (strcat (dxf 1 reftext) "\\P"))))
    )
    (entdel (dxf -1 reftext))
    (repeat (sslength ss)
    (cond ((not
    (= (dxf 0 (setq ent (entget (ssname ss index)))) "TEXT")
    )
    (princ "Non-text ignored")
    )
    (T (setq mtext (append mtext
    (list (cons 3 (strcat (dxf 1 ent) "\\P")))))
    (entdel (dxf -1 ent))
    )
    )
    (setq index (1+ index))
    )
    (entmake (append mtext '((1 . " "))))
    )
    )
    (princ)
    )
     
    Michael Bulatovich, Feb 27, 2008
    #2
  3. nseyet

    Mr. B Guest

    If he's loaded the Express Tools in 2008, there will be a TXT2MTXT command
    under:
    Express
    Text
    Convert Text to MText

    Regards,

    BruceF
     
    Mr. B, Feb 27, 2008
    #3
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.