<?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: Replace Text With Block in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793598#M69348</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4509482"&gt;@waynekay24&lt;/a&gt;&amp;nbsp; hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;check this:&lt;/P&gt;&lt;P&gt;you can add more properties to (ssget) to filter out texts objects of no interest.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; select all texts in specific layers&lt;/P&gt;&lt;P&gt;(setq ss (ssget '((0 . "text") (8 . "layer1,layer2,layer3")))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; the same with specific height of 10&lt;/P&gt;&lt;P&gt;(setq ss (ssget '((0 . "text") (8 . "layer1,layer2,layer3") (40 . 10.0))))&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;LI-CODE lang="general"&gt;(defun c:xxx (/ ss l elist p0 rot)
 (if (setq ss (ssget '((0 . "text"))))
  (repeat (setq l (sslength ss))
   (setq ename (ssname ss (setq l (1- l)))) 
   (setq elist (entget ename))
   (setq p0 (cdr (assoc '10 elist)))
   (setq rot (cdr (assoc '50 elist)))

   (command "._insert" "YourBlockName" p0 1 1 (angtos rot))
   (entdel ename) 
  ); repeat  

  (princ)  
 )
  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Oct 2020 11:14:58 GMT</pubDate>
    <dc:creator>Moshe-A</dc:creator>
    <dc:date>2020-10-09T11:14:58Z</dc:date>
    <item>
      <title>Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793454#M69345</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a few thousand text entities that I need to replace with a block, at the same rotation and insertion as the text.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not have Lisp experience, but use the routines quite a bit when I can find them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not need to extract any data yet - I just need the block to replace the text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any routine that would do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 09:53:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793454#M69345</guid>
      <dc:creator>waynekay24</dc:creator>
      <dc:date>2020-10-09T09:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793486#M69346</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the right solution (Lisp routine of course) is to insert a Block (named for exemple "Block_Text") without graphic&lt;/P&gt;
&lt;P&gt;and with ONE Attribute (named for example "Attr_Text") which is in fact the TEXT !?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the Block will inserted at each Text insertion point ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;THE HEALTH, Regards, Patrice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 10:14:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793486#M69346</guid>
      <dc:creator>braudpat</dc:creator>
      <dc:date>2020-10-09T10:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793531#M69347</link>
      <description>&lt;P&gt;Hi - thank you for the reply.&lt;/P&gt;&lt;P&gt;The current need is only for the CAD block (graphic) without any attribute data necessary. Really a visual presentation at the moment where some manipulation of the block may be required later.&lt;/P&gt;&lt;P&gt;To shed some light, the text entities are Erf numbers. I want to substitute those for a block - which is a house drawing template. The rotation of the block would align with the text, as the text is aligned with the erf boundaries. The position of the block (house) would be at the centre of each erf - which is where the text has been positioned by the town planners.&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 10:35:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793531#M69347</guid>
      <dc:creator>waynekay24</dc:creator>
      <dc:date>2020-10-09T10:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793598#M69348</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4509482"&gt;@waynekay24&lt;/a&gt;&amp;nbsp; hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;check this:&lt;/P&gt;&lt;P&gt;you can add more properties to (ssget) to filter out texts objects of no interest.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; select all texts in specific layers&lt;/P&gt;&lt;P&gt;(setq ss (ssget '((0 . "text") (8 . "layer1,layer2,layer3")))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; the same with specific height of 10&lt;/P&gt;&lt;P&gt;(setq ss (ssget '((0 . "text") (8 . "layer1,layer2,layer3") (40 . 10.0))))&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;LI-CODE lang="general"&gt;(defun c:xxx (/ ss l elist p0 rot)
 (if (setq ss (ssget '((0 . "text"))))
  (repeat (setq l (sslength ss))
   (setq ename (ssname ss (setq l (1- l)))) 
   (setq elist (entget ename))
   (setq p0 (cdr (assoc '10 elist)))
   (setq rot (cdr (assoc '50 elist)))

   (command "._insert" "YourBlockName" p0 1 1 (angtos rot))
   (entdel ename) 
  ); repeat  

  (princ)  
 )
  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 11:14:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793598#M69348</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2020-10-09T11:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793600#M69349</link>
      <description>&lt;P&gt;delete&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 11:19:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793600#M69349</guid>
      <dc:creator>3wood</dc:creator>
      <dc:date>2020-10-09T11:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793619#M69350</link>
      <description>&lt;P&gt;You can try &lt;A href="https://sites.google.com/site/cadkits/home/altext" target="_blank" rel="noopener"&gt;ALTEXT&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;You can use a simple formula in ALTEXT.&lt;/P&gt;
&lt;P&gt;Steps as below:&lt;/P&gt;
&lt;P&gt;Step 1. Original drawing, the justification of texts are set to "MC":&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ALTEXT1.JPG" style="width: 714px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/829252iD4B045DE82AF068A/image-size/large?v=v2&amp;amp;px=999" role="button" title="ALTEXT1.JPG" alt="ALTEXT1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 2. Pick up "Use formula" in ALTEXT.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ALTEXT2.JPG" style="width: 946px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/829256i4535D6CE21AD3951/image-size/large?v=v2&amp;amp;px=999" role="button" title="ALTEXT2.JPG" alt="ALTEXT2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 3. Select a formula. (Save the code below as a *.lsp file)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ALTEXT3.JPG" style="width: 502px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/829258i55D84EA8BC89AB52/image-size/large?v=v2&amp;amp;px=999" role="button" title="ALTEXT3.JPG" alt="ALTEXT3.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 4. Result.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ALTEXT4.JPG" style="width: 596px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/829259iFAFA80EF3ECB93D6/image-size/large?v=v2&amp;amp;px=999" role="button" title="ALTEXT4.JPG" alt="ALTEXT4.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Save code below as a lsp file, such as "ALTEXT Formula 15.lsp".&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;;;; This is an example formula for ALTEXT.vlx
(defun ALTEXT_FORMULA (/ old-osnap)
  (setq old-osnap (getvar "OSMODE"))
  (setvar "OSMODE" 0)
  (vl-cmdf "._insert" "HOUSE" ;Change the block name "HOUSE" to suit your need.
	   (cdr (assoc 11 ALTEXT_BLK_ENT))
	   1.0
	   (atof (angtos (cdr (assoc 50 ALTEXT_BLK_ENT)) 1 3))
	   )
      (setvar "OSMODE" old-osnap)
  nil
  )
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 09 Oct 2020 11:25:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793619#M69350</guid>
      <dc:creator>3wood</dc:creator>
      <dc:date>2020-10-09T11:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793945#M69351</link>
      <description>&lt;P&gt;With the Txt2Ref utility (freeware) you can replace the texts not only with a single block type but also with blocks of the same name as the original text. See:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.cadforum.cz/cadforum_en/replace-texts-with-blocks-of-the-same-name-txt2ref-tip12760" target="_blank"&gt;https://www.cadforum.cz/cadforum_en/replace-texts-with-blocks-of-the-same-name-txt2ref-tip12760&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-eWAB4WMVeY%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-eWAB4WMVeY&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-eWAB4WMVeY%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="400" height="225" scrolling="no" title="Txt2Ref for AutoCAD - replace text placeholders with blocks of the same name" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Vladimir Michl, &lt;A href="http://www.cadstudio.cz" target="_blank"&gt;www.cadstudio.cz&lt;/A&gt; - &lt;A href="http://www.cadforum.cz" target="_blank"&gt;www.cadforum.cz&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 13:42:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9793945#M69351</guid>
      <dc:creator>vladimir_michl</dc:creator>
      <dc:date>2020-10-09T13:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9806153#M69352</link>
      <description>&lt;P&gt;It could be really easy if you don't mind anonymous blocks.&amp;nbsp; Each piece of text would be converted to an anonymous block that contained one (1) entity... the text.&amp;nbsp; If you want to use a standard named block, it would have to have an attribute to hold the text.&lt;/P&gt;
&lt;P&gt;Either way can be done in a relatively short amount of time.&amp;nbsp; Not my time, but there are plenty of apparently financially independent wizards around here that like to work at the drive-thru window.&lt;/P&gt;
&lt;P&gt;One neat thing about anonymous blocks is that if you explode them, they are self-purging.&lt;/P&gt;
&lt;P&gt;Then again, I don't see the need for converting the text to blocks.&amp;nbsp; If the purpose is data extraction, AutoLisp can pull all the data from texts as well as blocks.&amp;nbsp; Of course it would be better if your texts were on specific layers so that the data could be organized.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 01:39:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/9806153#M69352</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2020-10-16T01:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/11129781#M69353</link>
      <description>&lt;P&gt;I have a similar issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/291579"&gt;@braudpat&lt;/a&gt;&amp;nbsp;can you please elaborate? I have very little experience with lisp functions.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 15:29:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/11129781#M69353</guid>
      <dc:creator>stepo.prochy</dc:creator>
      <dc:date>2022-04-26T15:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/11130917#M69354</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8361313"&gt;@stepo.prochy&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4509482"&gt;@waynekay24&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For better understanding, and maybe get further help, please upload such sample.dwg and CSV file&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 23:43:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/11130917#M69354</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2022-04-26T23:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/11483037#M69355</link>
      <description>&lt;P&gt;Hello.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have since found a workaround. In my case, I didn't need the specific rotation angle, only the insertion point. I created a surface using text as a definition. Then exported acad points from the surface and converted them to COGO points which you then convert to a block definition matching the block that I needed. Not a very elegant solution but it helped me achieve what I needed.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 14:17:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/11483037#M69355</guid>
      <dc:creator>stepo.prochy</dc:creator>
      <dc:date>2022-10-14T14:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/11485157#M69356</link>
      <description>&lt;P&gt;Many thanks - an interesting discussion. Solutions and an exciting endpoint regarding surfaces. Have utilised a similar process across CAD-friendly software; to manipulate surface data between programs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2022 18:33:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/11485157#M69356</guid>
      <dc:creator>waynekay24</dc:creator>
      <dc:date>2022-10-15T18:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Text With Block</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/11485367#M69357</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;exported acad points from the surface and converted them to COGO points"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you export the points as a csv then read those points in a simple lisp making blocks, if using Civ3D then can add a code to the csv file so have more than 1 house shape appear to give a varied look, also can add these points to a point group so easy turn off or on.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2022 23:04:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-with-block/m-p/11485367#M69357</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2022-10-15T23:04:36Z</dc:date>
    </item>
  </channel>
</rss>

