<?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 Bind drawings in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/bind-drawings/m-p/2474126#M70868</link>
    <description>Im having some trouble binding some drawings. Im pretty sure I have the transaction working correctly but I keep getting an eLockViolation error when I try and bind the drawings - any help super appreciated.&lt;BR /&gt;
&lt;BR /&gt;
my code:&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Dim ThisDrawing As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
        Dim DocDB As Database = ThisDrawing.Database&lt;BR /&gt;
&lt;BR /&gt;
        Dim Trans As Transaction = DocDB.TransactionManager.StartTransaction&lt;BR /&gt;
        &lt;BR /&gt;
&lt;BR /&gt;
        'get bt as transaction&lt;BR /&gt;
        Dim DocBT As BlockTable = Trans.GetObject(DocDB.BlockTableId, OpenMode.ForRead)&lt;BR /&gt;
        'enumerat the BTRs&lt;BR /&gt;
        Dim DocBTR As SymbolTableEnumerator&lt;BR /&gt;
        DocBTR = DocBT.GetEnumerator&lt;BR /&gt;
        Dim ObjIDColl As New ObjectIdCollection&lt;BR /&gt;
&lt;BR /&gt;
        While DocBTR.MoveNext = True&lt;BR /&gt;
&lt;BR /&gt;
            Dim record = DocBTR.Current.GetObject(OpenMode.ForRead)&lt;BR /&gt;
&lt;BR /&gt;
            Dim FinRecord As BlockTableRecord = CType(record, BlockTableRecord)&lt;BR /&gt;
            If FinRecord.IsFromExternalReference And FinRecord.IsResolved Then&lt;BR /&gt;
                ObjIDColl.Add(FinRecord.Id)&lt;BR /&gt;
            End If&lt;BR /&gt;
        End While&lt;BR /&gt;
        Trans.Commit()&lt;BR /&gt;
        Trans.Dispose()&lt;BR /&gt;
        DocDB.BindXrefs(ObjIDColl, True)&lt;BR /&gt;
&lt;BR /&gt;
{code}</description>
    <pubDate>Thu, 23 Apr 2009 14:44:59 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-04-23T14:44:59Z</dc:date>
    <item>
      <title>Bind drawings</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-drawings/m-p/2474126#M70868</link>
      <description>Im having some trouble binding some drawings. Im pretty sure I have the transaction working correctly but I keep getting an eLockViolation error when I try and bind the drawings - any help super appreciated.&lt;BR /&gt;
&lt;BR /&gt;
my code:&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Dim ThisDrawing As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
        Dim DocDB As Database = ThisDrawing.Database&lt;BR /&gt;
&lt;BR /&gt;
        Dim Trans As Transaction = DocDB.TransactionManager.StartTransaction&lt;BR /&gt;
        &lt;BR /&gt;
&lt;BR /&gt;
        'get bt as transaction&lt;BR /&gt;
        Dim DocBT As BlockTable = Trans.GetObject(DocDB.BlockTableId, OpenMode.ForRead)&lt;BR /&gt;
        'enumerat the BTRs&lt;BR /&gt;
        Dim DocBTR As SymbolTableEnumerator&lt;BR /&gt;
        DocBTR = DocBT.GetEnumerator&lt;BR /&gt;
        Dim ObjIDColl As New ObjectIdCollection&lt;BR /&gt;
&lt;BR /&gt;
        While DocBTR.MoveNext = True&lt;BR /&gt;
&lt;BR /&gt;
            Dim record = DocBTR.Current.GetObject(OpenMode.ForRead)&lt;BR /&gt;
&lt;BR /&gt;
            Dim FinRecord As BlockTableRecord = CType(record, BlockTableRecord)&lt;BR /&gt;
            If FinRecord.IsFromExternalReference And FinRecord.IsResolved Then&lt;BR /&gt;
                ObjIDColl.Add(FinRecord.Id)&lt;BR /&gt;
            End If&lt;BR /&gt;
        End While&lt;BR /&gt;
        Trans.Commit()&lt;BR /&gt;
        Trans.Dispose()&lt;BR /&gt;
        DocDB.BindXrefs(ObjIDColl, True)&lt;BR /&gt;
&lt;BR /&gt;
{code}</description>
      <pubDate>Thu, 23 Apr 2009 14:44:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-drawings/m-p/2474126#M70868</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-23T14:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Bind drawings</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-drawings/m-p/2474127#M70869</link>
      <description>try locking the document first&lt;BR /&gt;
&lt;BR /&gt;
Using lock As DocumentLock = Application.DocumentManager.MdiActiveDocument.LockDocument&lt;BR /&gt;
&lt;BR /&gt;
... code here. &lt;BR /&gt;
&lt;BR /&gt;
end using</description>
      <pubDate>Thu, 23 Apr 2009 14:54:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-drawings/m-p/2474127#M70869</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2009-04-23T14:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Bind drawings</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-drawings/m-p/2474128#M70870</link>
      <description>I actually love you! Why didnt I think of that before?!</description>
      <pubDate>Thu, 23 Apr 2009 14:58:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-drawings/m-p/2474128#M70870</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-23T14:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Bind drawings</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-drawings/m-p/2474129#M70871</link>
      <description>I feel so honored.</description>
      <pubDate>Thu, 23 Apr 2009 15:05:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-drawings/m-p/2474129#M70871</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2009-04-23T15:05:43Z</dc:date>
    </item>
  </channel>
</rss>

