[Search tip detail and code files using keywords, tip number, author name, etc ]
 
Specify Relative Paths
Tip# 3288 By Leonid Nemirovsky On 25-Oct-2009
4
Rated By 1 users
Categories : DWG
Software type : AutoCAD 2010
Rename File To : No Files to download.
This two-part tip helps maintain the path of referenced files and helps repath files from outside sources.

Frequent tipster Leonid Nemirovsky details a method he uses to help maintain the paths of referenced files, and he also describes a script file he has created that helps him to repath files from outside sources.

"When I create xrefs I always use relative paths, making it easier for people who get our drawings with xrefs to use them with minimal tweaking.
 
"Relative paths are partially specified folder paths that assume the current drive letter or the folder of the host drawing. This is the most flexible option, and enables you to move a set of drawings from your current drive to a different drive that uses the same folder structure. If the file that is being referenced is located on a different local hard drive or on a network server, the relative path option is not available.
 
"The conventions for specifying a relative folder path are as follows:
 

Look in the root folder of the host drawing's drive

 
path

From the folder of the host drawing, follow the specified path

 
path

From the root folder, follow the specified path

 
.path

From the folder of the host drawing, follow the specified path

 
..path

From the folder of the host drawing, move up one folder level and follow the specified path

 
....path

From the folder of the host drawing, move up two folder levels and follow the specified path

"If a drawing that contains referenced files is moved or saved to a different path, to a different local hard drive, or to a different network server, you must edit any relative paths to accommodate the host drawing's new location — or you must relocate the referenced files.
 
"When I receive work from outside of my company that use xrefs, I usually put them into folder one step above the working folder with main drawings (I call it 'Received'). Then, based on the switches explained above and the Express Tools routine REDIR, I create a script to repath the xrefs.
 
"Here is the script code:
 
(c:redir)
*
..
;
 
"Save it as REDIR.SCR (or as any other name: MYNAME.SCR). Please note that the semicolon (;) in the script can be replaced with a blank line (only one blank line). If .. and path are not specified, it will look one folder up, but you can specify the exact path. After you run this script from one of the received drawings, xrefs for all drawings in the range (current folder and one folder above) will be repathed."
 
Notes from Cadalyst Tip Patrol: Referenced files are key to producing drawings in AutoCAD. Sometimes we know exactly where the file is going to be and that it will always be there. Other times those files move for one reason or another. Usually the problem crops up when we get files from outside sources that use referenced files. The problem is that the outside source isn't using the same folder structure that you are; it could be as simple as a different drive letter. To help reduce this risk, use relative paths. A relative path will tell AutoCAD to look in the parent folder of the file that is opened, or to look one folder up or down depending on the switches you have added to the path as described above. When you create a reference with a relative path, AutoCAD will automatically create the switches for you as required. Just click the Relative Path option in the Reference Manager when you create your reference link. 

 

 

Average Rating:
4


User comments
Comment by Anonymous
Posted on 2009-11-01 18:57:24
Great tip. If you ever need to rename, move or reorganize a large volume of DWGs and xrefs -- like when you're migrating to a new server or hard drive -- there is a product called LinkFixerPlus (http://www.linktek.com/autocad/autocad-overview.htm) that lets do pretty much anything you want without breaking xrefs or creating broken links.