Results 1 to 5 of 5

Thread: Insert a line feed in Mtext

  1. #1
    I could stop if I wanted to
    Join Date
    2015-10
    Posts
    215
    Login to Give a bone
    0

    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
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    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.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Insert a line feed in Mtext

    What's if the selection is not a text ?

  4. #4
    I could stop if I wanted to
    Join Date
    2015-10
    Posts
    215
    Login to Give a bone
    0

    Default Re: Insert a line feed in Mtext

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

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    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.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

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 autocad.wishlist1734 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
  •