lisp routine to combine mtext to mtext

Discussion in 'AutoCAD' started by Redtfeldt, Nov 19, 2004.

  1. Redtfeldt

    Redtfeldt Guest

    does anyone have a way to combine mtext to mtext thus ending up with all the mtext into one editing box?
     
    Redtfeldt, Nov 19, 2004
    #1
  2. Redtfeldt

    C Witt Guest

    I just glanced at the code.. and i don't think that will do what the OP
    wants..

    all that lisp does is:
    combine dtext strings into one mtext
    or
    add dtext to an existing mtext..

    i don't think it will combine existing mtext objects.. (but like i said
    i just glanced at it)
     
    C Witt, Nov 19, 2004
    #2
  3. Redtfeldt

    Redtfeldt Guest

    I couldn't get it to add dtext to and existing mtext.
     
    Redtfeldt, Nov 19, 2004
    #3
  4. Redtfeldt

    C Witt Guest

    there is a lisp "DTR" missing..
     
    C Witt, Nov 19, 2004
    #4
  5. Redtfeldt

    John Uhden Guest

    (defun C:MTJOIN ( / *error* cmdecho E Obj1 Obj2)
    ;; By John Uhden (11-20-04) dedicated to "Redtfeldt"
    ;; Note: this is a very simplistic version with
    ;; no accounting for missed picks, no (while) loops,
    ;; and no locked layer checking.
    (gc)
    (vl-load-com)
    (or *acad* (setq *acad* (vlax-get-acad-object)))
    (or *doc* (setq *doc* (vla-get-ActiveDocument *acad*)))
    (defun *error* (error)
    (if (vl-position cmdecho '(0 1))(setvar "cmdecho" cmdecho))
    (sssetfirst nil nil)
    (vla-endundomark *doc*)
    (cond
    ((not error))
    ((wcmatch (strcase error) "*QUIT*,*CANCEL*"))
    (1 (princ (strcat "\nERROR: " error)))
    )
    (princ)
    )
    (vla-endundomark *doc*)
    (vla-startundomark *doc*)
    (setq cmdecho (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (command "_.expert" (getvar "expert"))
    (sssetfirst)
    (and
    (setq E (entsel "\nSelect 1st Mtext: "))
    (setq E (car E))
    (sssetfirst nil (ssadd E))
    (setq Obj1 (vlax-ename->vla-object E))
    (or
    (vlax-property-available-p Obj1 'TextString)
    (prompt " Object is not a text object.")
    )
    (setq Obj2 (entsel "\nSelect 2nd Mtext: "))
    (setq Obj2 (car Obj2))
    (setq Obj2 (vlax-ename->vla-object Obj2))
    (cond
    ((equal Obj2 Obj1)
    (prompt " Same object selected.")
    )
    ((vlax-property-available-p Obj2 'TextString) 1)
    (1 (prompt " Object is not a text object."))
    )
    (progn
    (vlax-put Obj1
    'TextString
    (strcat
    (vlax-get Obj1 'TextString)
    (vlax-get Obj2 'TextString)
    )
    )
    (vla-delete Obj2)
    )
    )
    (*error* nil)
    )





    mtext into one editing box?
     
    John Uhden, Nov 20, 2004
    #5
  6. Redtfeldt

    Redtfeldt Guest

    It works great! Thank you!

    I checked out your site alittle and It looks like you have some great stuff there too!

    Thanks again!

    Brian
     
    Redtfeldt, Nov 22, 2004
    #6
  7. Redtfeldt

    John Uhden Guest

    You're welcomed, Brian. Glad to have helped.

    Care to explain what "Redtfeldt" means?
     
    John Uhden, Nov 23, 2004
    #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.