<?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 Block Attribute Problem in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/block-attribute-problem/m-p/2461290#M71153</link>
    <description>I have a small sub that inserts an exesting block. The inserted block has a single attribute, but the AttributeCollection is always empty. If I explode the inserted block, the attribute appears, but I cant get a reference to it in code.</description>
    <pubDate>Fri, 03 Apr 2009 16:17:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-04-03T16:17:20Z</dc:date>
    <item>
      <title>Block Attribute Problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-attribute-problem/m-p/2461290#M71153</link>
      <description>I have a small sub that inserts an exesting block. The inserted block has a single attribute, but the AttributeCollection is always empty. If I explode the inserted block, the attribute appears, but I cant get a reference to it in code.</description>
      <pubDate>Fri, 03 Apr 2009 16:17:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-attribute-problem/m-p/2461290#M71153</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-03T16:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Block Attribute Problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-attribute-problem/m-p/2461291#M71154</link>
      <description>you need to add the attribute references to the block reference 'manually' when the block is inserted.  If you have done other forms of autocad programming (COM, VBA, LSP) this is counterintuitive because you never had to do it before.  This snip should go into your code immediately after you add the BlockReference to the Transaction.&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;If btr.HasAttributeDefinitions Then&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;Dim AtDef As AttributeDefinition, AttRef As AttributeReference&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;For Each SubEntId As ObjectId In btr&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;If SubEntId.ObjectClass.Name = "AcDbAttributeDefinition" Then&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;AtDef = TM.GetObject(SubEntId, OpenMode.ForRead, False, True)&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;AttRef = New AttributeReference&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;AttRef.SetAttributeFromBlock(AtDef, br.BlockTransform)&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;br.AttributeCollection.AppendAttribute(AttRef)&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;T.AddNewlyCreatedDBObject(AttRef, True)&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;AtDef.Dispose()&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;AttRef.Dispose()&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;End If&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;Next&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;End If&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2009 17:38:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-attribute-problem/m-p/2461291#M71154</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2009-04-03T17:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Block Attribute Problem</title>
      <link>https://forums.autodesk.com/t5/net-forum/block-attribute-problem/m-p/2461292#M71155</link>
      <description>Thanks for the help. I am updating some of my code to get away from using the COM.</description>
      <pubDate>Fri, 03 Apr 2009 17:54:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/block-attribute-problem/m-p/2461292#M71155</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-03T17:54:20Z</dc:date>
    </item>
  </channel>
</rss>

