<?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: Xref - GetFullPathname (i.e &amp;quot;C:\folder1\folder2\Xref.dwg&amp;quot;) in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3532408#M54699</link>
    <description>&lt;P&gt;Below is a sample. Run this in a drawing that contains xrefs. I use it with AutoCAD 2012 and haven't had any problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[CommandMethod("ListXrefPaths")]
public static void ListXrefPaths()
{
	Document doc = Application.DocumentManager.MdiActiveDocument;
	Database db = doc.Database;
	Editor ed = doc.Editor;

	using (Transaction tr = db.TransactionManager.StartTransaction())
	{
		// Iterate block table.
		BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite);
		foreach (ObjectId id in bt)
		{
			// Get block table record.
			BlockTableRecord btr = (BlockTableRecord)tr.GetObject(id, OpenMode.ForWrite);

			// Check if block table record is for an xref.
			if (btr.IsFromExternalReference)
			{
				// Output summary to command-line.
				ed.WriteMessage(
					"\n* Name:      {0}" +
					"\n  Path:      {1}" +
					"\n  Full Path: {2}",
					btr.Name,
					btr.PathName,
					btr.GetXrefDatabase(true).Filename);
			}
		}
	}
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jul 2012 07:55:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-07-10T07:55:46Z</dc:date>
    <item>
      <title>Xref - GetFullPathname (i.e "C:\folder1\folder2\Xref.dwg")</title>
      <link>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3527522#M54693</link>
      <description>&lt;P&gt;How do I get the full Xref Path name instead of Xref.dwg?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm scratching my head is this totally under my nose... cause I don't see where the property is stored.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting&amp;nbsp;EV_BDR.dwg instead of C:\folder\EV_BDR.dwg&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2012 15:26:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3527522#M54693</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-05T15:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Xref - GetFullPathname (i.e "C:\folder1\folder2\Xref.dwg")</title>
      <link>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3528158#M54694</link>
      <description>&lt;P&gt;The BlockTableRecord.Name property returns the xref file path, but not necessarily the full path. It depends on whether the xref is placed with a full path, relative path or no path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead try using the BlockTableRecord.GetXrefDatabase().Filename property. This will give you the full path regardless of the xref path type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using the xref graph, you would use XrefGraphNode.Database.Filename.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Art&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2012 19:57:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3528158#M54694</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-05T19:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Xref - GetFullPathname (i.e "C:\folder1\folder2\Xref.dwg")</title>
      <link>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3529452#M54695</link>
      <description>&lt;P&gt;BlockTableRecord has the PathName property.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2012 16:01:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3529452#M54695</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-06T16:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Xref - GetFullPathname (i.e "C:\folder1\folder2\Xref.dwg")</title>
      <link>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3530092#M54696</link>
      <description>&lt;P&gt;The BlockTableRecord.PathName property returns the xref path in a format dependant upon on whether the xref is placed with a full path, relative path or no path. Whereas BlockTableRecord.GetXrefDatabase().Filename always returns&amp;nbsp;the full path to the xref, irrespective of how the xref path has been specified.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jul 2012 08:19:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3530092#M54696</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-07T08:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Xref - GetFullPathname (i.e "C:\folder1\folder2\Xref.dwg")</title>
      <link>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3531010#M54697</link>
      <description>&lt;P&gt;Thank you for the tip Artvegas!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2012 12:50:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3531010#M54697</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-09T12:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Xref - GetFullPathname (i.e "C:\folder1\folder2\Xref.dwg")</title>
      <link>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3532060#M54698</link>
      <description>&lt;P&gt;How are you using btr.GetXrefDatabase to derive the full path to a BlockTableRecord. I tried using this bit of code, but it crashes AutoCAD?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim xrefLoc As String = btr.GetXrefDatabase(True).Filename.ToString&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2012 22:48:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3532060#M54698</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-09T22:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Xref - GetFullPathname (i.e "C:\folder1\folder2\Xref.dwg")</title>
      <link>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3532408#M54699</link>
      <description>&lt;P&gt;Below is a sample. Run this in a drawing that contains xrefs. I use it with AutoCAD 2012 and haven't had any problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[CommandMethod("ListXrefPaths")]
public static void ListXrefPaths()
{
	Document doc = Application.DocumentManager.MdiActiveDocument;
	Database db = doc.Database;
	Editor ed = doc.Editor;

	using (Transaction tr = db.TransactionManager.StartTransaction())
	{
		// Iterate block table.
		BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite);
		foreach (ObjectId id in bt)
		{
			// Get block table record.
			BlockTableRecord btr = (BlockTableRecord)tr.GetObject(id, OpenMode.ForWrite);

			// Check if block table record is for an xref.
			if (btr.IsFromExternalReference)
			{
				// Output summary to command-line.
				ed.WriteMessage(
					"\n* Name:      {0}" +
					"\n  Path:      {1}" +
					"\n  Full Path: {2}",
					btr.Name,
					btr.PathName,
					btr.GetXrefDatabase(true).Filename);
			}
		}
	}
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2012 07:55:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3532408#M54699</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-10T07:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Xref - GetFullPathname (i.e "C:\folder1\folder2\Xref.dwg")</title>
      <link>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3534438#M54700</link>
      <description>&lt;P&gt;Does the BlockTableRecord have to be open for write? I have mine open for read. That is probably the issue.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 13:18:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3534438#M54700</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-11T13:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Xref - GetFullPathname (i.e "C:\folder1\folder2\Xref.dwg")</title>
      <link>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3534904#M54701</link>
      <description>&lt;P&gt;Sorry I should have specified both the BlockTable and BlockTableRecords to be opened with OpenMode.ForRead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code will work the same, and changing this to ForRead shouldn't result in an AutoCAD crash. I tried both and had no problem.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 17:24:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xref-getfullpathname-i-e-quot-c-folder1-folder2-xref-dwg-quot/m-p/3534904#M54701</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-11T17:24:50Z</dc:date>
    </item>
  </channel>
</rss>

