<?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: Table for block values in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852292#M67900</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3491796"&gt;@harsh&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a BLKOUT command to extract your blocks to csv file. (you can save it as xlsx and import it back to AutoCAD with TABLE command.)&lt;/P&gt;&lt;P&gt;blocks with the exact Name, xscale, yscale, zscale will be consider the same.&lt;/P&gt;&lt;P&gt;note that if there would be a small difference in scale, they will consider as 2, so blkout uses the current luprec (sysvar) to compare scales. this is 4 digits by default.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following code lines declares two constants:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333300"&gt;(setq &lt;FONT color="#0000FF"&gt;PREC&lt;/FONT&gt; (getvar "luprec"))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333300"&gt;(setq &lt;FONT color="#0000FF"&gt;FUZZ&lt;/FONT&gt; (read (strcat "1e-" (itoa PREC))))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PREC controls the scale precision format for the csv file. you can set a new luprec value in your drawing or hardcode it in the lisp. FUZZ is for the&amp;nbsp;scale&amp;nbsp;&lt;SPAN&gt;comparison&lt;/SPAN&gt;&amp;nbsp;and it leans on PREC but you can hardcode it as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that DIMZIN is effecting scale values.&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;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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(defun c:blkout (/ is_equal nformat ; local functions
                   PREC FUZZ fname ss elist bname item0 item1 data^ f)

 (defun is_equal (itm0 itm1)
  (vl-every
   '(lambda (a0 a1)
     (cond
      ((= (type a0) 'STR) 
       (eq a0 a1)
      ) 
      ( t
       (equal a0 a1 FUZZ)
      )
     ); cond
    )
   itm0 itm1
  )
 ); is_equal
  
 (defun nformat (v)
  (rtos v 2 PREC)
 )

 ; here start c:blkout
 ; 
 ; const
 (setq PREC (getvar "luprec"))
 (setq FUZZ (read (strcat "1e-" (itoa PREC))))
  
 (if (and
       (setq fname (getfiled "Excel file name" (vl-filename-base (getvar "dwgname")) "csv" 1))  
       (setq ss (ssget '((0 . "insert"))))
     )
  (progn
   (foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
    (setq elist (entget ename))
    (setq bname (strcase (cdr (assoc '2 elist))))
    (setq item0 (list bname (cdr (assoc '41 elist)) (cdr (assoc '42 elist)) (cdr (assoc '43 elist))))
     
    (if (and (setq item1 (assoc bname data^))
             (is_equal item0 (reverse (cdr (reverse item1))))
        )
     (progn
      (setq item0 (append item0 (list (1+ (last item1))))) ; inc by 1
      (setq data^ (cons item0 (vl-remove item1 data^)))    ; replace item in data^
     )
     (setq data^ (cons (append item0 (list 1)) data^))     ; append new item to data^
    )
   ); foreach

   ; create excel file
   (if (not (setq f (open fname "w")))
    (prompt (strcat "\nfail to open " fname " for write."))
    (progn
     (prompt (strcat "\nCreating file " fname))
     (write-line "Name,x scale,y scale,z scale,Nos" f) ; header
   
     (foreach item data^
      (write-line (strcat "\n" (car item) "," (nformat (cadr item)) "," (nformat (caddr item)) "," (nformat (cadddr item)) "," (rtos (last item) 2 0)) f)
     )

     (setq f (close f))
    ); progn
   ); if
  ); progn
 ); if

 (princ)   
); c:blkout&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 07 Nov 2020 10:51:04 GMT</pubDate>
    <dc:creator>Moshe-A</dc:creator>
    <dc:date>2020-11-07T10:51:04Z</dc:date>
    <item>
      <title>Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9850659#M67892</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;As a small estimation routene, I would like to extract block scale values&amp;nbsp; (not attributes)&amp;nbsp; into a table, and into excel.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My drawing is mostly created out of scaled blocks.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;From a selection window of items,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I would like to make out a table (and / or export to excel)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Block Name&lt;/P&gt;&lt;P&gt;X Scale&lt;/P&gt;&lt;P&gt;Y scale&lt;/P&gt;&lt;P&gt;Z scale&lt;/P&gt;&lt;P&gt;Number of items of each type&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wouldnt know if its possible, to automatically number the items in the drawing, and correspond them with the table and excel, so we can relate the item with the sheet&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use Autocad release 13&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions ???&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 15:31:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9850659#M67892</guid>
      <dc:creator>harsh</dc:creator>
      <dc:date>2020-11-06T15:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9851315#M67893</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3491796"&gt;@harsh&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could do it by your own with ATTEXT command (exist in AutoCAD almost from day 1). you can explore this command from the AutoCAD help or google&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is sample template file to extract block Name+XYZ+ XScale&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 20:39:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9851315#M67893</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2020-11-06T20:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9851948#M67894</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3491796"&gt;@harsh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I use &lt;STRONG&gt;Autocad release 13&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Are you serious right now?&amp;nbsp;&lt;/FONT&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;FONT size="3"&gt;&amp;nbsp; a version for MS-DOS and Windows 3.11.?&amp;nbsp; The lowest version i can save a dwg file is 2004 using DWG TrueView.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;or is that Autocad 2013 (Jaws)?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 04:07:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9851948#M67894</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2020-11-07T04:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9851989#M67895</link>
      <description>&lt;P&gt;2 suggestions, add a number attribute to your block, second is have a look at this post should give good ideas about quantities.&amp;nbsp;&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/list-sorting-strings/td-p/9848596" target="_blank"&gt;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/list-sorting-strings/td-p/9848596&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 04:50:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9851989#M67895</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2020-11-07T04:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852075#M67896</link>
      <description>&lt;P&gt;Yes chief,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feel release 13 gives you all the basic tools for working. Anything more is Lisp-able.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do elaborate if you feel otherwise.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AutoCad cost in our country is pretty high, and the yearly lease now is very high. In fact many users are shifting to cheaper non Autodesk clones.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And yes, I too need to bring down the version when I receive upper release drawings. But the DWG Trueview convert is free&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>Sat, 07 Nov 2020 06:38:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852075#M67896</guid>
      <dc:creator>harsh</dc:creator>
      <dc:date>2020-11-07T06:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852092#M67897</link>
      <description>&lt;P&gt;Thanks Moshe, for your suggestion...&lt;/P&gt;&lt;P&gt;But I am looking for a routine where you can choose a bunch of blocks, and create a table like this :&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x scale&amp;nbsp; &amp;nbsp; &amp;nbsp;y scale&amp;nbsp; &amp;nbsp; z scale&amp;nbsp; &amp;nbsp; Nos&lt;BR /&gt;Block 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2000&amp;nbsp; &amp;nbsp; &amp;nbsp; 20&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&lt;/P&gt;&lt;P&gt;Block 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 600&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30&lt;BR /&gt;Block 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;600&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1800&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on....&lt;BR /&gt;And this could have an option to create a table in autocad itself, or a csv file for excel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 06:56:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852092#M67897</guid>
      <dc:creator>harsh</dc:creator>
      <dc:date>2020-11-07T06:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852164#M67898</link>
      <description>&lt;P&gt;Dear sea.haven,&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your suggestion... but i feel the thread you had referred to would not help the routine i am looking for ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Without going into attributes to "complicate" anything for me,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to insert a basic different material blocks of 1mmx1mmx1mm, and while inserting, i would scale up the x/y/z values to get the size i need. Eventually i would like to extract the blocks as different materials, and get the dimensions from the x/y/z values along with the numbers of those blocks and do the rest of the calculations in excel.&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>Sat, 07 Nov 2020 08:49:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852164#M67898</guid>
      <dc:creator>harsh</dc:creator>
      <dc:date>2020-11-07T08:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852190#M67899</link>
      <description>&lt;P&gt;ooops..... i meant autocad 2013.....&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;although i must confess, i did start with autocad release 10 officially.... and probably tested the version 2.6 in the year 1988 .....on an AT-386 PC......&amp;nbsp; &amp;nbsp; a few generations ago...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My mistake in interpretation ... apologies&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 08:56:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852190#M67899</guid>
      <dc:creator>harsh</dc:creator>
      <dc:date>2020-11-07T08:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852292#M67900</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3491796"&gt;@harsh&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a BLKOUT command to extract your blocks to csv file. (you can save it as xlsx and import it back to AutoCAD with TABLE command.)&lt;/P&gt;&lt;P&gt;blocks with the exact Name, xscale, yscale, zscale will be consider the same.&lt;/P&gt;&lt;P&gt;note that if there would be a small difference in scale, they will consider as 2, so blkout uses the current luprec (sysvar) to compare scales. this is 4 digits by default.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following code lines declares two constants:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333300"&gt;(setq &lt;FONT color="#0000FF"&gt;PREC&lt;/FONT&gt; (getvar "luprec"))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#333300"&gt;(setq &lt;FONT color="#0000FF"&gt;FUZZ&lt;/FONT&gt; (read (strcat "1e-" (itoa PREC))))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PREC controls the scale precision format for the csv file. you can set a new luprec value in your drawing or hardcode it in the lisp. FUZZ is for the&amp;nbsp;scale&amp;nbsp;&lt;SPAN&gt;comparison&lt;/SPAN&gt;&amp;nbsp;and it leans on PREC but you can hardcode it as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that DIMZIN is effecting scale values.&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;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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(defun c:blkout (/ is_equal nformat ; local functions
                   PREC FUZZ fname ss elist bname item0 item1 data^ f)

 (defun is_equal (itm0 itm1)
  (vl-every
   '(lambda (a0 a1)
     (cond
      ((= (type a0) 'STR) 
       (eq a0 a1)
      ) 
      ( t
       (equal a0 a1 FUZZ)
      )
     ); cond
    )
   itm0 itm1
  )
 ); is_equal
  
 (defun nformat (v)
  (rtos v 2 PREC)
 )

 ; here start c:blkout
 ; 
 ; const
 (setq PREC (getvar "luprec"))
 (setq FUZZ (read (strcat "1e-" (itoa PREC))))
  
 (if (and
       (setq fname (getfiled "Excel file name" (vl-filename-base (getvar "dwgname")) "csv" 1))  
       (setq ss (ssget '((0 . "insert"))))
     )
  (progn
   (foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
    (setq elist (entget ename))
    (setq bname (strcase (cdr (assoc '2 elist))))
    (setq item0 (list bname (cdr (assoc '41 elist)) (cdr (assoc '42 elist)) (cdr (assoc '43 elist))))
     
    (if (and (setq item1 (assoc bname data^))
             (is_equal item0 (reverse (cdr (reverse item1))))
        )
     (progn
      (setq item0 (append item0 (list (1+ (last item1))))) ; inc by 1
      (setq data^ (cons item0 (vl-remove item1 data^)))    ; replace item in data^
     )
     (setq data^ (cons (append item0 (list 1)) data^))     ; append new item to data^
    )
   ); foreach

   ; create excel file
   (if (not (setq f (open fname "w")))
    (prompt (strcat "\nfail to open " fname " for write."))
    (progn
     (prompt (strcat "\nCreating file " fname))
     (write-line "Name,x scale,y scale,z scale,Nos" f) ; header
   
     (foreach item data^
      (write-line (strcat "\n" (car item) "," (nformat (cadr item)) "," (nformat (caddr item)) "," (nformat (cadddr item)) "," (rtos (last item) 2 0)) f)
     )

     (setq f (close f))
    ); progn
   ); if
  ); progn
 ); if

 (princ)   
); c:blkout&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 10:51:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852292#M67900</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2020-11-07T10:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852390#M67901</link>
      <description>&lt;P&gt;Dear Moshe,&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is brilliant !!!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me test this program in a real world situation and revert&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;many thanks !!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 12:16:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852390#M67901</guid>
      <dc:creator>harsh</dc:creator>
      <dc:date>2020-11-07T12:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852396#M67902</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3491796"&gt;@harsh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;AutoCad cost in our country is pretty high, and the yearly lease now is very high. In fact many users are shifting to cheaper non Autodesk clones.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;ooops..... i meant autocad 2013.....&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;No worries, i know you meant 2013, just playing with you&lt;/FONT&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;And because you apolgize, I will write a quick code for you.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 12:16:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852396#M67902</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2020-11-07T12:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852489#M67903</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;i will take you up on that !!!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers !!!!&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I not only apologise, i also am very grateful to all you guys for your help !!!! )&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>Sat, 07 Nov 2020 13:38:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852489#M67903</guid>
      <dc:creator>harsh</dc:creator>
      <dc:date>2020-11-07T13:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852577#M67904</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3491796"&gt;@harsh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;i will take you up on that !!!!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;HYG&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:BlkInfo ( / _rtos collection SaveFile ss ent data XYZ f fv pts)
(setq _rtos (lambda (n)(rtos n 2 0)))
 (if (and
       (setq collection nil
	      SaveFile (getfiled "Enter file name" (strcat (Getvar 'dwgprefix)
				(vl-filename-base (getvar 'dwgname))) "csv" 1))  
       (setq ss (ssget '((0 . "INSERT"))))
     )
   (progn
   	(repeat (setq i (sslength ss))
	  (setq ent (entget (ssname ss (setq i (1- i)))))
	  (setq data (mapcar '(lambda (d) (cdr (assoc d ent))) '(2 41 42 43)))
	  (setq XYZ (mapcar '_rtos (Cdr data)))
	  
	  (setq collection
		 (if (and
		       (setq f (assoc (car data)  collection))
		       (setq fv (equal (car (cadr f)) XYZ ))
		       (setq fv (list (Car f) (cons XYZ (1+ (cdr (cadr f))))))
		       )
		   	(subst fv f collection)
		   	(cons (list
				(Car data)
					(cons XYZ 1)) collection)
		   )
		)
	  )
	(setq opf (open SaveFile "w"))
     	(Write-line "Name,X Scale,Y Scale,Z Scale,Nos" opf)
     	(foreach itm collection
	  (setq pts (caadr itm) q (cdadr itm))
	  (Write-line (strcat (car itm)	"," (car pts) ","
			      (cadr pts) "," (caddr pts) "," (_rtos q)) opf))
     	(Close opf)
      ;;(startapp "notepad" SaveFile)
     )
   )
(princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 14:30:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9852577#M67904</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2020-11-07T14:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9856151#M67905</link>
      <description>&lt;P&gt;Pbsje and Moshe,&lt;/P&gt;&lt;P&gt;The programs work wonderfully !!!! what can i say, you guys are mentors, and are the best !!!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many many thanks !!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;its really going to help me in my work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope i am able to take you guys out for a drink someday !!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers !!!!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 15:20:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9856151#M67905</guid>
      <dc:creator>harsh</dc:creator>
      <dc:date>2020-11-09T15:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9932465#M67906</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp; and &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747"&gt;@Moshe-A&lt;/a&gt;&amp;nbsp;.....&lt;/P&gt;&lt;P&gt;I have a strange issue with the program above.......&lt;/P&gt;&lt;P&gt;if i count the blocks in autocad, it shows a different number to the one extracted in excel.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cant put a finger on why this is happening....&amp;nbsp;&lt;/P&gt;&lt;P&gt;any suggestions on where i am going wrong ????&lt;/P&gt;&lt;P&gt;I am attaching a block drawing with a count, and the extracted .csv sheet.....&lt;/P&gt;&lt;P&gt;autocad shows the number at 90, and the extraction shows 174..... (Pbeje)&lt;/P&gt;&lt;P&gt;autocad shows the number at 90, and the extraction shows&amp;nbsp; 59..... (MosheA)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;very strange....&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 13:03:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9932465#M67906</guid>
      <dc:creator>harsh</dc:creator>
      <dc:date>2020-12-11T13:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9932615#M67907</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:BlkInfo ( / _rtos collection SaveFile ss ent data XYZ f fv pts)
(setq _rtos (lambda (n)(rtos n 2 0)))
 (if (and
       (setq collection nil
	      SaveFile (getfiled "Enter file name" (strcat (Getvar 'dwgprefix)
				(vl-filename-base (getvar 'dwgname))) "csv" 1))  
       (setq ss (ssget '((0 . "INSERT"))))
     )
   (progn
   	(repeat (setq i (sslength ss))
	  (setq ent (entget (ssname ss (setq i (1- i)))))
	  (setq data (mapcar '(lambda (d) (cdr (assoc d ent))) '(2 41 42 43)))
	  (setq XYZ (mapcar '_rtos (Cdr data)))
	  
	  (setq collection
		 (if 
		       (setq f (vl-some '(lambda (d)
					   (if (and (eq (car data) (car d))
							(equal (caadr d) XYZ)) d))
				 collection))
		   	(subst (list (Car f) (cons XYZ (1+ (cdr (cadr f))))) f collection)
		   	(cons (list
				(Car data)
					(cons XYZ 1)) collection)
		   )
		)
	  )
	(setq opf (open SaveFile "w"))
     	(Write-line "Name,X Scale,Y Scale,Z Scale,Nos" opf)
     	(foreach itm collection
	  (setq pts (caadr itm) q (cdadr itm))
	  (Write-line (strcat (car itm)	"," (car pts) ","
			      (cadr pts) "," (caddr pts) "," (_rtos q)) opf))
     	(Close opf)
      ;;(startapp "notepad" SaveFile)
     )
   )
(princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;AND in case you are using Dynamic blocks&lt;/STRONG&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(defun c:BlkInfo ( / _rtos collection SaveFile ss ent bnm data XYZ f fv pts)
(setq _rtos (lambda (n)(rtos n 2 0)))
 (if (and
       (setq collection nil
	      SaveFile (getfiled "Enter file name" (strcat (Getvar 'dwgprefix)
				(vl-filename-base (getvar 'dwgname))) "csv" 1))  
       (setq ss (ssget '((0 . "INSERT"))))
     )
   (progn
   	(repeat (setq i (sslength ss))
	  (setq ent (entget (setq e (ssname ss (setq i (1- i))))))
	  (setq bnm (getpropertyvalue e "BlockTableRecord/Name"))
	  (setq data (mapcar '(lambda (d) (cdr (assoc d ent))) '(41 42 43)))
	  (setq XYZ (mapcar '_rtos data))
	  
	  (setq collection
		 (if 
		       (setq f (vl-some '(lambda (d)
					   (if (and (eq bnm (car d))
							(equal (caadr d) XYZ)) d))
				 collection))
		   	(subst (list (Car f) (cons XYZ (1+ (cdr (cadr f))))) f collection)
		   	(cons (list
				bnm
					(cons XYZ 1)) collection)
		   )
		)
	  )
	(setq opf (open SaveFile "w"))
     	(Write-line "Name,X Scale,Y Scale,Z Scale,Nos" opf)
     	(foreach itm collection
	  (setq pts (caadr itm) q (cdadr itm))
	  (Write-line (strcat (car itm)	"," (car pts) ","
			      (cadr pts) "," (caddr pts) "," (_rtos q)) opf))
     	(Close opf)
      (startapp "notepad" SaveFile)
     )
   )
(princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 14:12:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9932615#M67907</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2020-12-11T14:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Table for block values</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9937693#M67908</link>
      <description>&lt;P&gt;Chief !!!! tried the normal block info ..... And it works !!!!! and better than before !!!!&lt;/P&gt;&lt;P&gt;Thank you sooooo much once again !!!!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2020 07:51:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-for-block-values/m-p/9937693#M67908</guid>
      <dc:creator>harsh</dc:creator>
      <dc:date>2020-12-14T07:51:56Z</dc:date>
    </item>
  </channel>
</rss>

