.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get xref drawing paths without opening drawing

2 REPLIES 2
Reply
Message 1 of 3
skeletank
991 Views, 2 Replies

Get xref drawing paths without opening drawing

In C# I want to get the xrefs for a drawing WITHOUT opening the drawing.  Right now I can open the drawing and then use the DataBase.GetHostDwgXrefGraph to get the XrefGraph and do XrefGraphNode.Database.FileName to get the drawing path.  I know that I can use this method before opening the drawing but then the Database field will be null.  The alternative is to use the XrefGraphNode.BlockTableRecordId property to get the BlockTableRecord for the Xref and then do BlockTableRecord.PathName to get the Xref drawing path.  The problem is that the PathName is a little confusing.  For example

 

Main Drawing Path (from current database) = "C:\Drawings\MainDrawing.dwg"

Xref Drawing Path (PathName property) = "Drawings\XrefDrawing.dwg"

 

Why isn't the PathName property just set to "XrefDrawing.dwg" if it's in the same folder as the main drawing? What is the way to get the absolute path of the XrefDrawing.dwg from the MainDrawing.dwg path?  Is there an alternative way I could do this?

2 REPLIES 2
Message 2 of 3
Jeffrey_H
in reply to: skeletank

The Xref is attached as Relative

 

You can use the .NET Path class or there is a property I think FoundPath you can use

 

You can also find your answers @ TheSwamp
Message 3 of 3
skeletank
in reply to: Jeffrey_H

I'm familiar with the .NET path class but why is it including the 'lib1' folder in the relative path of the xref drawing if the main drawing is also in the 'lib1' folder?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost