<?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: Do anonymous blocks need to be handled specially? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528787#M11091</link>
    <description>&lt;P&gt;Anonymous blocks are blocks that are used by acad in special cases, like dimensions and dynamic blocks. Their name begins with an astersisk "*". In a dimension, the&amp;nbsp; geometry for the dimension is stored in an anonymous block named *U###. In dynamic blocks, each configuration that differs from the original block definition is contained in an anonymous block and it's EffectiveName property has the parent BlockTableRecord's Name. In reverse, the &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_DatabaseServices_BlockReference_AnonymousBlockTableRecord" target="_blank" rel="noopener"&gt;BlockReference.AnonymousBlockTableRecord&lt;/A&gt; property returns the anonymous block. You can also &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-8729C5BD-2343-40D1-AB6C-D08FE08F8ADC" target="_blank" rel="noopener"&gt;create your own anonymous blocks&lt;/A&gt;. Note that you provide the prefix and acad generates the number portion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the code sample you provided, the var name Abtr apparently stands for Anonymous Block Table Record. Since that's all you have shown, I can only assume that they wanted to process anonymous blocks somehow. You would have to show more code.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2022 16:58:37 GMT</pubDate>
    <dc:creator>Ed__Jobe</dc:creator>
    <dc:date>2022-11-03T16:58:37Z</dc:date>
    <item>
      <title>Do anonymous blocks need to be handled specially?</title>
      <link>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528371#M11090</link>
      <description>&lt;P&gt;I have some old code that I did not write that I am trying to understand. The basic idea is&lt;BR /&gt;&lt;BR /&gt;Select blocks in model space&lt;/P&gt;&lt;P&gt;Recursively go through each block reference and look for a block that matches a name&lt;/P&gt;&lt;P&gt;count it&lt;BR /&gt;&lt;BR /&gt;there is a part after the selection has been made where they do this&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;BlockTableRecord Abtr = new BlockTableRecord();
                                try
                                {Abtr = (BlockTableRecord)Trans.GetObject(br.AnonymousBlockTableRecord, OpenMode.ForRead);}
                                catch
                                {Abtr = (BlockTableRecord)Trans.GetObject(br.BlockTableRecord, OpenMode.ForRead);}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering how neccessary it is to handle anonymous blocks seperately, as when I place a block and select it to process I see that it's BlockTableRecord property is the same as the AnonymousBlockTableRecord property?&lt;BR /&gt;&lt;BR /&gt;What exactly are anonymous blocks, and do I need to treat them special in the code?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 14:23:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528371#M11090</guid>
      <dc:creator>nshupeFMPE3</dc:creator>
      <dc:date>2022-11-03T14:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Do anonymous blocks need to be handled specially?</title>
      <link>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528787#M11091</link>
      <description>&lt;P&gt;Anonymous blocks are blocks that are used by acad in special cases, like dimensions and dynamic blocks. Their name begins with an astersisk "*". In a dimension, the&amp;nbsp; geometry for the dimension is stored in an anonymous block named *U###. In dynamic blocks, each configuration that differs from the original block definition is contained in an anonymous block and it's EffectiveName property has the parent BlockTableRecord's Name. In reverse, the &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_DatabaseServices_BlockReference_AnonymousBlockTableRecord" target="_blank" rel="noopener"&gt;BlockReference.AnonymousBlockTableRecord&lt;/A&gt; property returns the anonymous block. You can also &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-8729C5BD-2343-40D1-AB6C-D08FE08F8ADC" target="_blank" rel="noopener"&gt;create your own anonymous blocks&lt;/A&gt;. Note that you provide the prefix and acad generates the number portion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the code sample you provided, the var name Abtr apparently stands for Anonymous Block Table Record. Since that's all you have shown, I can only assume that they wanted to process anonymous blocks somehow. You would have to show more code.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 16:58:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528787#M11091</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2022-11-03T16:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Do anonymous blocks need to be handled specially?</title>
      <link>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528873#M11092</link>
      <description>&lt;P&gt;Firstly, the code you showed is bad code: I believe variable "br" is an BlockReference, and the purpose of the code is to find out the BlockReference's block definition (BlockTableRecord). So, the first line&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-csharp" tabindex="0"&gt;&lt;CODE&gt;BlockTableRecord Abtr = new BlockTableRecord();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;is simply wrong: why instantiate a new BlockTableRecord? The following lines of the code gets the BlockTableRecord in interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for your question, it looks like you need a bit of study to know what is anonymous blocks (block definition/BlockTableRecord) and why AutoCAD create them. AutoCAD creates anonymous blocks for composite entities, such as Dimensions, dynamic blocks, as needed, and we should not try to mess with them in general.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case, you especially need to understand what a dynamic block is, and why BlockReference.BlockTableRecord and BlockReference.DynamicBlockTableRecord can be different, if the BlockReference is a dynamic one. That is, if you want to get block references by its name (the name of the block definition), you would use BlockReference.DynamicBlockTableRecord to trace back to its "designed" block definition and then its name, because BlockReference.Name property is the direct BlockTableRecord's name, which can be an anonymous block when the block is dynamic. It all sounds confusing until you fully understand the relationship between a dynamic BlockReference and its defining BlockTableRecord.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 17:24:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528873#M11092</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2022-11-03T17:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Do anonymous blocks need to be handled specially?</title>
      <link>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528888#M11093</link>
      <description>&lt;P&gt;Thank you for your replay&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;. I agree the code is bad! Thankfully I did not write it, but I am in charge of it...&lt;BR /&gt;I think the person who wrote it was a bit more confused about how what you described works. Thankfully I understood most of what you described. I think it will help me rewrite this to be much better.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 17:31:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528888#M11093</guid>
      <dc:creator>nshupeFMPE3</dc:creator>
      <dc:date>2022-11-03T17:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Do anonymous blocks need to be handled specially?</title>
      <link>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528903#M11094</link>
      <description>&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt; one follow up I have is whether the description of dynamic blocks and how they relate to BlockTableRecords etc. is documented anywhere? Or is this just knowledge you have from working with these things?</description>
      <pubDate>Thu, 03 Nov 2022 17:36:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528903#M11094</guid>
      <dc:creator>nshupeFMPE3</dc:creator>
      <dc:date>2022-11-03T17:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Do anonymous blocks need to be handled specially?</title>
      <link>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528931#M11095</link>
      <description>&lt;P&gt;One way to learn about these is to study the drawing structure of a dwg you are familiar with. Try &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt; &lt;A href="https://www.theswamp.org/index.php?topic=57317.msg610639#msg610639" target="_blank" rel="noopener"&gt;Inspector&lt;/A&gt; app.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 17:47:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528931#M11095</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2022-11-03T17:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Do anonymous blocks need to be handled specially?</title>
      <link>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528938#M11096</link>
      <description>I was not familiar with this &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14801"&gt;@Ed__Jobe&lt;/a&gt;. Thanks for sharing, I'll look into it</description>
      <pubDate>Thu, 03 Nov 2022 17:50:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/do-anonymous-blocks-need-to-be-handled-specially/m-p/11528938#M11096</guid>
      <dc:creator>nshupeFMPE3</dc:creator>
      <dc:date>2022-11-03T17:50:48Z</dc:date>
    </item>
  </channel>
</rss>

