Tuesday, August 14, 2007

Xref Paths

I'm often asked how does AutoCAD find and resolve external references, Xrefs? This tip (well a little more than a tip I'm afraid) will attempt to answer that question. Are you all sitting comfortably? Then let's begin.

AutoCAD searches for Xrefs in the following locations, in order, until it finds the external file:
  1. The location specified in the Xref dialog,
  2. The same folder as the current drawing,
  3. The folders specified by PROJECTNAME,
  4. The folders that make up the library path,
  5. The current folder (the folder from which AutoCAD was started).

So let's cover each of these possibilities in a little more depth:

1. Specified Location

There are three ways to specify the Xref's location in the Xref dialog: Full Path, Relative Path, and No Path. Full path tells AutoCAD exactly where to look; e.g. P:\Proj\CAD\A\Det.

Relative Path gives AutoCAD a partial folder structure that is relative to the current drawing location. Let's say that your current drawing is in folder P:\Proj\CAD\A, then:

Xref location Relative Path What is happening
P:\Proj\CAD\xref.dwg ..\xref.dwg ACAD looks back one folder from the current drawing folder (..\ means back up one folder)
P:\Proj\CAD\A\Det\xref.dwg .\Det\xref.dwg
or
Det\xref.dwg
ACAD looks forward into Det from the current drawing folder (.\ means start from the current folder, or simply leave this off and the current folder is assumed)
P:\Proj\CAD\S\Det\xref.dwg ..\S\Det\xref.dwg ACAD backs up one folder to CAD, then goes forward into S\Det

Compare the Saved Path to the Found At path in the Xref palette to see if you're getting expected results.

2. The Current Drawing's Folder

If AutoCAD cannot find the Xref in the specified or relative folder, or the Xref was attached with the No Path option, AutoCAD next looks in the current drawing's folder for the reference file.

3. PROJECTNAME

If AutoCAD fails to find the Xref in the specified folder, relative folder, or the current drawing's folder, then it searches the folders specified by the drawing's PROJECTNAME system variable.

Use Options > Files > Project Files Search Path to create projects. Let's say you create a project 6250620000 and add to it multiple folders. When you set a drawing's PROJECTNAME variable to 625062000 that drawing will search those specified folders, in order, when resolving references. Drawing's that have other values for PROJECTNAME will look in that project's folders.

Whereas the value of the PROJECTNAME variable is stored in the drawing, the Project folders are stored in the user's registry. So, if you use this method to create search paths for your references, make sure that you set up the Projects the same way on every workstation.

4. Library Path

This is the list of folders specified in Options > Files > Support File Search Path. These folders are typically the program folders for AutoCAD itself, but you can add your own folders too. Many Benham offices use an environment variable in this location, then start AutoCAD with a specific project start up batch file that, among other things, specifies folders for this variable. Clever huh?

In this example the TBGPATH variable is set to two folders. You can see that the variable does in fact resolve to the desired folders by comparing the Support File Search Path to the Working Support File Support Path, which is the path that AutoCAD is actually using for the session.

5. The Current Folder

The last place AutoCAD looks for Xrefs is in the current folder, the folder from which you started AutoCAD. This folder is specified by the Start in folder of the shortcut. Project start up batch files can also be used to set the current folder.If you make it a practice to keep all reference files in one folder, and start AutoCAD from that folder, then no matter what folder your sheets are in, or where the current drawing thinks its references are (specified path, relative path or project name), AutoCAD will still be able to resolve the references.

Let's Sum Up

So, which method is best? The answer depends a great deal on your needs. The easiest way is to simply use explicit paths. However, this is less than ideal when sending the files to clients, moving from drive to drive, changing the name of the root folder, etc. Using Relative paths is almost as easy and circumvents most of the problems above. Or, use the No Path option and let the start up batch file or project shortcut control the search locations for you.

11 Comments:

At 10:28 AM , Blogger R.K. McSwain said...

Nice writeup.

 
At 2:37 PM , Anonymous Anonymous said...

I work on AutoCAD 2007
At present all the drawing projects are on 1 network drive

Question


For archive purposes we are talking of making 2 dives

1 Active Projects
2 Archived Projects


Say the file path for the Xref attached to drawings is H\project\drawings\ Xref
(Active Project Drive)

When the project is archived to the Archived projects Drive all the file path of the Xref is destroyed. The new file path will turn into K\project\drawings\ Xref


Is there a way to get ACAD to globally ignore the Drive letter of the Xref Folders

 
At 8:42 PM , Blogger Ward Romberger said...

AutoCAD will first try to find the xrefs on the specified drive in the specified folder, which is to say the H: drive. If the files do not exist there, in that they were moved to K: rather than copied, then AutoCAD will fail to find them on H: and start down its library path. If the files are all in one folder on the archive drive, then AutoCAD will resolve them. But if they're are in various sub-folders, like an Xref sub-folder, AutoCAD may fail to find them. You could add the search path to the environment, or start AutoCAD in the Xref sub-folder (making that folder part of the library path), even setup PROJECTNAME for the project drawing files.

However, there's a tool supplied by Autodesk called Reference Manager (see post from Friday, Mar 24, 2006) That will allow you to change and save all the reference paths in all the drawings of a project in one operation.

 
At 7:40 PM , Anonymous Anonymous said...

So the big question...
We are using Sharepoint document libraries holding hundreds of different projects. All XREF's for each project are located in a subdirectory of the particular project folder in the project library...

How can we get AutoCAD to search the relative path of \\sharepoint\projects\"1 thru 1000"\xref\ without adding 1000 different file search paths?

 
At 10:15 PM , Blogger Ward Romberger said...

well, you wouldn't need to (nor could you) add that many search paths. but with relative pathing you don't need to, see 1. Specified Path.

Let's say project 1 has references in:

\\sharepoint\projects\proj1\xrefs

and your sheets exist in:

\\sharepoint\projects\proj1\sheets

then your relative path to the references from the sheets would be:

..\xrefs\refname

save the sheet drawings with this structure, or use the Reference Manager to change all the paths en masse. Use this same type of relative pathing structure for each project on your sharepoint site.

 
At 11:16 AM , Blogger MPinnamaneni said...

I don't have an AutoCAD installed and I know that the dwg file is having xref's.
is there a way to find the xref location & exact file name that the document is referring without using autocad?

 
At 10:56 PM , Blogger Ward Romberger said...

Hmm, well you can download and install Autodesk's free DWG viewer, DWG TrueView. Go to the Autodesk website and search for it in the product list.

When you open a drawing with DWG TrueView it will load all the references it can find. And if you hit F2 once the drawing is open, you can scroll back through the load history and see the names of all Xrefs saved in the DWG whether they were found or not. If the path was saved in the DWG you'll see that too.

 
At 4:23 AM , Anonymous Anonymous said...

About the last location - current folder.
I think AutoCAD may also search from not only the start in location, but also my desktop, However sometimes.
Have you met this before?
I have a shortcut of acad.exe on my desktop. Is this why it searches from desktop?

 
At 11:49 AM , Anonymous Anonymous said...

Thank you for the explanation! Sure helps as I'm creating the AutoCad setup and startup file myself, for a current job.

 
At 5:54 AM , Anonymous Anonymous said...

I know this is an old post, but I'd be obliged if you can help me.
Is their a way to add a relative path (say ..\xrefs\refname\) to the support path?
I've tried it, but it doesn't appear to work.
Thanks for any help you can provide.

 
At 10:35 PM , Anonymous Anonymous said...

Hi, I have set up 'PROJECTNAME' but have to manually set it current in every drawing for a large project. I move the files around on my laptop and sinc them to my PC but need to repath each time. I see that setting a 'PROJECTNAME' helps but how can I set it so that the drawings in that specific project folder automatically looks at tha 'PROJECTNAME'.

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home