<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Lisp to Copy Mtext but paste only the first line in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10141870#M63194</link>
    <description>&lt;P&gt;Are the "remaining bottom lines" separate lines as a result of &lt;EM&gt;Enter(s)&lt;/EM&gt; being used to move down to a next line?&amp;nbsp; If so, I can imagine a way to do what you want.&amp;nbsp; Or are they subsequent lines because of &lt;EM&gt;word wrapping&lt;/EM&gt; resulting from the width of the defining box?&amp;nbsp; If so, I'm not sure how one would approach the problem, but there may be a way.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Mar 2021 12:44:12 GMT</pubDate>
    <dc:creator>Kent1Cooper</dc:creator>
    <dc:date>2021-03-09T12:44:12Z</dc:date>
    <item>
      <title>Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10141825#M63193</link>
      <description>&lt;P&gt;Dear Lisp experts.&amp;nbsp; I hope you all are doing well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do we have any Lisp to copy only the first line of MTEXT. I have many drawings where i need to copy only the first line to other position. presently i use copy command and then manually delete the remaining bottom lines. I dont want to explode the MTEXT.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me in this. Thank you very much&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 12:25:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10141825#M63193</guid>
      <dc:creator>tiwari1211</dc:creator>
      <dc:date>2021-03-09T12:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10141870#M63194</link>
      <description>&lt;P&gt;Are the "remaining bottom lines" separate lines as a result of &lt;EM&gt;Enter(s)&lt;/EM&gt; being used to move down to a next line?&amp;nbsp; If so, I can imagine a way to do what you want.&amp;nbsp; Or are they subsequent lines because of &lt;EM&gt;word wrapping&lt;/EM&gt; resulting from the width of the defining box?&amp;nbsp; If so, I'm not sure how one would approach the problem, but there may be a way.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 12:44:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10141870#M63194</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-03-09T12:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10141899#M63196</link>
      <description>Hello Kent,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you for your reply.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Yes, the remaining bottom lines are result of Enter(s). So what i need is to copy only the first line.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Also before doing paste if i have option to enter the text height. this will be great.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you for helping.&amp;nbsp;</description>
      <pubDate>Tue, 09 Mar 2021 12:58:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10141899#M63196</guid>
      <dc:creator>tiwari1211</dc:creator>
      <dc:date>2021-03-09T12:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10142695#M63197</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10408457"&gt;@tiwari1211&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;....Yes, the remaining bottom lines are result of Enter(s). So what i need is to copy only the first line.&amp;nbsp;&lt;BR /&gt;Also before doing paste if i have option to enter the text height. this will be great.&amp;nbsp;....&amp;nbsp;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Here's a fairly quickie approach, lightly tested:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;;| CopyMTextLine1.lsp [command name: CMTL1]
To Copy Mtext only up to the first Enter [if any] encountered, with
  specification of [new] height, offering current height as default.
Creates new Mtext with [if containing Enter(s)] truncated content,
  on same Layer, with same justification, etc., and leaves User in
  Move command to specify new location.
If Mtext contains no Enter(s), simply Copies it [with new height if
  specified].
NOTE:  Width of defining Mtext box is NOT changed, so if height
  is increased, word wrapping can occur in result, or if original had
  new lines from word wrapping before Enter(s), word wrapping
  can change.
Kent Cooper, 9 March 2021
|;
(defun C:CMTL1 ; = Copy MText Line 1 only
  (/ mt mtdata mtht ht txt hard soft newtxt)
  (if
    (and
      (setq mt (car (entsel "\nMText object to Copy 1st line of: ")))
      (member '(0 . "MTEXT") (setq mtdata (entget mt)))
    ); and
    (progn ; then
      (initget 6); no zero, no negative
      (setq ht
        (cond
          ( (getdist ; nil on Enter
              (strcat
                "\nText height &amp;lt;"
                (rtos (setq mtht (cdr (assoc 40 mtdata)))); current height default
                "&amp;gt;: "
              ); strcat
            ); getdist
          ); User-input condition
          (mtht); User Enter -- keep current height
        ); cond  
      ); setq
      (if (wcmatch (setq txt (cdr (assoc 1 mtdata))) "*\\P*,*\n*"); contains Enter(s)
        (setq ; then
          hard (vl-string-search "\\P" txt) ; first "hard" Enter if any
          soft (vl-string-search "\n" txt) ; first "soft" Enter [Shift+Enter] if any
          newtxt (substr txt 1 (apply 'min (vl-remove nil (list hard soft))))
            ; from beginning to first type of Enter encountered
        ); setq
        (setq newtxt txt); no Enter(s) -- keep
      ); if
      (entmake
        (append
          (subst (cons 1 newtxt) (assoc 1 mtdata) mtdata); new content
          (list (cons 40 ht)); new height
        ); append
      ); entmake
      (command "_.move" (entlast) "" "_none" (cdr (assoc 10 mtdata)))
    ); progn
  ); if
); defun
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note the NOTE.&amp;nbsp; If it's important to have the remaining first line "look" the same even at a different size, i.e. to also adjust the Mtext defining box width, it could be altered to use a SCALE command, rather than assigning the new height in entity data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The height is about that of the "outer" Mtext object.&amp;nbsp; Anything like a height &lt;EM&gt;override inside&lt;/EM&gt; the Mtext will remain, though since that is assigned &lt;EM&gt;proportionally&lt;/EM&gt; in the text-string formatting, not as an absolute height, the &lt;EM&gt;proportion&lt;/EM&gt; will remain relative to the new height.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note also that if there is word wrapping from the width of the MText defining box &lt;EM&gt;before&lt;/EM&gt; an Enter is encountered, all content up to the Enter will remain even though wrapped to more than one line.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 17:20:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10142695#M63197</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-03-09T17:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10142874#M63198</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10408457"&gt;@tiwari1211&lt;/a&gt;&amp;nbsp; hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here, try this command. if it does not work then send a dwg with your mtext so i will check and fix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;enjoy&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; copy mtext first line
(defun c:cmt1 (/ ss l ename tarPt AcDbMtext p oText nText)
 (vla-startUndoMark (vla-get-activedocument (vlax-get-acad-object)))
  
 (if (setq ss (ssget '((0 . "mtext"))))
  (progn
   (repeat (setq l (sslength ss))
    (setq ename (ssname ss (setq l (1- l)))) 
    (redraw ename 3) 

    (if (and
          (setq tarPt (getpoint
                        (cdr (assoc '10 (entget ename)))
                        "\nCopy first text line to:  "
                      ); getpoint
          ); setq
          (setq AcDbMtext (vla-copy (vlax-ename-&amp;gt;vla-object ename)))
          (setq p (vl-string-search "\\P" (setq oText (vla-get-textString AcDbMtext))))
        )
     (progn
      (setq nText (substr oText 1 p)) 
      (vla-put-textString AcDbMtext nText) ; update text
      (vla-move AcDbMtext
                  (vlax-3d-point
                    (trans
                      (vlax-safearray-&amp;gt;list
                        (vlax-variant-value
                          (vla-get-insertionPoint AcDbMtext)
                        )
                      ) 0 1); trans
                  ); vlax-3d-point
                  (vlax-3d-point tarPt)
      ); vla-move
     ); progn
    ); if

    (redraw ename 4)
   ); repeat

  ); progn
 ); if

 (vla-endundoMark (vla-get-activedocument (vlax-get-acad-object)))
 (princ) 
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 18:32:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10142874#M63198</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2021-03-09T18:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10143548#M63199</link>
      <description>&lt;P&gt;Pretty good, Moshe, but Kent covered the soft returns also &lt;EM&gt;(he's learning quite well).&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 22:07:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10143548#M63199</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2021-03-09T22:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10143821#M63200</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3930636"&gt;@john.uhden&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Pretty good, Moshe, but Kent covered the soft returns also &lt;EM&gt;(he's learning quite well).&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I thought you'd appreciate that.&amp;nbsp; &amp;nbsp;[And the height request.]&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 00:44:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10143821#M63200</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-03-10T00:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10143884#M63201</link>
      <description>I thought I gave you a "like", didn't I?  You deserve more of them.</description>
      <pubDate>Wed, 10 Mar 2021 01:23:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10143884#M63201</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2021-03-10T01:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10144484#M63202</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3930636"&gt;@john.uhden&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for that&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt; although mine accept selection of multi mtext i still consider&amp;nbsp;YOU&amp;nbsp;and&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp; (and many others) as MASTERS here. with all my many years of &lt;SPAN&gt;experience&lt;/SPAN&gt; in AutoCAD\AutoLISP\ActiveX i still learning here new tricks every day so thank you all for your&amp;nbsp;&lt;SPAN&gt;contribution to this Fourm without you this place would not be so attracting and interesting.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;keep up the good work\coding.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 08:37:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10144484#M63202</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2021-03-10T08:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145119#M63203</link>
      <description>Thank you very much Kent for your support. The Lisp is very good and works exactly as i want.&lt;BR /&gt;Thanks a lot again. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2021 13:08:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145119#M63203</guid>
      <dc:creator>tiwari1211</dc:creator>
      <dc:date>2021-03-10T13:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145135#M63204</link>
      <description>Thank you very much Moshe. You too a very good programmer and your code also works. thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 10 Mar 2021 13:13:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145135#M63204</guid>
      <dc:creator>tiwari1211</dc:creator>
      <dc:date>2021-03-10T13:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145291#M63205</link>
      <description>Hi Kent,&lt;BR /&gt;&lt;BR /&gt;What to change in your code, if i want to keep Text height 10 as default ?&lt;BR /&gt;In that case i do not need the Text height option too.&lt;BR /&gt;Can you please help me with this too. Thank you</description>
      <pubDate>Wed, 10 Mar 2021 13:54:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145291#M63205</guid>
      <dc:creator>tiwari1211</dc:creator>
      <dc:date>2021-03-10T13:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145593#M63206</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10408457"&gt;@tiwari1211&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;.... What to change in your code, if i want to keep Text height 10 as default ?&lt;BR /&gt;In that case i do not need the Text height option too. ....&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you want the new Mtext always at a height of 10 units, regardless of the source Mtext's height, and without asking the User, this should do [minimally tested]:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;;| CopyMTextLine1-ht10.lsp [command name: CMTL1]
To Copy Mtext only up to the first Enter [if any] encountered, with
  height of 10 units regardless of current height.
Creates new Mtext with [if containing Enter(s)] truncated content,
  on same Layer, with same justification, etc., and leaves User in
  Move command to specify new location.
If Mtext contains no Enter(s), simply Copies it [with new height if
  not originally 10 units].
NOTE:  Width of defining Mtext box is NOT changed, so word
  wrapping can occur in result if height is increased, or if original had
  new lines from word wrapping before first Enter, word wrapping
  can change.
Kent Cooper, 10 March 2021
|;
(defun C:CMTL1 ; = Copy MText Line 1 only
  (/ mt mtdata txt hard soft newtxt)
  (if
    (and
      (setq mt (car (entsel "\nMText object to Copy 1st line of: ")))
      (member '(0 . "MTEXT") (setq mtdata (entget mt)))
    ); and
    (progn ; then
      (initget 6); no zero, no negative
      (if (wcmatch (setq txt (cdr (assoc 1 mtdata))) "*\\P*,*\n*"); contains Enter(s)
        (setq ; then
          hard (vl-string-search "\\P" txt) ; first "hard" Enter if any
          soft (vl-string-search "\n" txt) ; first "soft" Enter [Shift+Enter] if any
          newtxt (substr txt 1 (apply 'min (vl-remove nil (list hard soft))))
            ; from beginning to first type of Enter encountered
        ); setq
        (setq newtxt txt); no Enter(s) -- keep
      ); if
      (entmake
        (append
          (subst (cons 1 newtxt) (assoc 1 mtdata) mtdata); truncated text
          '((40 . 10.0)); fixed height
        ); append
      ); entmake
      (command "_.move" (entlast) "" "_none" (cdr (assoc 10 mtdata)))
    ); progn
  ); if
); defun&lt;/LI-CODE&gt;
&lt;P&gt;It could also be made to always &lt;EM&gt;offer&lt;/EM&gt; 10 units as the default, but still allow the User to call for something else if they want, or to keep the source Mtext's height.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 15:27:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145593#M63206</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-03-10T15:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145802#M63207</link>
      <description>&lt;P&gt;Thank you very much Kent. Your codes are wonderful. I have one more request.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I extract this MTEXT to an excel file at the end. and did not realized that its depended on Layer.&amp;nbsp; Now My excel shows both the texts. to avoid it i need the new text with height 10 in Layer "0".&amp;nbsp; will it be possible.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am very sorry, i didnt realised this earlier. But at last my final output is not correct. I appreciate your help. thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 16:29:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145802#M63207</guid>
      <dc:creator>tiwari1211</dc:creator>
      <dc:date>2021-03-10T16:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145856#M63208</link>
      <description>I think your opinion of me is overrated.  But you are kind.</description>
      <pubDate>Wed, 10 Mar 2021 16:46:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145856#M63208</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2021-03-10T16:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145892#M63209</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10408457"&gt;@tiwari1211&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;... i need the new text with height 10 in Layer "0".&amp;nbsp; will it be possible.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;....&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Change this line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;'((40 . 10.0))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;EM&gt;&lt;FONT color="#999999"&gt;; fixed height&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;'((8 . "0") (40 . 10.0))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#999999"&gt;&lt;EM&gt;; Layer 0 &amp;amp; fixed height&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 16:57:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145892#M63209</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-03-10T16:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145974#M63210</link>
      <description>&lt;P&gt;A followup question:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Do these ever have &lt;EM&gt;a lot of content&lt;/EM&gt;, like a heading followed by an Enter [or two] and a long paragraph of text, where you want to Copy only the heading?&amp;nbsp; A content entry can hold only up to 250 characters, so if it's longer than that, the text content will &lt;EM&gt;start&lt;/EM&gt; in an &lt;FONT color="#000000"&gt;(assoc &lt;STRONG&gt;3&lt;/STRONG&gt;)&lt;/FONT&gt; entry in entity data, and maybe more of those if needed, with the &lt;FONT color="#000000"&gt;(assoc &lt;STRONG&gt;1&lt;/STRONG&gt;)&lt;/FONT&gt; entry [never more than one of those] being the &lt;EM&gt;last&lt;/EM&gt; content container, holding only the &lt;EM&gt;end&lt;/EM&gt; of the overall content, beyond some multiple of 250 characters.&amp;nbsp; So in my example situation, if you want to take only the heading, that will need to be pulled from the &lt;EM&gt;first &lt;FONT color="#000000"&gt;(assoc &lt;STRONG&gt;3&lt;/STRONG&gt;)&lt;/FONT&gt; entry&lt;/EM&gt; [when there are any], &lt;EM&gt;not&lt;/EM&gt;&amp;nbsp;from the &lt;FONT color="#000000"&gt;(assoc &lt;STRONG&gt;1&lt;/STRONG&gt;)&lt;/FONT&gt; entry.&amp;nbsp; And the revised entity data would need to have any &lt;FONT color="#000000"&gt;(assoc &lt;STRONG&gt;3&lt;/STRONG&gt;)&lt;/FONT&gt; entries &lt;EM&gt;removed&lt;/EM&gt;, leaving only the &lt;FONT color="#000000"&gt;(assoc &lt;STRONG&gt;1&lt;/STRONG&gt;)&lt;/FONT&gt; entry with the truncated content in it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that a possible situation that should be accounted for, in the kinds of things you would use this on?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 17:23:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10145974#M63210</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-03-10T17:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10146285#M63211</link>
      <description>Thanks again. &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏🏻&lt;/span&gt;&lt;BR /&gt;In my case content will not be more than 100 characters. I wish you a nice day ahead.</description>
      <pubDate>Wed, 10 Mar 2021 19:17:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10146285#M63211</guid>
      <dc:creator>tiwari1211</dc:creator>
      <dc:date>2021-03-10T19:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10147788#M63212</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10408457"&gt;@tiwari1211&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Dear Lisp experts.&amp;nbsp; I hope you all are doing well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do we have any Lisp to copy only the first line of MTEXT. I have many drawings where i need to copy only the first line to other position. presently i use copy command and then manually delete the remaining bottom lines. I dont want to explode the MTEXT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help me in this. Thank you very much&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Also works on &lt;STRONG&gt;altered width&lt;/STRONG&gt;: [ no "\\P" found on string ]&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;;;;		Lee Mac | 11-25-2013		;;;
(defun mattrib-number-of-lines (ent / box enx)
    (setq enx (entget ent)
	  box (textbox (list '(1 . "A") (assoc 7 enx) (assoc 40 enx)))
    )
    (1+ (fix (/ (cdr (assoc 43 enx)) (* 1.66 (- (cadadr box) (cadar box))))))
  )

(defun c:tfs ( / ent no1 remain  obj pos str tmp )
;;	pBe | Mar 2021	hmsilva | 11-24-2013		;;
    (if (setq ent (car (entsel "\nMText object to Copy 1st line of: ")))
      (progn
            (setq  no1 (mattrib-number-of-lines ent)
            )
	  (setq remain (vlax-invoke (vlax-ename-&amp;gt;vla-object ent) 'Copy ))
	  (while (&amp;gt; no1 1)
	      (setq str (vla-get-textstring remain) pos 0 )
			    (while (setq tmp (vl-string-search "\\P" str pos))
	                            (setq pos (+ tmp 2))
	                        )
	    (vla-put-textstring
	      remain (substr str
		      1 (max (- pos 2)
			   (cond ((vl-string-position 32 str nil t))
				 (0)
			   )
		      )
	           )
	    )
	    	(vla-update remain)
	    (setq no1 (mattrib-number-of-lines (vlax-vla-object-&amp;gt;ename remain)))
	    )
	(mapcar	'(lambda (d)
		   (vlax-put remain (car d) (cadr d))
		 )
		'(("Layer" 0) ("Height" 10.0))
	) 
	(vl-cmdf "_.move"
		 (vlax-vla-object-&amp;gt;ename remain)
		 ""
		 "_none"
		 (Vlax-get remain 'Insertionpoint)
	)
        )
    )
    (princ)
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;T&lt;/STRONG&gt;ake &lt;STRONG&gt;F&lt;/STRONG&gt;irst &lt;STRONG&gt;S&lt;/STRONG&gt;tringline&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;command: &lt;STRONG&gt;TFS&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;HTH&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 10:17:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10147788#M63212</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2021-03-11T10:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to Copy Mtext but paste only the first line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10151599#M63213</link>
      <description>Hi kent, I hope you are doing well. will it be possible for you to add option for text rotation too in your code ?&lt;BR /&gt;So, when i copy the Mtext it ask for rotation angle. by default 0 deg.&lt;BR /&gt;Can you please help ?</description>
      <pubDate>Fri, 12 Mar 2021 13:53:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-copy-mtext-but-paste-only-the-first-line/m-p/10151599#M63213</guid>
      <dc:creator>tiwari1211</dc:creator>
      <dc:date>2021-03-12T13:53:15Z</dc:date>
    </item>
  </channel>
</rss>

