<?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: vlax-for block collection in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864801#M107131</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3499869"&gt;@DGRL&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Coding in Visual lisp trying to get complete list of all entities inside block ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you're looking for all entities in a &lt;EM&gt;specific individual &lt;/EM&gt;&amp;nbsp;Block definition, you can do this [here for a Block named "test"]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(setq ent (tblobjname "block" "test"))
(while (setq ent (entnext ent))
  (prompt (strcat "\n" (cdr (assoc 0 (entget ent)))))
)
(princ)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your code does not specify a particular Block &lt;EM&gt;name&lt;/EM&gt;, maybe you're after something different.&amp;nbsp; Are you looking for all entities in all Block &lt;EM&gt;definitions?&lt;/EM&gt;&amp;nbsp; Or all entities in all Block &lt;EM&gt;references/insertions?&lt;/EM&gt;&amp;nbsp; That is, if a Block definition contains a Circle, and that Block is inserted four times, do you want the return to include &lt;EM&gt;one&lt;/EM&gt;&amp;nbsp; Circle [for the one in the definition] or &lt;EM&gt;all four&lt;/EM&gt;&amp;nbsp; Circles [the one in each Block insertion listed separately]?&lt;/P&gt;</description>
    <pubDate>Mon, 19 Mar 2018 13:08:10 GMT</pubDate>
    <dc:creator>Kent1Cooper</dc:creator>
    <dc:date>2018-03-19T13:08:10Z</dc:date>
    <item>
      <title>vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864632#M107130</link>
      <description>&lt;P&gt;Dear coders&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Coding in Visual lisp trying to get complete list of all entities inside block using the vlax-for method&lt;/P&gt;&lt;P&gt;This is the code I use ( gives back all items in dwg ( model and layouts) )&lt;/P&gt;&lt;P&gt;Why does this code gives back all entities in the dwg instead of the entities inside the block?&lt;/P&gt;&lt;P&gt;I used the vla-get-blocks for active document&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    ;; Get the Blocks collection
    (vlax-for blkColl (vla-get-Blocks doc)
		(vlax-for blkobj blkColl
		
			(setq ename (vlax-vla-object-&amp;gt;ename blkobj))
			(print (entget ename))	
		
		)
    )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the list I get back now&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(0 . "INSERT")&lt;BR /&gt;(0 . "LINE")&lt;BR /&gt;(0 . "LINE")&amp;nbsp; &amp;lt;-- BLOCK ENTITY&lt;BR /&gt;(0 . "CIRCLE")&amp;nbsp; &amp;lt;-- BLOCK ENTITY&lt;BR /&gt;(0 . "VIEWPORT")&lt;BR /&gt;(0 . "VIEWPORT")&lt;BR /&gt;(0 . "VIEWPORT")&lt;BR /&gt;(0 . "VIEWPORT")&lt;BR /&gt;(0 . "LWPOLYLINE")&amp;nbsp; &amp;lt;-- BLOCK ENTITY&lt;BR /&gt;(0 . "TEXT")&amp;nbsp;&amp;lt;-- BLOCK ENTITY&lt;BR /&gt;(0 . "LINE")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;3 block entities and rest is in model space&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 12:22:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864632#M107130</guid>
      <dc:creator>DGRL</dc:creator>
      <dc:date>2018-03-19T12:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864801#M107131</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3499869"&gt;@DGRL&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Coding in Visual lisp trying to get complete list of all entities inside block ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you're looking for all entities in a &lt;EM&gt;specific individual &lt;/EM&gt;&amp;nbsp;Block definition, you can do this [here for a Block named "test"]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(setq ent (tblobjname "block" "test"))
(while (setq ent (entnext ent))
  (prompt (strcat "\n" (cdr (assoc 0 (entget ent)))))
)
(princ)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your code does not specify a particular Block &lt;EM&gt;name&lt;/EM&gt;, maybe you're after something different.&amp;nbsp; Are you looking for all entities in all Block &lt;EM&gt;definitions?&lt;/EM&gt;&amp;nbsp; Or all entities in all Block &lt;EM&gt;references/insertions?&lt;/EM&gt;&amp;nbsp; That is, if a Block definition contains a Circle, and that Block is inserted four times, do you want the return to include &lt;EM&gt;one&lt;/EM&gt;&amp;nbsp; Circle [for the one in the definition] or &lt;EM&gt;all four&lt;/EM&gt;&amp;nbsp; Circles [the one in each Block insertion listed separately]?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 13:08:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864801#M107131</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2018-03-19T13:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864873#M107132</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am seeking for is this,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 basic function to get all entities of&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;&lt;U&gt;an&lt;/U&gt;&lt;/EM&gt;&lt;/STRONG&gt; block&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do I want to do?&lt;/P&gt;&lt;P&gt;I want to get/select all the&amp;nbsp;Blocks in the dwg and then process its entities&lt;/P&gt;&lt;P&gt;If 1 block is inserted 4 times then I want that block as 4 separate items in the list to process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. select all blocks in dwg&lt;/P&gt;&lt;P&gt;2. get all entities per block and do something with it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to learn the vlax-for function&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 13:37:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864873#M107132</guid>
      <dc:creator>DGRL</dc:creator>
      <dc:date>2018-03-19T13:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864913#M107133</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question I want to ask you&lt;BR /&gt;Its for me to learn from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you look at the code below&lt;/P&gt;&lt;P&gt;It makes a selection of all the blocks correct?&amp;nbsp; (i.e&amp;nbsp; vla-get-blocks)&lt;/P&gt;&lt;P&gt;If I run this code it prints the entget&lt;/P&gt;&lt;P&gt;Why do I see non block items in the list that is printed?&lt;BR /&gt;even though I did not made a selection based on block name I did only selected blocks or am I wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for blk (vla-get-blocks doc)
		;(if (= :vlax-false (vla-get-isxref blk))
		;(if (= blk "aTitle Block")(print "YES")(print blk))
		;(print blk)
			(vlax-for obj blk
			
			(setq ename (vlax-vla-object-&amp;gt;ename obj))
			(print (entget ename))	
				
			); end of vlax-for obj blk
		;)
	(princ)
); end of vlax-for blk&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 13:49:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864913#M107133</guid>
      <dc:creator>DGRL</dc:creator>
      <dc:date>2018-03-19T13:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864924#M107134</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3499869"&gt;@DGRL&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT color="#1858a8" style="background-color: rgb(247, 247, 247);"&gt;....&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 basic function to get all entities of&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;&lt;U&gt;an&lt;/U&gt;&lt;/EM&gt;&lt;/STRONG&gt; block&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do I want to do?&lt;/P&gt;
&lt;P&gt;I want to get/select all the&amp;nbsp;Blocks in the dwg and then process its entities&lt;/P&gt;
&lt;P&gt;If 1 block is inserted 4 times then I want that block as 4 separate items in the list to process.&lt;/P&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand.&amp;nbsp; If you "process" the entities in the definition of a Block that is inserted 4 times, they will change in all&amp;nbsp;4 Block insertions -- you don't need to process them in each Block insertion separately.&amp;nbsp; If you want to process those in one insertion &lt;EM&gt;differently&lt;/EM&gt;&amp;nbsp; from those in other insertions, then you'll&amp;nbsp;have to Explode the Blocks, or you'll have to play with dynamic Blocks and visibility states or something, in which case you'll still only process the entities in the Block definition once, and then the differences between insertions will&amp;nbsp;have to be done by processing the Block&lt;EM&gt; insertions&lt;/EM&gt;, not the entities in them.&amp;nbsp; Am I misunderstanding?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 13:50:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864924#M107134</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2018-03-19T13:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864939#M107135</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quote&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;" If you "process" the entities in the definition of a Block that is inserted 4 times, they will change in all&amp;nbsp;4 Block insertions&amp;nbsp;"&lt;BR /&gt;&lt;BR /&gt;This is not true as blocks with attributes can be inserted hundreds of times and still containing different text strings.&lt;/P&gt;&lt;P&gt;This is only for ATRIBS as far as i know&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 14:20:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7864939#M107135</guid>
      <dc:creator>DGRL</dc:creator>
      <dc:date>2018-03-19T14:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865047#M107136</link>
      <description>&lt;P&gt;Got what I need to begin with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	(if
		(and
			(setq sel (entsel "Select a block: "))
			(= (cdr (assoc 0 (setq nfo (entget (car sel))))) "INSERT")
		)
		(vlax-for item
			(vla-item
				(vla-get-blocks
					(vla-get-activedocument
						(vlax-get-acad-object)
					)
				)
				(cdr (assoc 2 nfo))
			)
			(setq items (cons (vlax-vla-object-&amp;gt;ename item) items))
		)
		(prompt "\nNo block selected.")
	)&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 14:28:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865047#M107136</guid>
      <dc:creator>DGRL</dc:creator>
      <dc:date>2018-03-19T14:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865048#M107137</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(vla-get-Blocks doc) returns the block table collection which contains all block definitions plus the layouts blocks (paper and model space).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to only get entities within block definitions, you have to discard layout blocks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vlax-for block	(vla-get-Blocks doc)
  (if (and (= (vla-get-IsLayout block) :vlax-false)
	   (= (vla-get-IsXref block) :vlax-false)
      )
    (vlax-for obj block
      ...
    )
  )
)&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 14:29:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865048#M107137</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-03-19T14:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865071#M107138</link>
      <description>&lt;P&gt;While playing with vla* functions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(if (and (setq ent (car (entsel)))
	 (setq obj (vlax-ename-&amp;gt;vla-object ent))
	 (= (vla-get-ObjectName obj) "AcDbBlockReference")
    )
  (vlax-for obj	(vla-Item (vla-get-Blocks doc) (vla-get-Name obj))
    ...
  )
)&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 14:33:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865071#M107138</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-03-19T14:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865197#M107139</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have to go now but a quick test gave back an error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; error: ActiveX Server returned the error: unknown name: Blocks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will look at it at home&lt;/P&gt;&lt;P&gt;BRB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 15:07:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865197#M107139</guid>
      <dc:creator>DGRL</dc:creator>
      <dc:date>2018-03-19T15:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865349#M107140</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(vla-get-Blocks doc) returns the block table collection which contains all block definitions plus the layouts blocks (paper and model space).&lt;/P&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;But that doesn't seem to be the case.&amp;nbsp; It seems to return more than that -- not only Blocks and the pieces in them and Layouts, but also other objects [maybe &lt;EM&gt;all&lt;/EM&gt;&amp;nbsp; other objects?] that are neither Blocks nor parts of Block definitions nor Layouts.&amp;nbsp; See the two Line entities that are not identified as Block entities in Post 1, and I've confirmed the same with a little experimentation.&amp;nbsp; Since the AutoLisp Reference doesn't cover (vla-...) functions [though it does cover (vl-...) and (vlax-...) and (vlr-...) functions], I don't know how to find out &lt;EM&gt;what (vla-get-Blocks) actually returns&lt;/EM&gt;, but it seems clearly &lt;EM&gt;not&lt;/EM&gt;&amp;nbsp; to be as&amp;nbsp;described above.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 15:52:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865349#M107140</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2018-03-19T15:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865373#M107141</link>
      <description>&lt;DIV style="line-height: 1.3em; margin: 15px 100px 100px 65px;"&gt;Perhaps &lt;A href="https://jtbworld.com/autocad-axblock-lsp" style="text-decoration: none; border-bottom: 1px dotted #222;" target="_blank"&gt;the code here&lt;/A&gt; would help out?&lt;/DIV&gt;</description>
      <pubDate>Mon, 19 Mar 2018 15:57:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865373#M107141</guid>
      <dc:creator>rkmcswain</dc:creator>
      <dc:date>2018-03-19T15:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865668#M107142</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(vla-get-Blocks doc) returns the block table collection which contains all block definitions plus the layouts blocks (paper and model space).&lt;/P&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;But that doesn't seem to be the case.&amp;nbsp; It seems to return more than that -- not only Blocks and the pieces in them and Layouts, but also other objects [maybe &lt;EM&gt;all&lt;/EM&gt;&amp;nbsp; other objects?] that are neither Blocks nor parts of Block definitions nor Layouts.&amp;nbsp; See the two Line entities that are not identified as Block entities in Post 1, and I've confirmed the same with a little experimentation.&amp;nbsp; Since the AutoLisp Reference doesn't cover (vla-...) functions [though it does cover (vl-...) and (vlax-...) and (vlr-...) functions], I don't know how to find out &lt;EM&gt;what (vla-get-Blocks) actually returns&lt;/EM&gt;, but it seems clearly &lt;EM&gt;not&lt;/EM&gt;&amp;nbsp; to be as&amp;nbsp;described above.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes it is.&lt;/P&gt;
&lt;P&gt;You can get the docs for the vla* function in the ActiveX Documentation.&lt;/P&gt;
&lt;P&gt;You can also simply select vla-get-Blocks in the VLIDE and hit Ctrl+F1 which will open the ActiveX Reference Guide at the Blocks topic.&lt;/P&gt;
&lt;P&gt;Here's the &lt;A href="http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-E77CC5AD-74B8-472C-8270-32FD162D5653" target="_blank"&gt;Blocks topic&lt;/A&gt; in the in line ActiveX Reference Guide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, (vlax-for block (vla-ge-Blocks doc) ... )iterates through all the block table collection, just try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vlax-for block	(vla-get-Blocks
		  (vla-get-ActiveDocument
		    (vlax-get-acad-object)
		  )
		)
  (princ (strcat "\n" (vla-get-Name block)))
)&lt;/PRE&gt;
&lt;P&gt;Then, while doing (vlax-for block (vla-ge-Blocks doc) (vlax-for obj block ...)) iterates through all objects in all block defintions and spaces of the drawing (i.e. all graphic entities of the drawing).&lt;/P&gt;
&lt;P&gt;Just try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vlax-for block	(vla-get-Blocks
		  (vla-get-ActiveDocument
		    (vlax-get-acad-object)
		  )
		)
  (princ (strcat "\n" (vla-get-Name block)))
  (vlax-for obj	block
    (princ (strcat "\n\t" (vla-get-ObjectName obj)))
  )
)&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 17:26:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865668#M107142</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-03-19T17:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865981#M107143</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May i ask you why the result of this code is giving me back all the objects in model incl. nested objects&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Get the Blocks collection
    (vlax-for blkColl (vla-get-Blocks doc)

		(vlax-for blkobj blkColl
		
			(setq ename (vlax-vla-object-&amp;gt;ename blkobj))
			(print (entget ename))	
		
		)
    )

This code gives back a list of all objects in model incl layouts and viewports
Including nested objects &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While this code only gives back my block collection&lt;/P&gt;&lt;PRE&gt;(vlax-for block	(vla-get-Blocks
		  (vla-get-ActiveDocument
		    (vlax-get-acad-object)
		  )
		)
  (princ (strcat "\n" (vla-get-Name block)))
)&lt;/PRE&gt;&lt;PRE&gt;Gives back per block &amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 18:56:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7865981#M107143</guid>
      <dc:creator>DGRL</dc:creator>
      <dc:date>2018-03-19T18:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7866171#M107144</link>
      <description>&lt;P&gt;I'll try an explanation.&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;You must try to see an AutoCAD drawing as a database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This database contains several tables including the block table that contains all the block objects (called Block in the COM / ActiveX API used by the vla * function, or BlockTableRecord in .NET or AcDbBlockTableRecord in ObjectARX).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This includes block definitions, object and paper spaces.&lt;/SPAN&gt;&lt;BR /&gt;Each block object is a container for graphic entities (circles, lines, block references, ...), in other words, in AutoCAD, any graphic entity belongs to a Block ob&lt;/SPAN&gt;ject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3499869"&gt;@DGRL&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May i ask you why the result of this code is giving me back all the objects in model incl. nested objects&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Get the Blocks collection
    (vlax-for blkColl (vla-get-Blocks doc)

      (vlax-for blkobj blkColl&lt;BR /&gt;        ...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While this code only gives back my block collection&lt;/P&gt;
&lt;PRE&gt;(vlax-for block	(vla-get-Blocks
		  (vla-get-ActiveDocument
		    (vlax-get-acad-object)
		  )
		)
  ...&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Because in the first one, you iterate through each entity of each Block object in the block table.&lt;/P&gt;
&lt;P&gt;And in the second, you are only iterating through each Block object in the block table.&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;PRE&gt;(vlax-for block (vla-get-Blocks doc) ...)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;means: for each Block object in the drawing block table...&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;PRE&gt;(vlax-for block (vla-get-Blocks doc)
  (vlax-for obj block
    ...
  )
)&lt;/PRE&gt;
&lt;P&gt;means: for each Block object in the drawing block table do for each entity in this Block object ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 19:56:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7866171#M107144</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-03-19T19:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7866247#M107145</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply&lt;/P&gt;&lt;P&gt;this helped me a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quote&lt;BR /&gt;&lt;BR /&gt;"&lt;SPAN class=""&gt;&lt;SPAN&gt;You must try to see an AutoCAD drawing as a database.&lt;/SPAN&gt;&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If you look at Acad as a database it becomes a lot easier&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 20:29:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7866247#M107145</guid>
      <dc:creator>DGRL</dc:creator>
      <dc:date>2018-03-19T20:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7866295#M107146</link>
      <description>&lt;P&gt;Actually when you take a look at the object model and see how things are connected, it all starts to make sense. And it also helps you determine where to look for things if you are unsure.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="ObjModel.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/477675iFC49246B1EBF5A11/image-size/large?v=v2&amp;amp;px=999" role="button" title="ObjModel.png" alt="ObjModel.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 20:49:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7866295#M107146</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2018-03-19T20:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7866491#M107147</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166654"&gt;@doaiena&lt;/a&gt;, nice idea to show &lt;A href="http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-A809CD71-4655-44E2-B674-1FE200B9FE30" target="_blank"&gt;&lt;STRONG&gt;this&lt;/STRONG&gt;&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, in my opinion the top of the graph shoud have been like this:&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="ObjectModel.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/477705i324A1FA11D9EF76F/image-size/large?v=v2&amp;amp;px=999" role="button" title="ObjectModel.png" alt="ObjectModel.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 22:23:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7866491#M107147</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-03-19T22:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7867188#M107148</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166654"&gt;@doaiena&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for this info&lt;BR /&gt;Slowly but surely things are getting better and smoother&lt;/P&gt;&lt;P&gt;starting to see the big picture guys&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Really really thanks for helping out. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 07:10:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7867188#M107148</guid>
      <dc:creator>DGRL</dc:creator>
      <dc:date>2018-03-20T07:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: vlax-for block collection</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7867203#M107149</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I agree with your change for the block part.&lt;/P&gt;&lt;P&gt;Maybe we can ask Autodesk to change the graph&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 07:22:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vlax-for-block-collection/m-p/7867203#M107149</guid>
      <dc:creator>DGRL</dc:creator>
      <dc:date>2018-03-20T07:22:36Z</dc:date>
    </item>
  </channel>
</rss>

