<?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: text concatenate in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124334#M138412</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you help me, I need concatenate only 2 text and continue the comand to the next 2 text?&lt;/P&gt;&lt;P&gt;I have many text that I need to join. It will save my time!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Fabricio&lt;/P&gt;</description>
    <pubDate>Fri, 01 Nov 2024 13:07:14 GMT</pubDate>
    <dc:creator>F.Camargo</dc:creator>
    <dc:date>2024-11-01T13:07:14Z</dc:date>
    <item>
      <title>text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5819111#M138405</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is any lisp to&amp;nbsp;concatenate two or more text strings using ',' between those strings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sudarsan&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2015 10:17:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5819111#M138405</guid>
      <dc:creator>sudarsann</dc:creator>
      <dc:date>2015-09-16T10:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5819272#M138406</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:conc (/ a ans b c d e f g h j)
   (graphscr)
   (command ".redraw") (command)
(initget "Yes No")
(if (= "Yes" (getkword "\nRetain Append Text? [Y/N] &amp;lt;N&amp;gt;: "))
(setq j 0); Yes
(setq j 1); No
)
   (prompt "\nSelect Text to Remain-&amp;gt;")
   (setq a (entsel))
   (while (setq b (entsel "\nSelect Text to Append -&amp;gt; "))
     (setq c (entget (car a))
           d (entget (car b))
           e (cdr (assoc 1 c))    ;get 1st text string
           f (cdr (assoc 1 d))    ;get 2nd text string
           g (strcat e "," f)
	   h (subst (cons 1 g) (assoc 1 c) c)
     )
     (entmod h)                    ;update 1st string
     
(if (eq j 1)
     (entdel (car b))
  )
     (princ)
   )
)&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Sep 2015 12:16:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5819272#M138406</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-16T12:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5819338#M138407</link>
      <description>&lt;P&gt;Another...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun strC ( strlist del / newlst )
    (mapcar
        '(lambda (a)
             (setq newlst (cons del (cons a newlst)))
         )
        (reverse strlist)
    )
    (apply 'strcat (cdr newlst))    
)


(strC '("abc" "de" "f") ",")&lt;BR /&gt;"abc,de,f" &lt;BR /&gt;_$ &lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Sep 2015 12:49:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5819338#M138407</guid>
      <dc:creator>gpcattaneo</dc:creator>
      <dc:date>2015-09-16T12:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5819475#M138408</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1015845"&gt;@sudarsann&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is any lisp to&amp;nbsp;concatenate two or more text strings using ',' between those strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sudarsan&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi sudarsann,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;another...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;_$ (defun lst2str (lst del)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (vl-string-left-trim del (apply 'strcat (mapcar '(lambda (x) (strcat del x)) lst)))&lt;BR /&gt;)&lt;BR /&gt;LST2STR&lt;BR /&gt;_$ (lst2str '( "abc" "def" "ghi") ",")&lt;BR /&gt;"abc,def,ghi"&lt;BR /&gt;_$ &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2015 13:48:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5819475#M138408</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-09-16T13:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5820018#M138409</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm not sure why others are suggesting things that work with &lt;EM&gt;lists&lt;/EM&gt; of text strings, when Post 2 clearly indicates that your intention is to &lt;EM&gt;select existing Text objects&lt;/EM&gt; on-screen. &amp;nbsp;Your approach is fine, though it can be simplified/consolidated somewhat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't need the (graphscr), because if you're in the text screen, the (entsel) will pop you into the graphics screen. &amp;nbsp;And you don't need the (command) without arguments, because you won't be able to enter CONC as a command unless you're already at the Command: prompt, so there won't be any other command active that you need to cancel. &amp;nbsp;You have a variety of variables that are &lt;EM&gt;used only once&lt;/EM&gt;, in which case you may as well skip the variable, and do what you would do to set it right where it's used. &amp;nbsp;You can include&amp;nbsp;a prompt &lt;EM&gt;inside&lt;/EM&gt; (entsel) rather than separately before it. &amp;nbsp;And whether to retain appended text can be just a T or nil value, rather than setting a number for it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lightly tested:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun C:CONC (/ del a b c)
  (command ".redraw")
  (initget "Yes No")
  (setq
    del (/= (getkword "\nRetain Appended Text? [Y/N] &amp;lt;N&amp;gt;: ") "Yes"); T for No or Enter
    a (entsel "\nSelect Text to Remain-&amp;gt;")
  ); setq
  (while (setq b (entsel "\nSelect Text to Append -&amp;gt; "))
    (setq c (entget (car a)))
    (entmod ; update 1st string
      (subst
        (cons 1 (strcat (cdr (assoc 1 c)) "," (cdr (assoc 1 (entget (car b))))))
        (assoc 1 c)
        c
      ); subst
    ); entmod
    (if del (entdel (car b)))
  ); while
  (princ)
)&lt;/PRE&gt;
&lt;P&gt;It could be made fancier, e.g. to ensure you picked something, restrict selection to Text [and/or Mtext if you like], etc.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2015 17:54:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5820018#M138409</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-09-16T17:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5820149#M138410</link>
      <description>&lt;P&gt;That's made it much neater Kent, I'll use that myself !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Particularly like the “And whether to retain appended text can be just a T or nil value, rather than setting a number”&lt;/P&gt;&lt;P&gt;I hadn’t thought of that&lt;/P&gt;&lt;P&gt;Now if I could just send you about 30 other lisps that need tidying up….&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2015 18:53:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5820149#M138410</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-16T18:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5820165#M138411</link>
      <description>&lt;P&gt;Kent1Cooper wrote:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;gt; I'm not sure why others are suggesting things that work with &lt;EM&gt;lists&lt;/EM&gt; of text strings, when Post 2 clearly indicates that your intention is to &lt;EM&gt;select existing Text objects&lt;/EM&gt; on-screen. &amp;nbsp;....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My apologies to "others" -- I somehow glanced too quickly to notice that Post 2 is &lt;EM&gt;not&lt;/EM&gt; from the same person as Post 1 [both starting with s, of similar length and similar icon color...]. &amp;nbsp;Maybe a list of strings is appropriate. &amp;nbsp;I think the OP needs to clarify what the actual operation would be.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 16 Sep 2015 19:04:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/5820165#M138411</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-09-16T19:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124334#M138412</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you help me, I need concatenate only 2 text and continue the comand to the next 2 text?&lt;/P&gt;&lt;P&gt;I have many text that I need to join. It will save my time!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Fabricio&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 13:07:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124334#M138412</guid>
      <dc:creator>F.Camargo</dc:creator>
      <dc:date>2024-11-01T13:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124491#M138413</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1270409"&gt;@F.Camargo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;... I need concatenate only 2 text and continue the comand to the next 2 text?&amp;nbsp;&lt;/SPAN&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is the idea that you would pick Text objects one at a time, and the content of the second one would be tacked onto the end of the first one [with the same comma separator as in Message 1], then that of the fourth would be tacked onto the end of the third, etc.?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 14:19:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124491#M138413</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-11-01T14:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124745#M138414</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp; escreveu:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1270409"&gt;@F.Camargo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&lt;SPAN&gt;... I need concatenate only 2 text and continue the comand to the next 2 text?&amp;nbsp;&lt;/SPAN&gt;....&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Is the idea that you would pick Text objects one at a time, and the content of the second one would be tacked onto the end of the first one [with the same comma separator as in Message 1], then that of the fourth would be tacked onto the end of the third, etc.?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes!&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Text1 and Text2 = result Text1-Text2 (finally)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the third could be the next &lt;SPAN&gt;concatenate text.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 15:59:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124745#M138414</guid>
      <dc:creator>F.Camargo</dc:creator>
      <dc:date>2024-11-01T15:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124844#M138415</link>
      <description>&lt;P&gt;Simply put, and on the assumption that you want the second one of each pair [whose content gets appended to the first one] &lt;EM&gt;removed&lt;/EM&gt;, try this [minimally tested]:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:TC2 (/ ss1 ss2 d pea n) ; = Text: Concatenate 2 at a time
  (while
    (and
      (setq tsel1 (entsel "\nSelect base Text object or &amp;lt;exit&amp;gt;: "))
      (setq tdata1 (entget (car tsel1)))
      (member '(0 . "TEXT") tdata1)
    ); and
    (if
      (and
        (setq tsel2 (entsel "\nSelect Text object to append: "))
        (setq tdata2 (entget (car tsel2)))
        (member '(0 . "TEXT") tdata2)
      ); and
      (progn ; then
        (entmod
          (subst
            (cons 1 (strcat (cdr (assoc 1 tdata1)) "-" (cdr (assoc 1 tdata2))))
            (assoc 1 tdata1)
            tdata1
          ); subst
        ); entmod
        (entdel (car tsel2))
      ); progn
    ); if
  ); while
  (prin1)
)&lt;/LI-CODE&gt;
&lt;P&gt;It is built for Text only, but can easily be made to allow Mtext also, though there are potential complications there [internal formatting, splitting of the content of very long ones, etc.].&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 17:05:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124844#M138415</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-11-01T17:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: text concatenate</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124856#M138416</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp; escreveu:&lt;BR /&gt;&lt;P&gt;Simply put, and on the assumption that you want the second one of each pair [whose content gets appended to the first one] &lt;EM&gt;removed&lt;/EM&gt;, try this [minimally tested]:&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun C:TC2 (/ ss1 ss2 d pea n) ; = Text: Concatenate 2 at a time
  (while
    (and
      (setq tsel1 (entsel "\nSelect base Text object or &amp;lt;exit&amp;gt;: "))
      (setq tdata1 (entget (car tsel1)))
      (member '(0 . "TEXT") tdata1)
    ); and
    (if
      (and
        (setq tsel2 (entsel "\nSelect Text object to append: "))
        (setq tdata2 (entget (car tsel2)))
        (member '(0 . "TEXT") tdata2)
      ); and
      (progn ; then
        (entmod
          (subst
            (cons 1 (strcat (cdr (assoc 1 tdata1)) "-" (cdr (assoc 1 tdata2))))
            (assoc 1 tdata1)
            tdata1
          ); subst
        ); entmod
        (entdel (car tsel2))
      ); progn
    ); if
  ); while
  (prin1)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is built for Text only, but can easily be made to allow Mtext also, though there are potential complications there [internal formatting, splitting of the content of very long ones, etc.].&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;Thank you very much&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's faster now!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Fabricio&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 17:11:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-concatenate/m-p/13124856#M138416</guid>
      <dc:creator>F.Camargo</dc:creator>
      <dc:date>2024-11-01T17:11:56Z</dc:date>
    </item>
  </channel>
</rss>

