<?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: How to expand .lsp file function from currently open drawing to whole project? in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12551879#M18015</link>
    <description>&lt;P&gt;If you want 1 file across multi dwg's, add dwg name to file output you can use "A" rather than "W" for file, "A" is append, but you will need to probably for simplicity hard code an output filename. A side note if to Excel is required could write direct to Excel.&lt;/P&gt;</description>
    <pubDate>Sat, 10 Feb 2024 00:19:49 GMT</pubDate>
    <dc:creator>Sea-Haven</dc:creator>
    <dc:date>2024-02-10T00:19:49Z</dc:date>
    <item>
      <title>How to expand .lsp file function from currently open drawing to whole project?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12549581#M18011</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm super new to all of this, so I'm sorry if it seems like a stupid question. I am writing a LISP file that&amp;nbsp;&lt;SPAN&gt;exports all blocks' x and y position data in the currently open AutoCAD Electrical drawing. Is there a way to change it from the currently open drawing to iterating or looping through all of the drawings in a specific folder or .wdp project file?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is my current code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(defun c:ExportBlockPositionData ()&lt;BR /&gt;(setq file (getfiled "Select File to Save" "" "csv" 1))&lt;BR /&gt;(setq blk_list '())&lt;BR /&gt;(setq ss (ssget "_X" '((0 . "INSERT"))))&lt;BR /&gt;&lt;BR /&gt;(if ss&lt;BR /&gt;(progn&lt;BR /&gt;(setq count (sslength ss))&lt;BR /&gt;(setq output_string "Block Name,X Position,Y Position\n")&lt;BR /&gt;&lt;BR /&gt;(setq i 0)&lt;BR /&gt;(while (&amp;lt; i count)&lt;BR /&gt;(setq blk (ssname ss i))&lt;BR /&gt;(setq blk_name (cdr (assoc 2 (entget blk))))&lt;BR /&gt;(setq blk_pos (cdr (assoc 10 (entget blk))))&lt;BR /&gt;&lt;BR /&gt;(setq output_string (strcat output_string blk_name "," (rtos (car blk_pos) 2 2) "," (rtos (cadr blk_pos) 2 2) "\n"))&lt;BR /&gt;&lt;BR /&gt;(setq i (1+ i))&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;(setq file_id (open file "w"))&lt;BR /&gt;(write-char (ascii "sep=,\n") file_id) ; Excel separator&lt;BR /&gt;(write-line output_string file_id)&lt;BR /&gt;(close file_id)&lt;BR /&gt;&lt;BR /&gt;(princ "\nBlock position data exported successfully.")&lt;BR /&gt;)&lt;BR /&gt;(princ "\nNo blocks found in the drawing.")&lt;BR /&gt;)&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 21:43:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12549581#M18011</guid>
      <dc:creator>iedwards17</dc:creator>
      <dc:date>2024-02-08T21:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to expand .lsp file function from currently open drawing to whole project?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12549730#M18012</link>
      <description>&lt;P&gt;Excellent question. You'll just have to &lt;STRONG&gt;Script&lt;/STRONG&gt; this on all of drawings in a folder.&lt;/P&gt;&lt;P&gt;First of all for this code to run in a &lt;STRONG&gt;Script&lt;/STRONG&gt; you just need to change this line which brings up a selection window:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq file (getfiled "Select File to Save" "" "csv" 1))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To this line which just uses the drawing folder &amp;amp; file name as the csv file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(vl-load-com)(setq file (strcat(getvar "dwgprefix")(vl-filename-base (getvar"dwgname")) ".csv") ; saves csv file matching folder &amp;amp; drawing name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next install something like &lt;A href="https://www.lee-mac.com/scriptwriter.html" target="_blank" rel="noopener"&gt;Script Writer&amp;nbsp;&lt;/A&gt;which allows you to run a series of commands on all drawings in a selected folder:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paullimapa_0-1707435267119.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1324141iFE36DD5CE4A9E6C2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="paullimapa_0-1707435267119.png" alt="paullimapa_0-1707435267119.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In your case the&amp;nbsp;&lt;STRONG&gt;Script Line&lt;/STRONG&gt; in the above window would look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;_.Open *file* (load"ExportBlockPositionData") ExportBlockPositionData _.Close&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 23:40:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12549730#M18012</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-02-08T23:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to expand .lsp file function from currently open drawing to whole project?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12550782#M18013</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1137264"&gt;@paullimapa&lt;/a&gt;&amp;nbsp;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 13:26:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12550782#M18013</guid>
      <dc:creator>iedwards17</dc:creator>
      <dc:date>2024-02-09T13:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to expand .lsp file function from currently open drawing to whole project?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12550865#M18014</link>
      <description>&lt;P&gt;Glad to have helped…cheers!!!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 13:58:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12550865#M18014</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-02-09T13:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to expand .lsp file function from currently open drawing to whole project?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12551879#M18015</link>
      <description>&lt;P&gt;If you want 1 file across multi dwg's, add dwg name to file output you can use "A" rather than "W" for file, "A" is append, but you will need to probably for simplicity hard code an output filename. A side note if to Excel is required could write direct to Excel.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2024 00:19:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-expand-lsp-file-function-from-currently-open-drawing-to/m-p/12551879#M18015</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-02-10T00:19:49Z</dc:date>
    </item>
  </channel>
</rss>

