<?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: Counting specific blocks in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622429#M35027</link>
    <description>Thanks, that helps alot!&lt;BR /&gt;
&lt;BR /&gt;
Jason</description>
    <pubDate>Mon, 24 Apr 2006 21:16:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-04-24T21:16:09Z</dc:date>
    <item>
      <title>Counting specific blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622424#M35022</link>
      <description>I am having a problem counting blocks in a drawing. When the user inserts a block, I want the vba program to count how many similar blocks are in the drawing.  I can accomplish part of this, but I hit two different snags.  This first is the accuracy of the block count.  I am tyring to use a filtered selection set to gather all of the blocks.  I am using the filter type of "insert", but it doesn't seem to count all the block references? The example drawing I am testing this on contains 55 of these blocks but the count shows up as 13. If a block alread in the drawing gets copied instead of inserted, does this mess up the count?  I have been using the (entget (car (entsel))) command to determine the type and name and the name seems to change sometimes after you copy the block.  For example, after running the lsp on an inserted block, item 2 is "Trane FC-04". If I copy that block then run the lsp on the copied block, item 2 is still the same, but if the block is copied and then rotated, item 2 is "*U2335".  But under autocad properties, the name still shows as "Trane FC-04".  Why does this change?  My second snag is selecting similar blocks since the same basic block has 2 or 3 sizes.  The block names all start out similar so I am trying to utilize the Like method.  This is also, not returning a correct number of blocks.  Am I going about this the wrong way?  I have included some of my code below.  Thanks for your help.&lt;BR /&gt;
&lt;BR /&gt;
Jason&lt;BR /&gt;
&lt;BR /&gt;
    Grps(0) = 0: Dats(0) = "Block Reference"&lt;BR /&gt;
    Grps(1) = 2: Dats(1) = ""&lt;BR /&gt;
    On Error Resume Next&lt;BR /&gt;
    Set SS = ThisDrawing.SelectionSets.Add("SS")&lt;BR /&gt;
    If Err.Number &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;
      Set SS = ThisDrawing.SelectionSets.Item("SS")&lt;BR /&gt;
    End If&lt;BR /&gt;
    SS.Clear&lt;BR /&gt;
    &lt;BR /&gt;
    match1 = "*" &amp;amp; Left(NewBlk.Name, 9) &amp;amp; "*"&lt;BR /&gt;
    Dats(1) = match1&lt;BR /&gt;
    Filter1 = Grps&lt;BR /&gt;
    Filter2 = Dats&lt;BR /&gt;
    SS.Select acSelectionSetAll, , , Filter1, Filter2&lt;BR /&gt;
    intBlockCounter = SS.count&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: test_52&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: test_52

Message was edited by: test_52</description>
      <pubDate>Mon, 24 Apr 2006 16:23:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622424#M35022</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-24T16:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Counting specific blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622425#M35023</link>
      <description>After doing a little more digging, I found that after the dynamic block is inserted into the drawing, the block name is still intact.  But if the dynamci block is rotated (using the rotate method in the dynamic block), the block name changes.  Why does it do this?  Is there anyway to stop this from occurring.  Once it changes, there is now way to get it back (that I can find).  Please help!&lt;BR /&gt;
Jason</description>
      <pubDate>Mon, 24 Apr 2006 18:58:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622425#M35023</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-24T18:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Counting specific blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622426#M35024</link>
      <description>Get the EffectiveName of the blocks. Note that I don't beleive this is a &lt;BR /&gt;
filterable item......so you will need to get a selections set of all INSERTS &lt;BR /&gt;
(not BlockReferences) and cycle through looking for the EffectiveName.&lt;BR /&gt;
&lt;BR /&gt;
Jeff&lt;BR /&gt;
&lt;BR /&gt;
&lt;TEST_52&gt; wrote in message news:5152591@discussion.autodesk.com...&lt;BR /&gt;
After doing a little more digging, I found that after the dynamic block is &lt;BR /&gt;
inserted into the drawing, the block name is still intact.  But if the &lt;BR /&gt;
dynamci block is rotated (using the rotate method in the dynamic block), the &lt;BR /&gt;
block name changes.  Why does it do this?  Is there anyway to stop this from &lt;BR /&gt;
occurring.  Once it changes, there is now way to get it back (that I can &lt;BR /&gt;
find).  Please help!&lt;BR /&gt;
Jason&lt;/TEST_52&gt;</description>
      <pubDate>Mon, 24 Apr 2006 19:03:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622426#M35024</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-24T19:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Counting specific blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622427#M35025</link>
      <description>That's what I was afraid of.  I was trying to avoid iterating thru all blocks because some of our drawings have quite a few blocks and it takes awhile cycling thru all of them.  Thanks for your help!&lt;BR /&gt;
Jason</description>
      <pubDate>Mon, 24 Apr 2006 19:30:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622427#M35025</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-24T19:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Counting specific blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622428#M35026</link>
      <description>To speed it up a bit, just filter for the Block name AND Anonymous blocks.&lt;BR /&gt;
&lt;BR /&gt;
FilterData(0) = "BLOCKNAME,`*U#*"&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;TEST_52&gt; wrote in message news:5152670@discussion.autodesk.com...&lt;BR /&gt;
That's what I was afraid of.  I was trying to avoid iterating thru all &lt;BR /&gt;
blocks because some of our drawings have quite a few blocks and it takes &lt;BR /&gt;
awhile cycling thru all of them.  Thanks for your help!&lt;BR /&gt;
Jason&lt;/TEST_52&gt;</description>
      <pubDate>Mon, 24 Apr 2006 20:18:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622428#M35026</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-24T20:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Counting specific blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622429#M35027</link>
      <description>Thanks, that helps alot!&lt;BR /&gt;
&lt;BR /&gt;
Jason</description>
      <pubDate>Mon, 24 Apr 2006 21:16:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/counting-specific-blocks/m-p/1622429#M35027</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-24T21:16:09Z</dc:date>
    </item>
  </channel>
</rss>

