<?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: LSP for Find and replace in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704955#M126239</link>
    <description>&lt;P&gt;Try this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:changespace (/ ss)
  (vl-load-com)
  (if (setq ss (ssget '((0 . "TEXT,MTEXT"))))
    ((lambda (i / e v s)
       (while (setq e (ssname ss (setq i (1+ i))))
	 (setq
	   s (vla-get-textstring (setq v (vlax-ename-&amp;gt;vla-object e)))
	 )
	 (while	(vl-string-search " " s)
	   (setq s (vl-string-subst "\\P" " " s))
	 )
	 (vla-put-textstring v s)
       )
     )
      -1
    )
  )
  (princ)
)&lt;/PRE&gt;</description>
    <pubDate>Wed, 23 Nov 2016 12:08:09 GMT</pubDate>
    <dc:creator>m_badran</dc:creator>
    <dc:date>2016-11-23T12:08:09Z</dc:date>
    <item>
      <title>LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704069#M126233</link>
      <description>&lt;P&gt;I was wondering if someone can create a find and replace lsp for us that does this steps. Thank you so much in advance once again.&lt;/P&gt;&lt;P&gt;Want to replace the spaces on the currently &lt;STRONG&gt;selected&lt;/STRONG&gt; mtext to an enter command.&lt;/P&gt;&lt;P&gt;If I do and find and replace it will have to be something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Under "Find What" it will just be a single spacebar&lt;/P&gt;&lt;P&gt;Under "Replace&amp;nbsp; With" will be \u+000A. This is the code for replicating the enter function.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Find and Replace.gif" style="width: 637px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/295426i94CAE53B5220CA5C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Find and Replace.gif" alt="Find and Replace.gif" /&gt;&lt;/span&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So once that hit "Relace "All" it should turn this currently selected mtext from this&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Find and Replace2.gif" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/295427i049DCF53D0C02652/image-size/large?v=v2&amp;amp;px=999" role="button" title="Find and Replace2.gif" alt="Find and Replace2.gif" /&gt;&lt;/span&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To this&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Find and Replace3.gif" style="width: 355px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/295430i128F22CEE1DD057E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Find and Replace3.gif" alt="Find and Replace3.gif" /&gt;&lt;/span&gt;﻿&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 00:32:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704069#M126233</guid>
      <dc:creator>burniksapwet</dc:creator>
      <dc:date>2016-11-23T00:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704083#M126234</link>
      <description>&lt;P&gt;(vl-string-translate "\\P" " " str)&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 00:46:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704083#M126234</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2016-11-23T00:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704105#M126235</link>
      <description>&lt;P&gt;I'm sorry but how do I run this?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 01:07:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704105#M126235</guid>
      <dc:creator>burniksapwet</dc:creator>
      <dc:date>2016-11-23T01:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704178#M126236</link>
      <description>&lt;P&gt;My apologies. &amp;nbsp;My answer was very terse because I thought you knew a bit about AutoLisp / Visual Lisp and were looking for a find and replace function to use in your own code. &amp;nbsp;My response simply indicated that there is a Visual Lisp function that does exactly what (I think) you need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps you can post the code you have so far and one of us here can show you how/where to implement the function.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 02:02:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704178#M126236</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2016-11-23T02:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704211#M126237</link>
      <description>That's the thing sir. I have nothing because I am not well versed with creating a .lsp. All I have is what I want the command to do. Which is to add all those "enter" command to the currently selected mtext. Sorry for the confusion. I should have mentioned that to begin with.</description>
      <pubDate>Wed, 23 Nov 2016 02:34:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704211#M126237</guid>
      <dc:creator>burniksapwet</dc:creator>
      <dc:date>2016-11-23T02:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704765#M126238</link>
      <description>Try the attached Q&amp;amp;D lisp.

command: mtalign</description>
      <pubDate>Wed, 23 Nov 2016 10:19:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704765#M126238</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2016-11-23T10:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704955#M126239</link>
      <description>&lt;P&gt;Try this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:changespace (/ ss)
  (vl-load-com)
  (if (setq ss (ssget '((0 . "TEXT,MTEXT"))))
    ((lambda (i / e v s)
       (while (setq e (ssname ss (setq i (1+ i))))
	 (setq
	   s (vla-get-textstring (setq v (vlax-ename-&amp;gt;vla-object e)))
	 )
	 (while	(vl-string-search " " s)
	   (setq s (vl-string-subst "\\P" " " s))
	 )
	 (vla-put-textstring v s)
       )
     )
      -1
    )
  )
  (princ)
)&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Nov 2016 12:08:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6704955#M126239</guid>
      <dc:creator>m_badran</dc:creator>
      <dc:date>2016-11-23T12:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6705576#M126240</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/403653"&gt;@burniksapwet&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I was wondering if someone can create a find and replace lsp for us that does this steps. Thank you so much in advance once again.&lt;/P&gt;
&lt;P&gt;Want to replace the spaces on the currently &lt;STRONG&gt;selected&lt;/STRONG&gt; mtext to an enter command.&lt;/P&gt;
&lt;P&gt;If I do and find and replace it will have to be something like this&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;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;burniksapwet&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Obviously this topic and two recent posts &amp;nbsp;are related&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-attribute-text-extraction/td-p/6694963" target="_blank"&gt;Block Attribute Text Extraction.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/text-to-mtext-then-line-up-mtext-in-a-column/td-p/6703913" target="_self"&gt;Text to Mtext then line up mtext in a column.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hows about picked one and stick with it until its resolved, take a deep breath and describe the goal in its entirety so everybody here can provide a workable solution and not just bits &amp;amp; pieces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take your time.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* one of fellow member informed me that what i submitted as an attachment was nowhere to be found, its just one of those days&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 16:06:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6705576#M126240</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2016-11-23T16:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6705650#M126241</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/403653"&gt;@burniksapwet&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;Want to replace the spaces on the &lt;FONT color="#ff0000"&gt;currently &lt;STRONG&gt;selected&lt;/STRONG&gt;&lt;/FONT&gt; mtext to an enter command.&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Try this [lightly tested]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun C:S2EP (/ ss n obj); = Space(s) [to] Enter(s) with &lt;FONT color="#ff0000"&gt;P&lt;/FONT&gt;re-selection
  (if (setq ss (ssget &lt;FONT color="#ff0000"&gt;"_I"&lt;/FONT&gt; '((0 . "MTEXT"))))
    (repeat (setq n (sslength ss))
      (setq obj (vlax-ename-&amp;gt;vla-object (ssname ss (setq n (1- n)))))
      (vla-put-textstring obj (vl-string-translate " " "\n" (vla-get-textstring obj)))
    ); repeat
  ); if
  (princ)
); defun&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[By the way, &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3930636"&gt;@john.uhden&lt;/a&gt;&amp;nbsp;had the (vl-string-translate)&amp;nbsp;arguments reversed.&amp;nbsp; But that function does &lt;EM&gt;all&lt;/EM&gt; of them, eliminating &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1773843"&gt;@m_badran&lt;/a&gt;'s (while) function needed if using (vl-string-&lt;EM&gt;subst&lt;/EM&gt;).]&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 16:36:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6705650#M126241</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2016-11-23T16:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6705679#M126242</link>
      <description>&lt;P&gt;My apologies.&lt;/P&gt;&lt;P&gt;Apparently vl-string-translate can replace only an equal number of characters for another.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;(vl-string-translate "123" "ABC" "lj;lABC &amp;nbsp;lkjlp329ABCs';lsdf") &amp;nbsp;will work, but&lt;/P&gt;&lt;P&gt;(vl-string-translate "A" "123" etc.) &amp;nbsp;will replace all "A"s with just "1"&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 16:41:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6705679#M126242</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2016-11-23T16:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6705689#M126243</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/403653"&gt;@burniksapwet﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Before you post, do you do an internet search and find out if any solution similar to your needs already exists?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this from Lee-Mac to see if it meets your needs.&amp;nbsp; It appears to batch process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.lee-mac.com/bfind.html" target="_blank"&gt;http://www.lee-mac.com/bfind.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 16:47:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6705689#M126243</guid>
      <dc:creator>dbroad</dc:creator>
      <dc:date>2016-11-23T16:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6716968#M126244</link>
      <description>&lt;P&gt;Yes I do search first. This will not work for what I need it the lsp for.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 20:53:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6716968#M126244</guid>
      <dc:creator>burniksapwet</dc:creator>
      <dc:date>2016-11-29T20:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: LSP for Find and replace</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6717499#M126245</link>
      <description>&lt;P&gt;Thank you so much for the code. This is exactly what we are looking for. I appreciate the time and effort for this code. Thank you so much.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 00:41:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-for-find-and-replace/m-p/6717499#M126245</guid>
      <dc:creator>burniksapwet</dc:creator>
      <dc:date>2016-11-30T00:41:47Z</dc:date>
    </item>
  </channel>
</rss>

