<?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: Block Reference question. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500166#M55077</link>
    <description>&lt;P&gt;I understand the when I explode Dwg1 it leaves Block1 in model space but the code shows that there are 2&lt;/P&gt;&lt;P&gt;Block References for block Block1 thats the part i do not understand. when i check the&amp;nbsp;&lt;/P&gt;&lt;P&gt;Block Reference (bref.BlockName one will = Block1 and the other will = *Model_Space) so why does is show a&lt;/P&gt;&lt;P&gt;bref.BlockName&amp;nbsp;to Block1 after block1 was exploded.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jun 2012 13:24:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-06-14T13:24:16Z</dc:date>
    <item>
      <title>Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500078#M55075</link>
      <description>&lt;P&gt;1. first I have a drawing called "test1"&lt;/P&gt;&lt;P&gt;2. and a drawing call "Dwg1" Inside this drawing is a block called "Block1"&lt;/P&gt;&lt;P&gt;3. now after I insert Drawing "Dwg1" into drawing "test1" I explode it then I save and close the drawing test1.&lt;/P&gt;&lt;P&gt;4. now I run this code on drawing Test1 and it gives me a block count of 2 for block "Block1"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; but there is only one block Reference in the drawing called "Block1"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; yes I know when I inserted the Drawing "dwg1" is comes in as a block called "dwg1" and inside that Block is a&amp;nbsp;&amp;nbsp; block called "block1"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; now my code count the block1 that is inside the drawing/block called "dwg1&amp;nbsp;Even&amp;nbsp;though&amp;nbsp;i exploded the drawing/block "dwg1"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; my question is Even&amp;nbsp;though i exploded the Drawing/block "dwg1" why does "block1" that was inside Drawing/block "dwg1" show up as a Block Reference?&lt;BR /&gt;&amp;nbsp;&amp;nbsp; and how do i work around this so i only get the Block Reference that is really in the drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Sub DwgTest(ByVal pathtodwg As String, ByVal blockname As String)

        Dim db As Database = New Database(False, False)

        If IO.File.Exists(pathtodwg) = True Then
            db.ReadDwgFile(pathtodwg, System.IO.FileShare.Read, False, Nothing)

            Using Trans As Transaction = db.TransactionManager.StartTransaction
                Dim bktbl As BlockTable = db.BlockTableId.GetObject(OpenMode.ForRead)

                Dim revblk As BlockTableRecord = bktbl(blockname).GetObject(OpenMode.ForRead)
                Dim refs As ObjectIdCollection = revblk.GetBlockReferenceIds(False, False)
                MsgBox(refs.Count.ToString)
            End Using

            db.Dispose()
        End If

    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 13:01:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500078#M55075</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-14T13:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500120#M55076</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; now after I insert Drawing "Dwg1" into drawing "test1" I explode it then I save and close the drawing test1.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;If you insert DWG1 in TEST1 and you explode it then ==&amp;gt; you have exploded the block called DWG1, but as the block BLOCK1 was a subobject it is not exploded with it's parent one, so after your step 3 there is one blockreference called BLOCK1 in modelspace.&lt;/P&gt;&lt;P&gt;If you redo the same, you will have 2 blockreferences then.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can simulate this by hand, insert DWG1 into a new drawing, explode it, you'll see that BLOCK1 is now available in modelspace.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does that clear up you situation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 13:10:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500120#M55076</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-06-14T13:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500166#M55077</link>
      <description>&lt;P&gt;I understand the when I explode Dwg1 it leaves Block1 in model space but the code shows that there are 2&lt;/P&gt;&lt;P&gt;Block References for block Block1 thats the part i do not understand. when i check the&amp;nbsp;&lt;/P&gt;&lt;P&gt;Block Reference (bref.BlockName one will = Block1 and the other will = *Model_Space) so why does is show a&lt;/P&gt;&lt;P&gt;bref.BlockName&amp;nbsp;to Block1 after block1 was exploded.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 13:24:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500166#M55077</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-14T13:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500170#M55078</link>
      <description>&lt;DIV class="lia-message-body lia-component-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;mistyped try this again.&lt;/P&gt;&lt;P&gt;I understand the when I explode Dwg1 it leaves Block1 in model space but the code shows that there are 2&lt;/P&gt;&lt;P&gt;Block References for block Block1 thats the part i do not understand. when i check the&amp;nbsp;&lt;/P&gt;&lt;P&gt;Block Reference (bref.BlockName one will =&amp;nbsp;dwg1 and the other will = *Model_Space) so why does is show a&lt;/P&gt;&lt;P&gt;bref.BlockName&amp;nbsp;to Block1 after block1 was exploded.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 14 Jun 2012 13:26:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500170#M55078</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-14T13:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500212#M55079</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; but the code shows that there are 2Block References for block Block1 thats the part i do not understand&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;When you open the drawing and select the content of the modelspace with QSELECT, how many BlockReferences do you see then? Because I don't see a problem with your code and counting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; so why does is show a bref.BlockName&amp;nbsp;to Block1 after block1 was exploded.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I didn't see in your description (points 1 to 4) and position where you explode the BlockReference called "BLOCK1" in the modelspace of the new drawing?&lt;/P&gt;&lt;P&gt;You just exploded to parent DWG1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 13:40:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500212#M55079</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-06-14T13:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500218#M55080</link>
      <description>&lt;P&gt;What you might want to look into is BlockReference.Name, not BlockReference.BlockName.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The former is the name of&amp;nbsp;a BlockTableRecord (block definition) the BlockReference is based on, while the later is the name of the BlockReference' owner (usually, it is the ModelSpace block or PaperSpace block).&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 13:42:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500218#M55080</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2012-06-14T13:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500272#M55081</link>
      <description>&lt;P&gt;Hi alfred&lt;/P&gt;&lt;P&gt;if i open the drawing and do qselect there is only one item in model_space if i try erase all there is only one item found in model_space but my code shows 2 Block References for Block1..if i purge the drawing then my code shows only one Block References for Block1&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 13:52:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500272#M55081</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-14T13:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500280#M55082</link>
      <description>&lt;P&gt;Hi Norman.&lt;/P&gt;&lt;P&gt;yes i know that, &amp;nbsp;i was using BlockReference.BlockName only to see what was going on&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 13:55:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500280#M55082</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-14T13:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500298#M55083</link>
      <description>&lt;P&gt;HI alfred&lt;/P&gt;&lt;P&gt;I never explode Block1 I only explode block Dwg1&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 13:59:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500298#M55083</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-14T13:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500316#M55084</link>
      <description>&lt;P&gt;here is the code and the drawing mybe you can tell me why my code gives me a count of 2 for block DBDSTXT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Call DwgTest("C:\test.dwg", "DBDSTXT")

    Public Sub DwgTest(ByVal pathtodwg As String, ByVal blockname As String)

        Dim db As Database = New Database(False, False)

        If IO.File.Exists(pathtodwg) = True Then
            db.ReadDwgFile(pathtodwg, System.IO.FileShare.Read, False, Nothing)

            Using Trans As Transaction = db.TransactionManager.StartTransaction
                Dim bktbl As BlockTable = db.BlockTableId.GetObject(OpenMode.ForRead)

                Dim revblk As BlockTableRecord = bktbl(blockname).GetObject(OpenMode.ForRead)
                Dim refs As ObjectIdCollection = revblk.GetBlockReferenceIds(False, False)
                MsgBox(refs.Count.ToString)
            End Using

            db.Dispose()
        End If

    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 14:03:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500316#M55084</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-14T14:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500318#M55085</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so last guess before I try to simulate your situation&lt;/P&gt;&lt;P&gt;You exploded the DWG1, so you have in this drawing&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;a) a BlockTableRecord "ModelSpace" containing one BlockReference "&lt;FONT color="#FF6600"&gt;BLOCK1&lt;/FONT&gt;"&lt;/LI&gt;&lt;LI&gt;b) a BlockTableRecord "BLOCK1" ... whatever defines this block&lt;/LI&gt;&lt;LI&gt;c) a BlockTableRecord "DWG1" containing one BlockReference "&lt;FONT color="#FF6600"&gt;BLOCK1&lt;/FONT&gt;"&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now you check "how often is my BlockTableRecord named "BLOCK1 referenced within that database".&lt;/P&gt;&lt;P&gt;Look to the colored words ==&amp;gt; 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 14:03:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500318#M55085</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-06-14T14:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500434#M55086</link>
      <description>&lt;P&gt;hi alfred&lt;/P&gt;&lt;P&gt;if i look at the BlockTable for the database i see one block called "block1"&lt;/P&gt;&lt;P&gt;did you see my last post with my drawing and my code?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 14:41:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500434#M55086</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-14T14:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Block Reference question.</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500658#M55087</link>
      <description>&lt;P&gt;I understand now. thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you explode Dwg1, you're making a copy of the block reference in Dwg1,&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" size="2" face="Consolas"&gt;&lt;FONT color="#008000" size="2" face="Consolas"&gt;&lt;FONT color="#008000" size="2" face="Consolas"&gt;so you end up with two block references:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" size="2" face="Consolas"&gt;&lt;FONT color="#008000" size="2" face="Consolas"&gt;&lt;FONT color="#008000" size="2" face="Consolas"&gt;one in the Dwg1 block table record, and one in the *Model_Space block table record.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 16:13:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-reference-question/m-p/3500658#M55087</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-06-14T16:13:28Z</dc:date>
    </item>
  </channel>
</rss>

