<?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: How do i find a block in the BlockTable in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651984#M81636</link>
    <description>&lt;DIV id="jive-html-wrapper-div"&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;I do it with the following code, but i don't know &lt;BR /&gt;
if it is the best way:&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;public&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;bool&lt;/FONT&gt;&lt;FONT size="2"&gt; IsBlockInDrawing(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;string&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockName, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;out&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockId)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;bool&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockIsInDrawing = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt; tmpID = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt;();&lt;P&gt;&lt;/P&gt;&lt;P&gt;BlockId = tmpID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;Transaction&lt;/FONT&gt;&lt;FONT size="2"&gt; tr = db.TransactionManager.StartTransaction())&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTable&lt;/FONT&gt;&lt;FONT size="2"&gt; bt = (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTable&lt;/FONT&gt;&lt;FONT size="2"&gt;)tr.GetObject(db.BlockTableId, &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;OpenMode&lt;/FONT&gt;&lt;FONT size="2"&gt;.ForRead, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;))&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;foreach&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt; tmpBlockId &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;in&lt;/FONT&gt;&lt;FONT size="2"&gt; bt)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTableRecord&lt;/FONT&gt;&lt;FONT size="2"&gt; btr = (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTableRecord&lt;/FONT&gt;&lt;FONT size="2"&gt;)tr.GetObject(tmpBlockId, &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;OpenMode&lt;/FONT&gt;&lt;FONT size="2"&gt;.ForRead, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;))&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;if&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;String&lt;/FONT&gt;&lt;FONT size="2"&gt;.Compare(btr.Name, BlockName, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;true&lt;/FONT&gt;&lt;FONT size="2"&gt;) == 0)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;BlockIsInDrawing = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;true&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BlockId = tmpBlockId;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;break&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;tr.Commit();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;return&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockIsInDrawing;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;FONT face="Arial" size="2"&gt;-- &lt;BR /&gt;Roland Feletic&lt;BR /&gt;Ingenieurbuero A. &lt;BR /&gt;
Pauser Ges.m.b.H.&lt;BR /&gt;&lt;/FONT&gt;&lt;A href="http://www.pauser.at"&gt;&lt;FONT face="Arial"&gt;&lt;BR /&gt;
size=2&amp;gt;http://www.pauser.at&lt;/FONT&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;hp workstation xw4200, 3GB&lt;BR /&gt;quadro &lt;BR /&gt;
fx1400&lt;BR /&gt;AutoCAD 2007, 3DSMax 8.0 SP 2&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;"Matt" &amp;lt;&lt;/FONT&gt;&lt;A&gt;&lt;BR /&gt;
href="mailto:nospam@nowhere.com"&amp;gt;&lt;FONT face="Arial"&gt;&lt;BR /&gt;
size=2&amp;gt;nospam@nowhere.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face="Arial" size="2"&gt;&amp;gt; schrieb im &lt;BR /&gt;
Newsbeitrag &lt;/FONT&gt;&lt;A href="news:5182844@discussion.autodesk.com"&gt;&lt;FONT&gt;&lt;BR /&gt;
face=Arial size=2&amp;gt;news:5182844@discussion.autodesk.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT&gt;&lt;BR /&gt;
face=Arial size=2&amp;gt;...&lt;/FONT&gt;&lt;/DIV&gt;&lt;FONT face="Arial" size="2"&gt;Finally trying to get &lt;BR /&gt;
my hands dirty on .NET. It's not that easy really&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How do i find a &lt;BR /&gt;
BlockTabelRecord from a name?&lt;BR /&gt;&lt;BR /&gt;In objectArx i got the objectId using &lt;BR /&gt;
AcDbBlockTable::getAt(const ACHAR* &lt;BR /&gt;entryName,AcDbObjectId&amp;amp; &lt;BR /&gt;
recordId);&lt;BR /&gt;Then I created a new AcDbBlockReference using the id, added it to &lt;BR /&gt;
the &lt;BR /&gt;database and i was done.&lt;BR /&gt;&lt;BR /&gt;In .NET I can not find any GetAt method. &lt;BR /&gt;
Do I have to iterate the enumerator &lt;BR /&gt;and find it by myself?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'm to &lt;BR /&gt;
old for this new stuff. Guess i should stay with Arx and ADS &lt;BR /&gt;
;-)&lt;BR /&gt;&lt;BR /&gt;/Matt&lt;/FONT&gt;
&lt;/DIV&gt;</description>
    <pubDate>Tue, 23 May 2006 08:45:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-05-23T08:45:30Z</dc:date>
    <item>
      <title>How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651983#M81635</link>
      <description>Finally trying to get my hands dirty on .NET. It's not that easy really&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
How do i find a BlockTabelRecord from a name?&lt;BR /&gt;
&lt;BR /&gt;
In objectArx i got the objectId using AcDbBlockTable::getAt(const ACHAR* &lt;BR /&gt;
entryName,AcDbObjectId&amp;amp; recordId);&lt;BR /&gt;
Then I created a new AcDbBlockReference using the id, added it to the &lt;BR /&gt;
database and i was done.&lt;BR /&gt;
&lt;BR /&gt;
In .NET I can not find any GetAt method. Do I have to iterate the enumerator &lt;BR /&gt;
and find it by myself?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I'm to old for this new stuff. Guess i should stay with Arx and ADS &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
/Matt</description>
      <pubDate>Tue, 23 May 2006 07:13:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651983#M81635</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-23T07:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651984#M81636</link>
      <description>&lt;DIV id="jive-html-wrapper-div"&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;I do it with the following code, but i don't know &lt;BR /&gt;
if it is the best way:&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;public&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;bool&lt;/FONT&gt;&lt;FONT size="2"&gt; IsBlockInDrawing(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;string&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockName, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;out&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockId)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;bool&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockIsInDrawing = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt; tmpID = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt;();&lt;P&gt;&lt;/P&gt;&lt;P&gt;BlockId = tmpID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;Transaction&lt;/FONT&gt;&lt;FONT size="2"&gt; tr = db.TransactionManager.StartTransaction())&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTable&lt;/FONT&gt;&lt;FONT size="2"&gt; bt = (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTable&lt;/FONT&gt;&lt;FONT size="2"&gt;)tr.GetObject(db.BlockTableId, &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;OpenMode&lt;/FONT&gt;&lt;FONT size="2"&gt;.ForRead, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;))&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;foreach&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt; tmpBlockId &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;in&lt;/FONT&gt;&lt;FONT size="2"&gt; bt)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTableRecord&lt;/FONT&gt;&lt;FONT size="2"&gt; btr = (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTableRecord&lt;/FONT&gt;&lt;FONT size="2"&gt;)tr.GetObject(tmpBlockId, &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;OpenMode&lt;/FONT&gt;&lt;FONT size="2"&gt;.ForRead, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;))&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;if&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;String&lt;/FONT&gt;&lt;FONT size="2"&gt;.Compare(btr.Name, BlockName, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;true&lt;/FONT&gt;&lt;FONT size="2"&gt;) == 0)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;BlockIsInDrawing = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;true&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BlockId = tmpBlockId;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;break&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;tr.Commit();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;return&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockIsInDrawing;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;FONT face="Arial" size="2"&gt;-- &lt;BR /&gt;Roland Feletic&lt;BR /&gt;Ingenieurbuero A. &lt;BR /&gt;
Pauser Ges.m.b.H.&lt;BR /&gt;&lt;/FONT&gt;&lt;A href="http://www.pauser.at"&gt;&lt;FONT face="Arial"&gt;&lt;BR /&gt;
size=2&amp;gt;http://www.pauser.at&lt;/FONT&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;hp workstation xw4200, 3GB&lt;BR /&gt;quadro &lt;BR /&gt;
fx1400&lt;BR /&gt;AutoCAD 2007, 3DSMax 8.0 SP 2&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;"Matt" &amp;lt;&lt;/FONT&gt;&lt;A&gt;&lt;BR /&gt;
href="mailto:nospam@nowhere.com"&amp;gt;&lt;FONT face="Arial"&gt;&lt;BR /&gt;
size=2&amp;gt;nospam@nowhere.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face="Arial" size="2"&gt;&amp;gt; schrieb im &lt;BR /&gt;
Newsbeitrag &lt;/FONT&gt;&lt;A href="news:5182844@discussion.autodesk.com"&gt;&lt;FONT&gt;&lt;BR /&gt;
face=Arial size=2&amp;gt;news:5182844@discussion.autodesk.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT&gt;&lt;BR /&gt;
face=Arial size=2&amp;gt;...&lt;/FONT&gt;&lt;/DIV&gt;&lt;FONT face="Arial" size="2"&gt;Finally trying to get &lt;BR /&gt;
my hands dirty on .NET. It's not that easy really&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How do i find a &lt;BR /&gt;
BlockTabelRecord from a name?&lt;BR /&gt;&lt;BR /&gt;In objectArx i got the objectId using &lt;BR /&gt;
AcDbBlockTable::getAt(const ACHAR* &lt;BR /&gt;entryName,AcDbObjectId&amp;amp; &lt;BR /&gt;
recordId);&lt;BR /&gt;Then I created a new AcDbBlockReference using the id, added it to &lt;BR /&gt;
the &lt;BR /&gt;database and i was done.&lt;BR /&gt;&lt;BR /&gt;In .NET I can not find any GetAt method. &lt;BR /&gt;
Do I have to iterate the enumerator &lt;BR /&gt;and find it by myself?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'm to &lt;BR /&gt;
old for this new stuff. Guess i should stay with Arx and ADS &lt;BR /&gt;
;-)&lt;BR /&gt;&lt;BR /&gt;/Matt&lt;/FONT&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 May 2006 08:45:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651984#M81636</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-23T08:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651985#M81637</link>
      <description>&lt;DIV id="jive-html-wrapper-div"&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;Thanks.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;But I found a much better way (after a &lt;BR /&gt;
while):&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;BlockId&amp;nbsp; = bt[&lt;FONT size="2"&gt;BlockName]&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;/Matt&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;BLOCKQUOTE dir="ltr"&gt;&lt;BR /&gt;
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"&amp;gt;&lt;BR /&gt;
  &lt;DIV&gt;&amp;lt;RolandF&amp;gt; wrote in message &lt;A&gt;&lt;BR /&gt;
  href="news:5182890@discussion.autodesk.com"&amp;gt;news:5182890@discussion.autodesk.com&lt;/A&gt;...&lt;/DIV&gt;&lt;BR /&gt;
  &lt;DIV id="jive-html-wrapper-div"&gt;&lt;BR /&gt;
  &lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;I do it with the following code, but i don't know &lt;BR /&gt;
  if it is the best way:&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
  &lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;public&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;bool&lt;/FONT&gt;&lt;FONT size="2"&gt; IsBlockInDrawing(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;string&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockName, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;out&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockId)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;bool&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockIsInDrawing = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt; tmpID = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt;();&lt;P&gt;&lt;/P&gt;&lt;P&gt;BlockId = tmpID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;Transaction&lt;/FONT&gt;&lt;FONT size="2"&gt; tr = db.TransactionManager.StartTransaction())&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTable&lt;/FONT&gt;&lt;FONT size="2"&gt; bt = (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTable&lt;/FONT&gt;&lt;FONT size="2"&gt;)tr.GetObject(db.BlockTableId, &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;OpenMode&lt;/FONT&gt;&lt;FONT size="2"&gt;.ForRead, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;))&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;foreach&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt; tmpBlockId &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;in&lt;/FONT&gt;&lt;FONT size="2"&gt; bt)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTableRecord&lt;/FONT&gt;&lt;FONT size="2"&gt; btr = (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTableRecord&lt;/FONT&gt;&lt;FONT size="2"&gt;)tr.GetObject(tmpBlockId, &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;OpenMode&lt;/FONT&gt;&lt;FONT size="2"&gt;.ForRead, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;))&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;if&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;String&lt;/FONT&gt;&lt;FONT size="2"&gt;.Compare(btr.Name, BlockName, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;true&lt;/FONT&gt;&lt;FONT size="2"&gt;) == 0)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;BlockIsInDrawing = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;true&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BlockId = tmpBlockId;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;break&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;tr.Commit();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;return&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockIsInDrawing;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;
  &lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
  &lt;DIV&gt;&lt;BR /&gt;&lt;FONT face="Arial" size="2"&gt;-- &lt;BR /&gt;Roland Feletic&lt;BR /&gt;Ingenieurbuero A. &lt;BR /&gt;
  Pauser Ges.m.b.H.&lt;BR /&gt;&lt;/FONT&gt;&lt;A href="http://www.pauser.at"&gt;&lt;FONT face="Arial"&gt;&lt;BR /&gt;
  size=2&amp;gt;http://www.pauser.at&lt;/FONT&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;BR /&gt;
  &lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
  &lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;hp workstation xw4200, 3GB&lt;BR /&gt;quadro &lt;BR /&gt;
  fx1400&lt;BR /&gt;AutoCAD 2007, 3DSMax 8.0 SP 2&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
  &lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;"Matt" &amp;lt;&lt;/FONT&gt;&lt;A&gt;&lt;BR /&gt;
  href="mailto:nospam@nowhere.com"&amp;gt;&lt;FONT face="Arial"&gt;&lt;BR /&gt;
  size=2&amp;gt;nospam@nowhere.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face="Arial" size="2"&gt;&amp;gt; schrieb im &lt;BR /&gt;
  Newsbeitrag &lt;/FONT&gt;&lt;A href="news:5182844@discussion.autodesk.com"&gt;&lt;FONT&gt;&lt;BR /&gt;
  face=Arial size=2&amp;gt;news:5182844@discussion.autodesk.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT&gt;&lt;BR /&gt;
  face=Arial size=2&amp;gt;...&lt;/FONT&gt;&lt;/DIV&gt;&lt;FONT face="Arial" size="2"&gt;Finally trying to &lt;BR /&gt;
  get my hands dirty on .NET. It's not that easy really&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How do i find &lt;BR /&gt;
  a BlockTabelRecord from a name?&lt;BR /&gt;&lt;BR /&gt;In objectArx i got the objectId using &lt;BR /&gt;
  AcDbBlockTable::getAt(const ACHAR* &lt;BR /&gt;entryName,AcDbObjectId&amp;amp; &lt;BR /&gt;
  recordId);&lt;BR /&gt;Then I created a new AcDbBlockReference using the id, added it &lt;BR /&gt;
  to the &lt;BR /&gt;database and i was done.&lt;BR /&gt;&lt;BR /&gt;In .NET I can not find any GetAt &lt;BR /&gt;
  method. Do I have to iterate the enumerator &lt;BR /&gt;and find it by &lt;BR /&gt;
  myself?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'm to old for this new stuff. Guess i should stay with Arx &lt;BR /&gt;
  and ADS &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;/Matt&lt;/FONT&gt; &lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 May 2006 12:23:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651985#M81637</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-23T12:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651986#M81638</link>
      <description>&lt;DIV id="jive-html-wrapper-div"&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;Great, much shorter now &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;BR /&gt;-- &lt;BR /&gt;Roland Feletic&lt;BR /&gt;Ingenieurbuero A. Pauser Ges.m.b.H.&lt;BR /&gt;&lt;A&gt;&lt;BR /&gt;
href="http://www.pauser.at"&amp;gt;http://www.pauser.at&lt;/A&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;hp workstation xw4200, 3GB&lt;BR /&gt;quadro fx1400&lt;BR /&gt;AutoCAD 2007, 3DSMax 8.0 SP &lt;BR /&gt;
2&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 May 2006 12:44:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651986#M81638</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-23T12:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651987#M81639</link>
      <description>Matt wrote:&lt;BR /&gt;
&amp;gt; Thanks.&lt;BR /&gt;
&amp;gt; But I found a much better way (after a while):&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
&amp;gt; BlockId  = bt[BlockName]&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
&amp;gt; /Matt&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
Be wary that this method WILL return erased records, whether you want them&lt;BR /&gt;
or not. It is a serious bug in the .Net api which AutoDesk SHOULD fix.&lt;BR /&gt;
Tony Tanzillo has done a good job of explaining this.&lt;BR /&gt;
Perry</description>
      <pubDate>Tue, 23 May 2006 14:59:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651987#M81639</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-23T14:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651988#M81640</link>
      <description>&lt;DIV id="jive-html-wrapper-div"&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;But this should help, shouldn't it?&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;if&lt;/FONT&gt;&lt;FONT size="2"&gt; (!BlockId.IsErased)&lt;P&gt;&lt;/P&gt;&lt;P&gt;BlockIsInDrawing = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;true&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;FONT face="Arial" size="2"&gt;-- &lt;BR /&gt;Roland Feletic&lt;BR /&gt;Ingenieurbuero A. &lt;BR /&gt;
Pauser Ges.m.b.H.&lt;BR /&gt;&lt;/FONT&gt;&lt;A href="http://www.pauser.at"&gt;&lt;FONT face="Arial"&gt;&lt;BR /&gt;
size=2&amp;gt;http://www.pauser.at&lt;/FONT&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;hp workstation xw4200, 3GB&lt;BR /&gt;quadro &lt;BR /&gt;
fx1400&lt;BR /&gt;AutoCAD 2007, 3DSMax 8.0 SP 2&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;"perry" &amp;lt;&lt;/FONT&gt;&lt;A&gt;&lt;BR /&gt;
href="mailto:perry_leets@centurytel.net"&amp;gt;&lt;FONT face="Arial"&gt;&lt;BR /&gt;
size=2&amp;gt;perry_leets@centurytel.net&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face="Arial" size="2"&gt;&amp;gt; schrieb &lt;BR /&gt;
im Newsbeitrag &lt;/FONT&gt;&lt;A href="news:5183257@discussion.autodesk.com"&gt;&lt;FONT&gt;&lt;BR /&gt;
face=Arial size=2&amp;gt;news:5183257@discussion.autodesk.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT&gt;&lt;BR /&gt;
face=Arial size=2&amp;gt;...&lt;/FONT&gt;&lt;/DIV&gt;&lt;FONT face="Arial" size="2"&gt;Matt wrote:&lt;BR /&gt;&amp;gt; &lt;BR /&gt;
Thanks.&lt;BR /&gt;&amp;gt; But I found a much better way (after a while):&lt;BR /&gt;&amp;gt;&amp;nbsp; &lt;BR /&gt;
&lt;BR /&gt;&amp;gt; BlockId&amp;nbsp; = bt[BlockName]&lt;BR /&gt;&amp;gt;&amp;nbsp; &lt;BR /&gt;&amp;gt; &lt;BR /&gt;
/Matt&lt;BR /&gt;&amp;gt;&amp;nbsp; &lt;BR /&gt;Be wary that this method WILL return erased records, &lt;BR /&gt;
whether you want them&lt;BR /&gt;or not. It is a serious bug in the .Net api which &lt;BR /&gt;
AutoDesk SHOULD fix.&lt;BR /&gt;Tony Tanzillo has done a good job of explaining &lt;BR /&gt;
this.&lt;BR /&gt;Perry&lt;/FONT&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 May 2006 15:23:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651988#M81640</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-23T15:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651989#M81641</link>
      <description>RolandF wrote:&lt;BR /&gt;
&amp;gt; But this should help, shouldn't it?&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; if (!BlockId.IsErased)&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; BlockIsInDrawing = true;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; -- &lt;BR /&gt;
&amp;gt; Roland Feletic&lt;BR /&gt;
&amp;gt; Ingenieurbuero A. Pauser Ges.m.b.H.&lt;BR /&gt;
&amp;gt; http://www.pauser.at&lt;BR /&gt;
&lt;BR /&gt;
I also have a section of code that asks "if(!btr.isErased)" which returns&lt;BR /&gt;
true, then when I attempt to open the record I get an "eWasErased" exception.&lt;BR /&gt;
I dont trust the api in this regard. The only for sure method I know of is&lt;BR /&gt;
to iterate the whole table, using foreach.&lt;BR /&gt;
See the posts here "when is erased really erased" and "transaction, purge and&lt;BR /&gt;
ewaserased".</description>
      <pubDate>Tue, 23 May 2006 15:54:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651989#M81641</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-23T15:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651990#M81642</link>
      <description>Have a look at this newsgroup, you'll find discussions&lt;BR /&gt;
about the indexer behavior (it returns erased records).&lt;BR /&gt;
&lt;BR /&gt;
To get a non-erased record you must iterate the table,&lt;BR /&gt;
if the IsErased property of the ObjectId returned by the &lt;BR /&gt;
indexer returns true.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Matt" &lt;NOSPAM&gt; wrote in message news:5182988@discussion.autodesk.com...&lt;BR /&gt;
Thanks.&lt;BR /&gt;
But I found a much better way (after a while):&lt;BR /&gt;
 &lt;BR /&gt;
BlockId  = bt[BlockName]&lt;BR /&gt;
 &lt;BR /&gt;
/Matt&lt;BR /&gt;
 &lt;BR /&gt;
  &lt;ROLANDF&gt; wrote in message news:5182890@discussion.autodesk.com...&lt;BR /&gt;
  I do it with the following code, but i don't know if it is the best way:&lt;BR /&gt;
   &lt;BR /&gt;
public bool IsBlockInDrawing(string BlockName, out ObjectId BlockId){bool BlockIsInDrawing = false;ObjectId tmpID = new ObjectId();BlockId = tmpID;using (Transaction tr = db.TransactionManager.StartTransaction())using (BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead, false)){foreach (ObjectId tmpBlockId in bt){using (BlockTableRecord btr = (BlockTableRecord)tr.GetObject(tmpBlockId, OpenMode.ForRead, false)){if (String.Compare(btr.Name, BlockName, true) == 0){BlockIsInDrawing = true;BlockId = tmpBlockId;break;}}}tr.Commit();return BlockIsInDrawing;}} &lt;BR /&gt;
&lt;BR /&gt;
  -- &lt;BR /&gt;
  Roland Feletic&lt;BR /&gt;
  Ingenieurbuero A. Pauser Ges.m.b.H.&lt;BR /&gt;
  http://www.pauser.at&lt;BR /&gt;
   &lt;BR /&gt;
  hp workstation xw4200, 3GB&lt;BR /&gt;
  quadro fx1400&lt;BR /&gt;
  AutoCAD 2007, 3DSMax 8.0 SP 2&lt;BR /&gt;
  "Matt" &lt;NOSPAM&gt; schrieb im Newsbeitrag news:5182844@discussion.autodesk.com...&lt;BR /&gt;
  Finally trying to get my hands dirty on .NET. It's not that easy really&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
  How do i find a BlockTabelRecord from a name?&lt;BR /&gt;
&lt;BR /&gt;
  In objectArx i got the objectId using AcDbBlockTable::getAt(const ACHAR* &lt;BR /&gt;
  entryName,AcDbObjectId&amp;amp; recordId);&lt;BR /&gt;
  Then I created a new AcDbBlockReference using the id, added it to the &lt;BR /&gt;
  database and i was done.&lt;BR /&gt;
&lt;BR /&gt;
  In .NET I can not find any GetAt method. Do I have to iterate the enumerator &lt;BR /&gt;
  and find it by myself?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
  I'm to old for this new stuff. Guess i should stay with Arx and ADS &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
  /Matt&lt;/NOSPAM&gt;&lt;/ROLANDF&gt;&lt;/NOSPAM&gt;</description>
      <pubDate>Tue, 23 May 2006 16:04:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651990#M81642</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-23T16:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651991#M81643</link>
      <description>"perry" &lt;PERRY_LEETS&gt; wrote &lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;&amp;gt; I also have a section of code that asks "if(!btr.isErased)" &lt;BR /&gt;
&amp;gt;&amp;gt; which returns true, then when I attempt to open the record &lt;BR /&gt;
&amp;gt;&amp;gt; I get an "eWasErased" exception.&lt;BR /&gt;
&lt;BR /&gt;
Are you opening the record with the optional third&lt;BR /&gt;
argument to GetObject() (e.g., true = open erased&lt;BR /&gt;
object) ?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;/PERRY_LEETS&gt;</description>
      <pubDate>Tue, 23 May 2006 16:08:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651991#M81643</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-23T16:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651992#M81644</link>
      <description>Tony Tanzillo wrote:&lt;BR /&gt;
&amp;gt; "perry" &lt;PERRY_LEETS&gt; wrote &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;&amp;gt;&amp;gt;I also have a section of code that asks "if(!btr.isErased)" &lt;BR /&gt;
&amp;gt;&amp;gt;&amp;gt;which returns true, then when I attempt to open the record &lt;BR /&gt;
&amp;gt;&amp;gt;&amp;gt;I get an "eWasErased" exception.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Are you opening the record with the optional third&lt;BR /&gt;
&amp;gt; argument to GetObject() (e.g., true = open erased&lt;BR /&gt;
&amp;gt; object) ?&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
Heres the relevant snippet:&lt;BR /&gt;
// Get the block table&lt;BR /&gt;
BlockTable blkTbl = (BlockTable)(trans.GetObject(dBase.BlockTableId, OpenMode.ForRead));&lt;BR /&gt;
BlockTableRecord blkTblRec = (BlockTableRecord)trans.GetObject(blkTbl[BlockTableRecord.PaperSpace], OpenMode.ForRead);&lt;BR /&gt;
foreach (ObjectId objId in blkTblRec) //iterator should skip erased objects?&lt;BR /&gt;
{&lt;BR /&gt;
   // For each object in the block table record, cast it to a block reference&lt;BR /&gt;
    DBObject dBaseObj = trans.GetObject(objId, OpenMode.ForRead);&lt;BR /&gt;
    BlockReference blkRef = dBaseObj as BlockReference;&lt;BR /&gt;
    if (blkRef != null &amp;amp;&amp;amp; !blkRef.IsErased)//still getting erased !!!!!!!!!!!!&lt;BR /&gt;
    {...}&lt;BR /&gt;
&lt;BR /&gt;
No, I didnt specifically include the "false" in the getobject statement. I thought the default&lt;BR /&gt;
was false. Anyways, from previous discussion I was left with the impression that "getobject"&lt;BR /&gt;
was faulty and returned erased records regardless.&lt;/PERRY_LEETS&gt;</description>
      <pubDate>Tue, 23 May 2006 16:42:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651992#M81644</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-23T16:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651993#M81645</link>
      <description>If i delete all blockreferences in the drawing and then i purge the drawing &lt;BR /&gt;
i do not get an error.&lt;BR /&gt;
So the error just occours when i delete it in the programm, dosn't it?&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Roland Feletic&lt;BR /&gt;
Ingenieurbuero A. Pauser Ges.m.b.H.&lt;BR /&gt;
http://www.pauser.at&lt;BR /&gt;
&lt;BR /&gt;
hp workstation xw4200, 3GB&lt;BR /&gt;
quadro fx1400&lt;BR /&gt;
AutoCAD 2007, 3DSMax 8.0 SP 2</description>
      <pubDate>Wed, 24 May 2006 07:01:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651993#M81645</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-24T07:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do i find a block in the BlockTable</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651994#M81646</link>
      <description>&lt;DIV id="jive-html-wrapper-div"&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;Now i changed the function a little bit. This &lt;BR /&gt;
should work now.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;public&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;bool&lt;/FONT&gt;&lt;FONT size="2"&gt; IsBlockInDrawing(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;string&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockName, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;out&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockId)&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bool&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockIsInDrawing = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BlockId = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;ObjectId&lt;/FONT&gt;&lt;FONT size="2"&gt;();&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;Transaction&lt;/FONT&gt;&lt;FONT size="2"&gt; tr = db.TransactionManager.StartTransaction())&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTable&lt;/FONT&gt;&lt;FONT size="2"&gt; bt = (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTable&lt;/FONT&gt;&lt;FONT size="2"&gt;)tr.GetObject(db.BlockTableId, &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;OpenMode&lt;/FONT&gt;&lt;FONT size="2"&gt;.ForRead, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;))&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; BlockId = bt[BlockName];&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; using&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTableRecord&lt;/FONT&gt;&lt;FONT size="2"&gt; btr = (&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;BlockTableRecord&lt;/FONT&gt;&lt;FONT size="2"&gt;)tr.GetObject(BlockId, &lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;OpenMode&lt;/FONT&gt;&lt;FONT size="2"&gt;.ForRead, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;false&lt;/FONT&gt;&lt;FONT size="2"&gt;))&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT size="2"&gt; (!btr.IsLayout &lt;/FONT&gt;&lt;FONT size="2"&gt;&amp;amp;&amp;amp; !btr.IsAnonymous&lt;/FONT&gt;&lt;FONT size="2"&gt;)&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; BlockIsInDrawing = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;true&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; catch&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; tr.Commit();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/FONT&gt;&lt;FONT size="2"&gt; BlockIsInDrawing;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="Arial" size="2"&gt;-- &lt;BR /&gt;Roland &lt;BR /&gt;
Feletic&lt;BR /&gt;Ingenieurbuero A. Pauser Ges.m.b.H.&lt;BR /&gt;&lt;/FONT&gt;&lt;A&gt;&lt;BR /&gt;
href="http://www.pauser.at"&amp;gt;&lt;FONT face="Arial"&gt;&lt;BR /&gt;
size=2&amp;gt;http://www.pauser.at&lt;/FONT&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;hp workstation xw4200, 3GB&lt;BR /&gt;quadro &lt;BR /&gt;
fx1400&lt;BR /&gt;AutoCAD 2007, 3DSMax 8.0 SP 2&lt;/FONT&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 May 2006 09:37:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-do-i-find-a-block-in-the-blocktable/m-p/1651994#M81646</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-24T09:37:29Z</dc:date>
    </item>
  </channel>
</rss>

