<?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: GetBlockReferenceIds Problems in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/3125826#M61349</link>
    <description>&lt;P&gt;good morning Jeff:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this thing work awesome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much and have a nice weekend.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2011 15:59:08 GMT</pubDate>
    <dc:creator>wang890</dc:creator>
    <dc:date>2011-08-16T15:59:08Z</dc:date>
    <item>
      <title>GetBlockReferenceIds Problems</title>
      <link>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/2971396#M61340</link>
      <description>&lt;P&gt;I am trying to call the BlockTableRecord GetBlockRefenceIds function to get a list of all BlockRefences on that a Layout, but not matter what I try it always returns 0.&amp;nbsp; Here is what my test looks like:&amp;nbsp; A drawing with two PaperSpace layouts each with a few BlockReferences, in addtion some more BlockReferences are in the ModelSapce.&amp;nbsp; Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; db = HostApplicationServices.WorkingDatabase

 blt = CType(Tran.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)

 btr = CType(Tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead), BlockTableRecord)

 IdList = btr.GetBlockReferenceIds(True, True)

 If IdList.Count &amp;gt; 0 Then
    Stop
 End If&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I am setting the current layout before executing the code.&amp;nbsp; It does not matter if I change it and instead of using "db.CurrentSpaceId" I use "blt(BlockTableRecord.ModelSpace) or .PaperSpace.&amp;nbsp; This function always returns 0.&amp;nbsp; Please help before I go nuts.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2011 19:09:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/2971396#M61340</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2011-03-30T19:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: GetBlockReferenceIds Problems</title>
      <link>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/2971528#M61341</link>
      <description>&lt;P&gt;Here is a bit more info about my post.&amp;nbsp; The reason I need to do this is to get the newest BlockReference in the Layout.&amp;nbsp; There could be any number of them, but I am interested only on the last one added to the Layout.&amp;nbsp; In VBA I would do something like the code shown below to get the last BlockRef added to the Layout.&amp;nbsp; Hope this helps to&amp;nbsp;understand what I am doing and perhaps to get better help.&amp;nbsp; TIA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Function GetNewestBlock(ByVal bname As String) As AcadBlockReference
Dim b As AcadBlockReference
Dim blayout As AcadBlock
Dim i As Integer
Dim e As AcadEntity

Set blayout = ThisDrawing.ActiveLayout.Block

For i = blayout.Count - 1 To 0 Step -1
    
    Set e = blayout.Item(i)
    
    If TypeOf e Is AcadBlockReference Then
    
        Set b = e
        
        If b.Name = bname Then
        Set GetNewestBlock = b
        Exit For
        End If
        
    End If
    
Next i


End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2011 20:38:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/2971528#M61341</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2011-03-30T20:38:25Z</dc:date>
    </item>
    <item>
      <title>Re : GetBlockReferenceIds Problems</title>
      <link>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/2971564#M61342</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The BlockTableRecord.GetBlockRefenceIds methods Returns a list of BlockReferences that reference this BlockTableRecord.&lt;/P&gt;&lt;P&gt;The way you use it, you're trying to ge the ModelSpace references in the drawaing...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use a filtered selection set instead :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TypedValue[] filter = new TypedValue[2] {new TypedValue(0, "INSERT"), new TypedValue(410, "model")};&lt;/P&gt;&lt;P&gt;PromptSelectionResult psr = ed.GetSelection(new SelectionFilter(filter));&lt;/P&gt;&lt;P&gt;if (psr.Status != PromptStatus.OK) return;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2011 20:53:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/2971564#M61342</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2011-03-30T20:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: GetBlockReferenceIds Problems</title>
      <link>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/2971612#M61344</link>
      <description>&lt;DIV class="lia-component-body lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;You can do it the same way as you did in VBA:&lt;/P&gt;&lt;P&gt;- step through the space BlockTableRecord&lt;/P&gt;&lt;P&gt;- get the entities from ObjectIds&lt;/P&gt;&lt;P&gt;- evaluate if it's a BlockReference and if so set the variable...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or, using the SelectionSet way and comparing the BlockReferences Handles (the greatest is the newest).&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 30 Mar 2011 21:08:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/2971612#M61344</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2011-03-30T21:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: GetBlockReferenceIds Problems</title>
      <link>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/2971942#M61345</link>
      <description>&lt;P&gt;_gile&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much and again and again.&amp;nbsp; I was not aware that one could use the code 410 in SelectionSets.&amp;nbsp; Up to very recently I was using AC2007 VBA and code 410 was not allowed in SelectionSets.&amp;nbsp; This opens up to a whole new approach.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2011 03:13:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/2971942#M61345</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2011-03-31T03:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: GetBlockReferenceIds Problems</title>
      <link>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/3124944#M61346</link>
      <description>&lt;P&gt;hey guys&lt;/P&gt;&lt;P&gt;just thought i expand the problem here instead of posting a new one since this is similar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am trying to insert all the blocks in an empty drawing which there is nothing inserted just in the dwg memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i do the same thing and it gives me 0 blocks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am trying to insert each block into modelspace without asking which block. i'll do the coordinate calculation. this is for creating a table of blocks. but there are so many blocks and i don't want to insert one by one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;InsertBlock()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; db &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Database = HostApplicationServices.WorkingDatabase()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; id &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;ObjectId&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; trans &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Transaction = db.TransactionManager.StartTransaction()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Try&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; bt &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; btr &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;BlockTableRecord = trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; ed &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Editor = Application.DocumentManager.MdiActiveDocument.Editor&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; oBlock &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;BlockReference&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; y &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Double&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;For&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Each&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; id &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;In&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; btr.GetBlockReferenceIds(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;False&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;False&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; oAcadEntity &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Entity = trans.GetObject(id, OpenMode.ForWrite)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;TypeOf&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; (oAcadEntity) &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Is&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockReference &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Then&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;&lt;FONT color="#008000" size="2"&gt;'get block object, check each block&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;oBlock =&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;CType&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;(oAcadEntity, BlockReference)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; oBlock.Name &amp;lt;&amp;gt; &lt;/FONT&gt;&lt;FONT color="#a31515" size="2"&gt;&lt;FONT color="#a31515" size="2"&gt;"_None"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Then&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; oPoint3D &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Point3d(0, y, 0)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; insert &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;BlockReference(oPoint3D, oBlock.Id)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;trans.AddNewlyCreatedDBObject(insert,&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;True&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;y -= 10&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Next&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;trans.Commit()&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Catch&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; ex &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Exception&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;MsgBox(&lt;/P&gt;&lt;P&gt;&lt;FONT color="#a31515" size="2"&gt;&lt;FONT color="#a31515" size="2"&gt;"Error: "&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;+ ex.Message)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Try&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2011 00:19:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/3124944#M61346</guid>
      <dc:creator>wang890</dc:creator>
      <dc:date>2011-08-16T00:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: GetBlockReferenceIds Problems</title>
      <link>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/3124948#M61347</link>
      <description>&lt;P&gt;Does the empty drawing contain the blocks(definitions)?&lt;/P&gt;&lt;P&gt;In a empty there will be no blockreferences you need to create them, kind of like you did but skip the GetBlockReferenceIds part and just use BlockTablesRecord Id and check if layout, since it is empty I am guessing no anonymous and xref's etc....................&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and GetBlockReferenceIds(false, false)------having the first argument set to false will only return nested block references.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2011 00:44:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/3124948#M61347</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2011-08-16T00:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: GetBlockReferenceIds Problems</title>
      <link>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/3124970#M61348</link>
      <description>&lt;P&gt;Here is a example and see how it itereates the blocktable using the definitions which are BlockTableRecords.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; &amp;lt;CommandMethod("InsertAllBlocks")&amp;gt; _
        Public Sub InsertAllBlocks()
            Dim doc As Document = Application.DocumentManager.MdiActiveDocument
            Dim db As Database = doc.Database
            Dim ed As Editor = doc.Editor

            Using trx As Transaction = db.TransactionManager.StartTransaction()

                Dim bt As BlockTable = trx.GetObject(db.BlockTableId, OpenMode.ForRead)
                Dim modelBtr As BlockTableRecord = trx.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite)

                Dim Xval As Double = 0
                Dim Yval As Double = 100
                Dim counter As Integer = 0

                For Each objId As ObjectId In bt
                    Dim btr As BlockTableRecord = trx.GetObject(objId, OpenMode.ForRead)

                    If btr.IsLayout Then
                        Continue For
                    End If

                    Dim bref As New BlockReference(New Point3d(Xval, Yval, 0), objId)
                    modelBtr.AppendEntity(bref)
                    trx.AddNewlyCreatedDBObject(bref, True)

                    If Not counter = 10 Then
                        counter += 1
                        Xval += 10
                    Else
                        counter = 0
                        Xval = 0
                        Yval -= 10
                    End If
                Next


                trx.Commit()
            End Using
        End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2011 01:24:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/3124970#M61348</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2011-08-16T01:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: GetBlockReferenceIds Problems</title>
      <link>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/3125826#M61349</link>
      <description>&lt;P&gt;good morning Jeff:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this thing work awesome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much and have a nice weekend.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2011 15:59:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getblockreferenceids-problems/m-p/3125826#M61349</guid>
      <dc:creator>wang890</dc:creator>
      <dc:date>2011-08-16T15:59:08Z</dc:date>
    </item>
  </channel>
</rss>

