.NET

Reply
Contributor
cbutler1
Posts: 25
Registered: ‎11-13-2006
Message 1 of 6 (352 Views)

Xref Found At or Resolved Path

352 Views, 5 Replies
04-22-2009 09:46 AM
Using VB .NET we're trying to find the Resolved path of an Xref. We can get the Saved path (which, for us, is only the xref dwg name) but we need to determine where the Xref was "found at" by AutoCAD.

If someone can point us to the right object, it would be greatly appreciated.

Thanks in advance,

Craig.
Mentor
t.willey
Posts: 2,504
Registered: ‎02-17-2004
Message 2 of 6 (352 Views)

Re: Xref Found At or Resolved Path

04-24-2009 04:06 PM in reply to: cbutler1
Check out the ' FindFile ' method. Here is how I called it in one of my routines.

HostApplicationServices.Current.FindFile(FilePath, db, FindFileHint.Default)

Where ' FilePath ' = path to search ( could be just a drawing name )
db = Database to search with reference to

I think there is a ' FindFileHint ' for Xref, but I'm not sure.
Contributor
cbutler1
Posts: 25
Registered: ‎11-13-2006
Message 3 of 6 (352 Views)

Re: Xref Found At or Resolved Path

04-27-2009 01:18 PM in reply to: cbutler1
Thanks for the suggestion.

Findfile doesn't help if we're using the "Project Files Search Path" for locating Xrefs vs the "Support Files Search Path". Things start getting ugly. I was hoping that since the location information is available and known to AutoCAD there'd be a way to access it directly.

Craig
Mentor
t.willey
Posts: 2,504
Registered: ‎02-17-2004
Message 4 of 6 (352 Views)

Re: Xref Found At or Resolved Path

04-27-2009 01:21 PM in reply to: cbutler1
Is there a FindFileHint for projects? I don't know, as I don't use projects. If not, then you could roll your own.
Mentor
t.willey
Posts: 2,504
Registered: ‎02-17-2004
Message 5 of 6 (352 Views)

Re: Xref Found At or Resolved Path

04-27-2009 02:11 PM in reply to: cbutler1
Nevermind the first part of the previous reply. It makes no sense. Not sure what I was thinking.

I think you will have to roll your own find file if one doesn't exist with the project search path.
Active Contributor
harryliu3140
Posts: 46
Registered: ‎10-29-2009
Message 6 of 6 (82 Views)

Re: Xref Found At or Resolved Path

03-28-2013 02:02 PM in reply to: cbutler1

I saw this thread when I have the problem. The solution is found out of this disscussion group:

 

        '-----------The key is db.ResolveXrefs, otherwise the Database of the Xref will be Nothing
db.ResolveXrefs(False, False) Dim XrGph As XrefGraph = db.GetHostDwgXrefGraph(True) For i As Integer = 1 To XrGph.NumNodes - 1 Dim XrGphNode As XrefGraphNode = XrGph.GetXrefNode(i) '------- the found path of the Xref is available now dim foundpath as string =XrGphNode.Database.Filename Next

 For anyone who has this problem...

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.