<?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: Detaching Xrefs in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6364723#M35869</link>
    <description>&lt;P&gt;Thanks- after reading this i realized it was only the imge refs not working...&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jun 2016 15:53:58 GMT</pubDate>
    <dc:creator>Littlerubarb</dc:creator>
    <dc:date>2016-06-03T15:53:58Z</dc:date>
    <item>
      <title>Detaching Xrefs</title>
      <link>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6360877#M35865</link>
      <description>&lt;P&gt;Afternoon, It been a while and Im trying to force a detach in a load of files using a batch script. No errors are being thrown but the image references that are not found are still in the drawing. Its got to be something simple in the code below. Just need another set of eyes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try&lt;BR /&gt;For Each Me.filepath In ListBox1.Items&lt;BR /&gt;ProgressBar1.Maximum = fileprogress&lt;BR /&gt;Dim fi As New FileInfo(filepath)&lt;/P&gt;&lt;P&gt;Dim db As New Database(False, True)&lt;BR /&gt;Try&lt;BR /&gt;db.ReadDwgFile(filepath, System.IO.FileShare.ReadWrite, False, "")&lt;BR /&gt;t = db.TransactionManager.StartTransaction&lt;BR /&gt;Using t&lt;BR /&gt;Dim bt As BlockTable = CType(db.BlockTableId.GetObject(OpenMode.ForRead), BlockTable)&lt;BR /&gt;Dim id As ObjectId&lt;BR /&gt;For Each id In bt&lt;BR /&gt;Dim btr As BlockTableRecord = CType(id.GetObject(OpenMode.ForRead), BlockTableRecord)&lt;BR /&gt;If btr.XrefStatus = XrefStatus.NotAnXref And btr.XrefStatus = XrefStatus.FileNotFound Or btr.XrefStatus = XrefStatus.Unreferenced Then&lt;BR /&gt;db.DetachXref(id)&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;BR /&gt;t.Commit()&lt;BR /&gt;End Using&lt;BR /&gt;Catch&lt;BR /&gt;MsgBox(Err.Description + "ouch")&lt;BR /&gt;Finally&lt;BR /&gt;db.SaveAs(filepath, DwgVersion.Current)&lt;BR /&gt;t.Dispose()&lt;BR /&gt;End Try&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2016 21:40:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6360877#M35865</guid>
      <dc:creator>Littlerubarb</dc:creator>
      <dc:date>2016-06-01T21:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Detaching Xrefs</title>
      <link>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6361289#M35866</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try calling “ResolveXrefs” on the database. See if forum post &lt;A href="https://forums.autodesk.com/t5/net/net-c-unable-to-detaching-filenotfound-xref-without-opening-the/td-p/3556778" target="_blank"&gt;http://forums.autodesk.com/t5/net/net-c-unable-to-detaching-filenotfound-xref-without-opening-the/td-p/3556778&lt;/A&gt; helps&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 04:43:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6361289#M35866</guid>
      <dc:creator>Virupaksha_aithal</dc:creator>
      <dc:date>2016-06-02T04:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Detaching Xrefs</title>
      <link>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6361293#M35867</link>
      <description>The reference manager might work?</description>
      <pubDate>Thu, 02 Jun 2016 04:47:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6361293#M35867</guid>
      <dc:creator>brianchapmandesign</dc:creator>
      <dc:date>2016-06-02T04:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Detaching Xrefs</title>
      <link>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6364720#M35868</link>
      <description>&lt;P&gt;Ok little modification - It doesn't remove images, just dwg xrefs..&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 15:53:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6364720#M35868</guid>
      <dc:creator>Littlerubarb</dc:creator>
      <dc:date>2016-06-03T15:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Detaching Xrefs</title>
      <link>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6364723#M35869</link>
      <description>&lt;P&gt;Thanks- after reading this i realized it was only the imge refs not working...&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 15:53:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6364723#M35869</guid>
      <dc:creator>Littlerubarb</dc:creator>
      <dc:date>2016-06-03T15:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Detaching Xrefs</title>
      <link>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6364908#M35870</link>
      <description>&lt;P&gt;Here's the solution&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;CommandMethod("DetachImg")&amp;gt; _&lt;BR /&gt;Public Sub detach_img(mainDrawingFile As String)&lt;BR /&gt;Dim db As New Database(False, True)&lt;BR /&gt;db.ReadDwgFile(mainDrawingFile, System.IO.FileShare.ReadWrite, True, "")&lt;BR /&gt;Using db&lt;BR /&gt;Dim saveRequired As Boolean = False&lt;BR /&gt;Using tr As Transaction = db.TransactionManager.StartTransaction()&lt;BR /&gt;Dim imageDictId As ObjectId = RasterImageDef.GetImageDictionary(db)&lt;BR /&gt;If imageDictId.IsNull Then&lt;BR /&gt;Else&lt;BR /&gt;Dim imageDefinitions As New Dictionary(Of ObjectId, RasterImageDef)()&lt;BR /&gt;Dim imageDictionary As DBDictionary = tr.GetObject(RasterImageDef.GetImageDictionary(db), OpenMode.ForWrite)&lt;BR /&gt;For Each entry As DBDictionaryEntry In imageDictionary&lt;BR /&gt;Dim id As ObjectId = entry.Value, ObjectId&lt;BR /&gt;Dim rasterImageDef__1 As RasterImageDef = tr.GetObject(id, OpenMode.ForWrite)&lt;BR /&gt;If rasterImageDef__1.LocateActivePath = "" Then&lt;BR /&gt;rasterImageDef__1.Erase()&lt;BR /&gt;saveRequired = True&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;BR /&gt;End If&lt;BR /&gt;tr.Commit()&lt;BR /&gt;tr.Dispose()&lt;BR /&gt;End Using&lt;BR /&gt;If saveRequired Then&lt;BR /&gt;db.SaveAs(mainDrawingFile, DwgVersion.Current)&lt;BR /&gt;End If&lt;BR /&gt;End Using&lt;BR /&gt;End Sub&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 17:02:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/detaching-xrefs/m-p/6364908#M35870</guid>
      <dc:creator>Littlerubarb</dc:creator>
      <dc:date>2016-06-03T17:02:42Z</dc:date>
    </item>
  </channel>
</rss>

