Who Knew about AutoCAD Projects? (Learning Curve AutoCAD Tutorial)1 Jul, 2008 By: Bill Fane
Here's the secret to keeping unruly xrefs under control.
It was a... it was a... oh, who knows what kind of afternoon it was. Captain LearnCurve was happily settled into an Executive First Suite of an Air Canada 767 flying at 42,000 feet over the Pacific Ocean. An Executive First Suite is not just a business-class seat, not by a long shot. It consists of your own little cocoon, complete with an electrically operated seat that requires seven buttons to operate, including one for the back massage.
He had finished the four-course lunch complete with assorted wines and liqueurs, and then had reclined the seat to its full flat-bed position for a small nap, assisted by the supplied background-cancelling headphones. Awakening refreshed, he began to project his thoughts to the project at hand... That's it! This month's topic: Projects.
You have to love the English language, in which a slight difference in pronunciation produces a totally different meaning. Now let's really confuse the issue. Let's study a case wherein the same word pronounced the same way means the same thing, but you probably don't even realize that the second case exists. I'm sure most of you have worked on a large project using AutoCAD, but this month we are going to investigate AutoCAD projects. Stick with me, and you'll see what I mean.
X Marks the Ref
I'm sure many of you have worked on a large, complex project that involved a great many drawings. Under these circumstances it is often advantageous to make use of externally referenced (xref) files in order to keep things coordinated. For example, a large multibuilding construction project might start with a site plan.
Separate drawings are then created for each building. Each of them contains an xref to the site plan. An xref is almost identical to a regular block insertion, except that the block definition does not live in the host drawing but instead references the other file.
This has several advantages, including the fact that if the site plan changes, then it automatically updates all other drawings that host it. Everything stays in step.
This arrangement can continue through several levels of nesting, so that the electrical drawing references the machinery layout drawing which references the structural drawing which references the site plan, and so on. These various xrefs can come from different disciplines in different departments using different folders or different network drives.
The same principle can also be used in the design of a large machine wherein standard components can be xref'd into the larger subassemblies, which in turn all reference the same main frame drawing.
Down the Garden Path
So far, so good, until a file gets moved or a folder gets renamed. Oops! The links are broken and AutoCAD can't find the referenced file. Yes, the links can be repaired by opening each host drawing and then browsing to the new location, but this gets quite messy when a project includes hundreds of drawings and each has multiple xref links.
Fortunately, this can be avoided so that the links become self-repairing.
Three Kinds of Search Path
AutoCAD allows you to specify which one of the three possible path definitions to use when you insert an xref into a host drawing. The desired one is selected from a drop list in the External Reference dialog box.
AutoCAD defaults to the Full path. This means that the host drawing holds the full path to the xref file, starting with the drive letter and working down through all folders and subfolders. This is the safest if things never change because AutoCAD will always find the exact file.
Next we come to the Relative path. The host drawing holds only the names of folders and subfolders below the folder in which the host drawing lives. If you move the entire collection of files and subfolders to a different drive or folder, everything is cool because AutoCAD begins in the host drawing's current folder when looking for the xrefs. This works only if all the xrefs live below the host drawing's folder.
The final option is to specify No path. The host drawing holds only the name of the xref file without any other reference to drive or folder. In this case, AutoCAD searches for the xrefs in the following sequence:
First it looks in the folder where the host drawing currently resides. Next, it searches down any paths specified under the PROJECTNAME system variable. If there is still no joy, then AutoCAD looks down the Support search paths defined on the Files tab in the Options dialog box. Finally — and here is a really obscure one — it looks in the folder specified in the Start In field of the properties of the desktop icon that was used to launch AutoCAD.
Okay, you say. I knew about numbers 1 and 3 and, as you said, number 4 is pretty obscure, but what about the PROJECTNAME system variable from number 2? It seems to be awfully important to be so close to the top of the list, but it was certainly never mentioned in most classes or articles about xrefs.
Exactly. Before we get into this, however, there is one other point to be aware of when xrefs are inserted with the No Path option. The problem is that AutoCAD uses the first file it finds with the matching name, which may not be the original file. Generic file names such as Border or Title Block can be a particular problem.
Another significant point to note is that all xrefs in a host drawing do not have to have the same path type, and, in fact, multiple xref attachments of the same file can have different Path Type settings. Combining this fact with the previous one produces the possibility that two attachments of the same xref might resolve to two different files. Fortunately there is a solution.
Give Me a Break
Let's work on a simple example, starting from a blank new drawing. First, launch the XAttach command (Insert | DWG Reference) to attach any random drawing that may be available. When you do so, make sure you set the Path Type drop list to None.
Now save and close your new host drawing, making sure that it is in a folder different from that for the xref file that you attached.
Open the host drawing again. Hey, what happened to the xref? If you look closely, all you will find is a single line of text starting from the insertion point of the xref. It consists of the word xref followed by the name of the xref file. Oops, there isn't a valid link to the original file.
The brute force method of repairing this problem is to start the ExternalReferences command (Insert | External References), right-click on the offending file, click on Attach, and then browse to it.
There are two problems with this, however. The first is that, unless you also change the Path Type, the fix doesn't stick and you will have the same problem the next time you open the host.
The second problem could actually be hundreds of problems, depending on how many host files you have, how many xrefs they have, and how deep they are nested.
Projects to the Rescue
Here comes the simple cure. Make sure you have the host file open, then start the Options command (Tools | Options). Click on the Files tab and then on the + sign beside the Project Files Search Path item. It will expand out to show a single Empty entry.
Click on the Empty entry, and then click on the Add button. Enter a suitable name for your new project.
Now click on the + sign beside the new project name. It will expand out to show a single Empty entry.
Click on this Empty entry, and then click on the Browse button. Browse to the folder containing the xref, and then click OK to return to the Options dialog box.
Click on the project name, and then click the Set Current button. Click OK to return to the Command: prompt.
The Lost Is Found
Save and close the host drawing, and then open it again. Bingo! The xref opens properly.
That's all there is to it!
Well, no, actually there is quite a bit more, but you have now mastered the basic principles. Let's look at the details.
You can add multiple file paths to a single project. In the Options dialog box, simply click on the project name and then click the Add button. Enter the path directly or browse to it.
You can create multiple projects, each with a different name and a different set of paths. Click on the Project Files Search Path item and then on the Add button.
The ProjectName system variable holds the name of the current project if one is set. This is saved with the drawing.
The specific paths associated with each project name are held in the system registry.
The two previous items combined mean that a project needs to be set up only once for it to be available to many drawings. All you need to do is use the Options command or the ProjectName command to activate the desired project for each drawing. Better yet, set up appropriate template files with the project name preset.
Now, here comes the real beauty of Projects. If things change, you can simply edit the search paths for the specific project and all drawings that use it will find the correct files. This makes it very simple to move things to different drives or folders.
The bad news is that there does not seem to be an easy way of exporting and importing the specific path settings, which are held in the Windows system registry. Unfortunately, each machine is going to have to be set up manually. Yes, it can be done using the Windows RegEdit function, but you really need to know what you are doing to go there.
Notwithstanding the previous paragraph, AutoCAD Projects can greatly simplify your management of AutoCAD projects.
And Now for Something Completely Different
The Captain hadn't really been entitled to the free Executive Suite upgrade, but he knew the peasant class section was overbooked so it was worth a shot to ask for it. Sure enough, he got upgraded, freeing up a cheap seat for someone on standby. Remember, they can't say "no" if you don't ask!
Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's Tips & Tricks Tuesdays free e-newsletter and we'll notify you every time a new video tip is available. All exclusively from Cadalyst!
On to Autodesk University in Dubai and Mumbai! 12 Dec, 2013
L&T Komatsu India: Tunnelling with PTC Creo 12 Dec, 2013
Revit 2014 Update Release 1 Now Available For Download - Crash Reductions or Enhancements? 19 Jul, 2013
How to Replace the Viewport Compass with your Company Logo 5 Jul, 2013
Maker Galaxy E03: Tom Wujec 12 Dec, 2013