<?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: Library lisp routine in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14201228#M171934</link>
    <description>&lt;P&gt;Maybe something like this. note hard coded for top directory.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/td-p/14198067
; look for block in a diretcory by name 
; By AlanH July 2026

(defun c:GetFolderDWGs ( / selectedFolder allDWGs dwgname dwgn)
(vl-load-com)
(defun FindDWGsRecursive (path / files)
    (if (/= (substr path (strlen path)) "\\")
      (setq path (strcat path "\\"))
    )
    (setq files (mapcar '(lambda (x) (strcat path x)) (vl-directory-files path "*.dwg" 1)))
    (foreach item (vl-directory-files path nil -1)
      (if (not (member item '("." "..")))
        (setq files (append files (FindDWGsRecursive (strcat path item))))
      )
    )
    files
)
(setq allDWGs (FindDWGsRecursive "D:\\autodesk\\blocks")) ; change to your top directory
(alert (strcat "Found  " (rtos (length alldwgs) 2 0) "  DWG Files:\n")) ; change alert to princ
(setq dwgname  (strcase (getstring "\nEnter block name " T)))
(foreach dwgn allDWGs
  (if (wcmatch (strcase dwgn) (strcat "*" dwgname "*"))
    (command "-insert" dwgn (getpoint "\nPick insertion point ") 1 1 0)
  )
)
  (princ)
)
(c:GetFolderDWGs)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS when testing 548 dwg's found.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jul 2026 02:04:56 GMT</pubDate>
    <dc:creator>Sea-Haven</dc:creator>
    <dc:date>2026-07-16T02:04:56Z</dc:date>
    <item>
      <title>Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198067#M171877</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I tried to have Chatgpt create a lisp routine that would allow me to TYPE a product name into the command line and it search for it in a designated location for it to insert and drop into the model space drawing. For instance, I type in "HD-RXC-4KZ-101" into the command line, and have it search in my&amp;nbsp;C:\CAD\LIBRARY\AV-300 ONE-LINE STANDARD BLOCKS folders where I have multiple different brand folders with all the model equipment in them. it should be able to find it and have me drop it into my drawings. But no matter how I word it, it never works so I gave up lol. Can anyone help me with this situation? Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2026 18:06:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198067#M171877</guid>
      <dc:creator>rfigueroa24PK4</dc:creator>
      <dc:date>2026-07-13T18:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198321#M171880</link>
      <description>&lt;P&gt;to pull off what you are describing, you'd have to write a custom routine for every block you want to insert.&amp;nbsp; That seems counter productive.&lt;/P&gt;
&lt;P&gt;There are other ways you could possibly do it, but not without some sort of interaction, perhaps creating a custom dialog box with some pull downs in it.&lt;/P&gt;
&lt;P&gt;Or, if they are all grouped by brand, you could setup shortcuts to set the block library path to go to that brand folder and then you choose the block from the palette.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2026 22:28:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198321#M171880</guid>
      <dc:creator>chriscowgill7373</dc:creator>
      <dc:date>2026-07-13T22:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198386#M171881</link>
      <description>&lt;P&gt;If it's not too impractical to &lt;STRONG&gt;put all the Blocks folders into your Support File Search Path list&lt;/STRONG&gt;, then you don't need any custom routine(s).&amp;nbsp; Start an &lt;STRONG&gt;-&lt;/STRONG&gt;INSERT command [in the command line instead of the dialog box because of the hyphen prefix], and type in the Block name, and it will find it without the need for you to navigate to it.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 00:50:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198386#M171881</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2026-07-14T00:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198990#M171882</link>
      <description>&lt;P&gt;So my previous company had this exact lisp routine where we would type the product name and it would find it automatically and we just drop it in. It was a game changer and truly made things 100% faster for sure&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 12:18:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198990#M171882</guid>
      <dc:creator>rfigueroa24PK4</dc:creator>
      <dc:date>2026-07-14T12:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198992#M171883</link>
      <description>&lt;P&gt;So my previous company had this exact lisp routine where we would type the product name and it would find it automatically and we just drop it in. It was a game changer and truly made things 100% faster&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 12:19:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198992#M171883</guid>
      <dc:creator>rfigueroa24PK4</dc:creator>
      <dc:date>2026-07-14T12:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198993#M171884</link>
      <description>&lt;P&gt;I just tried your method and it does not work.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 12:20:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14198993#M171884</guid>
      <dc:creator>rfigueroa24PK4</dc:creator>
      <dc:date>2026-07-14T12:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199148#M171886</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15616788"&gt;@rfigueroa24PK4&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So my previous company had this exact lisp routine where we would type the product name and it would find it ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And how did it work?&amp;nbsp; Was it something like: you enter its custom command name to call it up, and it asks for the product name?&amp;nbsp; Was the product name the same as the drawing file name to be Inserted as a Block?&amp;nbsp; If that's all, just put in &lt;STRONG&gt;-&lt;/STRONG&gt;INSERT instead of some custom command name, and it will ask you for a Block name.&amp;nbsp; No routine required, and no more work for the User, but for it to find things, it does require having all applicable folders included in the Support File Search Path list.&amp;nbsp; If the former routine didn't involve that, do you know anything about how it found files?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 14:04:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199148#M171886</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2026-07-14T14:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199156#M171887</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15616788"&gt;@rfigueroa24PK4&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I just tried your method and it does not work.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I can't trouble-shoot that, not having access to your folder structure or Support File Search Path list or exactly what you entered.&amp;nbsp; It works for me -- simply &lt;STRONG&gt;-&lt;/STRONG&gt;INSERT and the name of a drawing file that's in a folder in the list [without needing to spell out the file path], and in it comes.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; Also, "it does not work" &lt;STRONG&gt;&lt;EM&gt;is never enough information&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp; What happens?&amp;nbsp; What are you giving it, exactly?&amp;nbsp; How far does it get?&amp;nbsp; Are there any messages?&amp;nbsp; Etc., etc.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 14:14:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199156#M171887</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2026-07-14T14:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199396#M171896</link>
      <description>&lt;P&gt;What Kent is telling you is this...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you add the folder where your blocks live to your support file search path, it will work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Support Folder.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1650869i5EADF1A2133D52B1/image-size/large?v=v2&amp;amp;px=999" role="button" title="Support Folder.jpg" alt="Support Folder.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 16:48:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199396#M171896</guid>
      <dc:creator>apjones</dc:creator>
      <dc:date>2026-07-14T16:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199474#M171900</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/775056"&gt;@apjones&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;.... If you add the folder where your blocks live to your support file search path, it will work.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Theirs are not all in just one folder [see Message 1], but I don't think there's any limit to the number of folders that can be in the SFSP list.&amp;nbsp; The unlikely but possible problem would be if there could be parts &lt;EM&gt;in different brand folders&lt;/EM&gt; but &lt;EM&gt;with the same file name&lt;/EM&gt;.&amp;nbsp; In that case, the plain -INSERT and name approach will use the version in the folder that's highest in the list [the first one it finds].&amp;nbsp; But I assume that's unlikely because it would probably also have been a problem in their older routine if all they needed to give it was the name.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 18:01:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199474#M171900</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2026-07-14T18:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199545#M171909</link>
      <description>&lt;P&gt;If the product I wanted was "HD-RXC-4KZ-101" i would literally just type that name in and hit enter, click where i wanted on the screen and it would be inserted. that simple, nothing else. i just tried you method again by putting the folder path in the search file path in options and it gave me this message after trying to look up a device in the one-line standards blocks folder. That folder contains hundreds of other folders/models and each with multiple dwg files of devices/models.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rfigueroa24PK4_0-1784056682630.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1650894i7109C2F5D1EA8885/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rfigueroa24PK4_0-1784056682630.png" alt="rfigueroa24PK4_0-1784056682630.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 19:19:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199545#M171909</guid>
      <dc:creator>rfigueroa24PK4</dc:creator>
      <dc:date>2026-07-14T19:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199548#M171910</link>
      <description>&lt;P&gt;With that kind of folder structure, you might be better off just using the search option in Explorer, then drag/drop your (found) block into your dwg.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 19:26:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199548#M171910</guid>
      <dc:creator>DGCSCAD</dc:creator>
      <dc:date>2026-07-14T19:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199560#M171911</link>
      <description>&lt;P&gt;So even though there is a lisp routine that was created that can do exactly this, you are saying its easier to just do it through explorer and not use the lisp routine?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 19:33:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199560#M171911</guid>
      <dc:creator>rfigueroa24PK4</dc:creator>
      <dc:date>2026-07-14T19:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199585#M171915</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15616788"&gt;@rfigueroa24PK4&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If the product I wanted was "HD-RXC-4KZ-101" i would literally just type that name in ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I agree with the earlier comment that it sounds like you must have a whole separate custom command defined for each individual product, each knowing its own folder location.&amp;nbsp; Can that be the case, with hundreds of them?&amp;nbsp; Is there some big .lsp file containing all those routines?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2026 19:55:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199585#M171915</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2026-07-14T19:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199892#M171920</link>
      <description>&lt;P&gt;Me like the others, had like 500+ blocks each in a type directory, we would select the correct type and an image of the blocks would be displayed and say name, then choose. It uses a custom POP menu, written in notepad, a lisp was used to make images. Can provide more detail.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaHaven_0-1784090792193.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1650925i143887E137E78EE8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaHaven_0-1784090792193.png" alt="SeaHaven_0-1784090792193.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaHaven_1-1784090841660.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1650926i56D05FE7B1A11FDA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaHaven_1-1784090841660.png" alt="SeaHaven_1-1784090841660.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I agree with the others if you have all your blocks in one support path, then just typing correct should insert. The other way maybe is to enter a few characters and a matching list is displayed saves typos.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just a PS years ago a support path you added .. two periods at end and that meant look in sub directory also, "D:\Bigal\Blocks.." not sure if still supported in 26 etc. It was undocumented.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2026 04:53:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14199892#M171920</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2026-07-15T04:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14200396#M171925</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15616788"&gt;@rfigueroa24PK4&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;So even though there is a lisp routine that was created that can do exactly this, you are saying its easier to just do it through explorer and not use the lisp routine?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Just a suggestion for an alternate non-LISP solution, which would basically emulate the same functionality.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After a bit of a think, here's a quick outline of how a LISP function might work:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Create a list of those hundreds of folders located under the parent: vl-directory-files&lt;/LI&gt;&lt;LI&gt;Iterate through each item in the list: foreach&lt;/LI&gt;&lt;LI&gt;Look for your part: wcmatch&lt;/LI&gt;&lt;LI&gt;If found, insert&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I'm sure there are others here that can improve/expand upon that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2026 13:02:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14200396#M171925</guid>
      <dc:creator>DGCSCAD</dc:creator>
      <dc:date>2026-07-15T13:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14200715#M171928</link>
      <description>&lt;P&gt;Thank you, Ill look into this method as well.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2026 16:44:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14200715#M171928</guid>
      <dc:creator>rfigueroa24PK4</dc:creator>
      <dc:date>2026-07-15T16:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14201228#M171934</link>
      <description>&lt;P&gt;Maybe something like this. note hard coded for top directory.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/td-p/14198067
; look for block in a diretcory by name 
; By AlanH July 2026

(defun c:GetFolderDWGs ( / selectedFolder allDWGs dwgname dwgn)
(vl-load-com)
(defun FindDWGsRecursive (path / files)
    (if (/= (substr path (strlen path)) "\\")
      (setq path (strcat path "\\"))
    )
    (setq files (mapcar '(lambda (x) (strcat path x)) (vl-directory-files path "*.dwg" 1)))
    (foreach item (vl-directory-files path nil -1)
      (if (not (member item '("." "..")))
        (setq files (append files (FindDWGsRecursive (strcat path item))))
      )
    )
    files
)
(setq allDWGs (FindDWGsRecursive "D:\\autodesk\\blocks")) ; change to your top directory
(alert (strcat "Found  " (rtos (length alldwgs) 2 0) "  DWG Files:\n")) ; change alert to princ
(setq dwgname  (strcase (getstring "\nEnter block name " T)))
(foreach dwgn allDWGs
  (if (wcmatch (strcase dwgn) (strcat "*" dwgname "*"))
    (command "-insert" dwgn (getpoint "\nPick insertion point ") 1 1 0)
  )
)
  (princ)
)
(c:GetFolderDWGs)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS when testing 548 dwg's found.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2026 02:04:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14201228#M171934</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2026-07-16T02:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14201673#M171936</link>
      <description>&lt;P&gt;When I dropped it in it says "0 dwg's found". Is it maybe because when I read your routine it has a different folder path? I see this path in the lisp,&amp;nbsp;D:\\autodesk\\blocks"))&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2026 11:13:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14201673#M171936</guid>
      <dc:creator>rfigueroa24PK4</dc:creator>
      <dc:date>2026-07-16T11:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Library lisp routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14201708#M171937</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15616788"&gt;@rfigueroa24PK4&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;When I dropped it in it says "0 dwg's found". ....&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Read the end of Message 18's first sentence, and the comment at the end of line 19 in the code part.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2026 11:43:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/library-lisp-routine/m-p/14201708#M171937</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2026-07-16T11:43:47Z</dc:date>
    </item>
  </channel>
</rss>

