Results 1 to 5 of 5

Thread: Insert a line feed in Mtext

  1. #1
    100 Club mikehaff's Avatar
    Join Date
    2010-10
    Posts
    197
    0 Did you find this post helpful? Yes

    Default Insert a line feed in Mtext

    I am trying to add a line feed to MTEXT.

    The existing mtext looks like this: 10000

    I want the resulting text to look like this: 10000
    OEL CD

    If I look at existing mtext that already has two lines the assoc 1 list is (1 . "10000\\POELCD").
    However building the string in lisp with the "\\P" does nothing.

    How can I accomplish this? I have been all over the web and found nothing that helps.

  2. #2
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    3,965
    0 Did you find this post helpful? Yes

    Default Re: Insert a line feed in Mtext

    Code:
    (defun c:FOO  (/ e v)
      (vl-load-com)
      (if (and (setq e (car (entsel)))
               (setq v (vlax-ename->vla-object e))
               (wcmatch (vla-get-objectname v) "AcDbMText,AcDbMText"))
        (vla-put-textstring
          (setq v (vlax-ename->vla-object e))
          (strcat (vla-get-textstring v) "\\POEL CD"))
        )
      (princ)
      )
    Last edited by RenderMan; 2012-05-11 at 10:31 PM. Reason: Code revised.
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

  3. #3
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    622
    0 Did you find this post helpful? Yes

    Default Re: Insert a line feed in Mtext

    What's if the selection is not a text ?

  4. #4
    100 Club mikehaff's Avatar
    Join Date
    2010-10
    Posts
    197
    0 Did you find this post helpful? Yes

    Default Re: Insert a line feed in Mtext

    Thanks Renderman!
    Tharwat, in this case I don't need the error control.

  5. #5
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    3,965
    0 Did you find this post helpful? Yes

    Default Re: Insert a line feed in Mtext

    Quote Originally Posted by Tharwat View Post
    What's if the selection is not a text ?
    Quote Originally Posted by mikehaff View Post
    Thanks Renderman!
    Tharwat, in this case I don't need the error control.
    Tharwat is correct... It is not like me to post code like that.

    Code corrected.
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

Similar Threads

  1. Multi line Mtext to Single line Mtext
    By csiress.154683 in forum AutoLISP
    Replies: 7
    Last Post: 2013-06-12, 02:21 PM
  2. Insert Blocks in MText
    By acadwishlist in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2009-08-28, 01:37 AM
  3. Replies: 8
    Last Post: 2007-03-12, 02:18 AM
  4. Macro to insert symbols in Mtext
    By tedg in forum AutoCAD General
    Replies: 7
    Last Post: 2006-10-17, 08:00 PM
  5. Insert hard return in Mtext
    By luckyguy5603 in forum AutoLISP
    Replies: 6
    Last Post: 2006-02-01, 04:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •