Xrefs for Building Drafting
Version 15.10
by Mark Middlebrook
External references, or "xrefs", constitute one of the keys to efficient drafting, especially of building plans. Xrefs help you minimize duplication of geometry, thereby making editing more efficient and helping to keep drawings in synch. Xrefs also can help keep file sizes down when you use the same large components (e.g., elaborate title blocks) in multiple drawings.
This paper describes xref concepts, commands, applications, and tips.
I originally wrote this paper for AutoCAD R12’s implementation of xrefs, and have updated it to include some information about the xref enhancements in R13, R14, and 2000.
AutoCAD R13 added:
- Overlay
as an alternative way of incorporating xrefs (in addition to the old attach method).
- A new "Bind as insert" method of binding xrefs (in addition to the old "bind as bind").
AutoCAD R14 added:
- Xref clipping, so that you now can control which parts of an xref display in the parent drawing.
- Xref project files search path, in an attempt to address the "xref in a different directory from the drawing that refers to it" problem.
- An xref demand loading feature for speeding up xref access in situations where only a small part of a large xref is needed.
AutoCAD 2000 added:
These changes are described at the end of this paper.
Concepts
An xref is superficially similar to a block that you create by inserting another DWG file into the current drawing. The most important difference is that AutoCAD maintains a live link to the externally referenced drawing.
- Attaching an xref =~ inserting a block
The term for creating a live link to an external drawing is attaching an xref. (AutoCAD R13 added overlaying as an alternative to attaching an xref. I’ll describe the at the end of this document.)
- "Parent" and "children" drawings
When we talk about xrefs, it’s convenient to refer to the drawing that references another drawing as the "parent" drawing and the drawing being referenced as the "child" drawing. In other words, the drawing in which you attach is the parent, and the drawing that gets attached is the child.
- Named objects (a.k.a. dependent symbols)
AutoCAD keeps track of several kinds of organizational objects in addition to the ordinary geometrical entities that you draw. The objects that are important for our present purposes are layers, blocks, text styles, dimension styles, and linetypes. AutoCAD refers to these as "named objects" (or, in certain contexts, "dependent symbols"). As you’ll see, AutoCAD handles named objects symbols differently when you attach an xref versus when you insert a block.
Because AutoCAD maintains a live link to xrefs, it needs to find them on the disk. As a result, you can encounter problems if you don’t organize your DWG files properly.
Occasionally it turns out to be useful to incorporate an xref permanently in the parent drawing, thus cutting the live link to the external DWG file. AutoCAD calls this procedure "binding" the xref.
- Differences between blocks and xrefs
These are the major differences between xrefs and blocks:
| |
Blocks |
Xrefs |
|
Child’s geometry: |
Copied into parent DWG and stored there. |
Not copied into parent DWG; loaded temporarily each time you load parent DWG. |
|
Updating parent when child changes: |
Must redefine block (with INSERT blkname= or BLOCK). |
Happens automatically. |
|
Named objects: |
Parent definitions override child definitions. |
Parent and child definitions are maintained separately. |
|
Named object names: |
Normal. |
Prefixed with xrefname|. |
|
Attribute definitions: |
Supported. |
Ignored. |
Commands
The primary command for manipulating xrefs is XREF. You can launch it in any of the following ways:
External Reference dialog box:
Type: XREF or XR
Pull-down menu: Insert, Xref Manager
Draw toolbar: External Reference (in the Insert Block fly-out toolbar)
Command line version:
Type –XREF
The External Reference dialog box includes these options:
|
Xref dialog box option |
Purpose |
Notes |
|
Attach |
Create an external reference attachment or overlay. |
Analogous to INSERT for blocks.
You can go directly to this option with the XATTACH command (XA or Insert, External Reference) |
|
Detach |
Delete all instances of a previously attached xref. |
Analogous to ERASE and then PURGE for blocks. |
|
Reload |
Refresh xref definitions from external DWG files. |
Useful on networks when someone else is editing your children as you work on the parent. |
|
Unload |
Remove an xref from the screen (and from memory), but leave the attachment for later Reloading. |
|
|
Bind |
Convert an xref into a block. |
Useful for archiving or sending a drawing to a recipient who’s not xref-savvy.
Options to bind as block or as xref. |
|
Xref Found At |
Display (and optionally change) the path where AutoCAD looks for an xref. |
Useful for re-specifying or removing xref paths. |
|
List View / Tree View |
Change between showing a list of xrefs with all details and showing a hierarchical tree ox ref names. |
Use Tree View to inspect the hierarchical relationship of a complicated set of xrefs. |
The –XREF command line version includes a similar set of options.
|
-XREF command line options |
Purpose |
Notes |
|
? |
List currently attached xrefs. |
|
|
Bind |
Convert an xref into a block. |
Doesn’t include the "bind as block" option, so you’ll always end up with lots of weird named object names. |
|
Detach |
Delete all instances of a previously attached xref. |
|
|
Path |
Change the path where AutoCAD looks for an xref (or strip the path entirely). |
Useful for stripping hard-coded xref paths. |
|
Unload |
Remove an xref from the screen (and from memory), but leave the attachment for later Reloading. |
|
|
Reload |
Refresh xref definitions from external DWG files. |
|
|
Overlay |
Create an external reference overlay. |
|
|
Attach |
Create an external reference attachment. |
|
AutoCAD includes these additional xref-related commands:
|
Command |
Purpose |
Notes |
|
REFEDIT |
Edit an xref (or block insert) in place. |
New in AutoCAD 2000. |
|
VISRETAIN
(a system variable, actually) |
Control whether parent’s or child’s settings of child’s layers govern at load time. |
0 = child’s layer settings control.
1 = parent’s layer settings control. |
|
XATTACH (XA) |
Create an external reference attachment. |
Same as clicking Attach in the Xref Manager dialog box. |
|
XBIND (XB) |
Permanently add a named object from an xref to the current drawing. |
Seldom used. |
|
XCLIP (XC) |
Clip an xref using a rectangle or polygon. |
Handy for building plans that require multiple sheets and match lines. |
When to use xrefs
There are many applications for xrefs, including:
- Title blocks
- Reference elements that need to appear in multiple drawings (e.g., wall outlines, site topography, column grids).
- Assemblies that are repeated in one or more drawings, especially if the assemblies are likely to change together (e.g., repeated framing assemblies, bathroom layout, modular furniture layout).
- Pasting up several drawings (e.g., details or a couple of plans) onto one plot sheet.
- Temporarily attaching a background drawing for reference or "tracing" purposes.
On the other hand, blocks remain useful in simpler circumstances. Remember that every xref requires keeping track of a separate file. Some situations in which you might stick with a block are:
- Components that aren’t likely to change.
- Small components.
- A simple assembly that’s used repeatedly, but in only one drawing. (You can easily update a block in one drawing by inserting it in a blank area, exploding and editing it, and then redefining it with the BLOCK command.)
Also, it’s important that everyone in the office be reasonably consistent about when to use and when not to use xrefs.
Xref guidelines
Following are some guidelines for working with xrefs.
- Document xref dependencies for each project. Maintain control of the xref structure. If you can’t keep it in your head, it’s too complicated.
- Attach each xref on an appropriate layer. For example: attach a grid on the S-GRID layer. If you can’t think of an appropriate layer, make one called XREF.
- Be aware of potential problems with xrefs in different directories from the parent drawings. The simplest way to avoid problems is to make sure that parent and child drawings always reside in the same directory.
- Do not bind xrefs in working drawings. The only time you should bind xrefs is when creating a set of drawings for archiving or for sending out to a recipient that requests no xrefs. Always do the binding on a copy of the working drawing (i.e., open the drawing, SAVEAS newname, then bind).
- Set VISRETAIN consistently in your drawings. I prefer when possible to set VISRETAIN to 0 and thereby control the visibility and properties of xrefed layers from the child drawings. You may want to or need to set VISRETAIN to 1 and control xref layer visibility and properties from the parent drawings (in order to be able to assign different properties to the same layer in different parent drawings, for example).
- Before sending out or archiving a set of drawings (assuming that xrefs aren’t bound), always verify that the drawing set includes all xrefs. Use your project documentation as a checklist and/or the Pack ’n Go Express tool.
Tips and tricks
Following are some tips that will make working with xrefs easier and more efficient.
- AutoCAD looks for xrefs first in the saved path, then in the directories that make up the library search path (AutoCAD startup directory, current DWG’s directory, support file search path directories, AutoCAD driver directory, Acad.exe directory).
- To remove a hard-coded path, run the XREF command, select the xref, delete the path (i.e., everything except for filename.dwg) in the Xref Found At field, and press ENTER.
- If AutoCAD can’t find an xref (usually because the DWG file got renamed or moved), AutoCAD displays a warning and writes some text at the xref’s insertion point. To fix the problem, restore the xrefed file and run XREF Reload, or modify or remove the xref’s Saved Path.
- With xrefs, assembling a set of drawings for archiving or sending out becomes trickier. You need to make sure that you include all children of all parent DWGs; otherwise the recipient will end up looking at a partial drawing (and will regard you as inept). To avoid this embarrassment, be organized. Make a map that shows xref dependencies for the . You can use the Pack ‘n Go Express Tools command to help you bundle up a set of drawings with all of the necessary xrefs and fonts.
- When you bind an xref, AutoCAD converts the vertical bar between the xref name and symbol name to $n$, where n is a number (usually 0). The result is a lot of peculiar names for layers, blocks, and other named objects. As a result, you should avoid binding unless you’re archiving drawings or sending out a set to someone who doesn’t want to deal with xrefs and doesn’t mind the weird names.
- To avoid the peculiar named object names, set Bind Type to Insert when you bind. Alternatively, detach the xref and then insert it as a block (or as individual geometry with INSERT *dwgname).
- AutoCAD R14 and previous versions limit the names of layers to 31 characters. AutoCAD won't let you attach an xref if any of the resulting layer names (xrefname|layername) would be longer than 31 characters. Similarly, AutoCAD won't let you bind an xref (in bind "As Bind" mode) if the resulting layer name (xrefname$n$layername) would be longer than 31 characters. The same limitation applies to other named objects. If you encounter this problem, you'll need to use the RENAME command to rename the offending named object(s) in the child drawings to something shorter.
Command line tips and tricks
If you choose to use the old command line version of the XREF command (type –XREF in AutoCAD 2000 or R14), here are some additional tips.
- All of the -XREF subcommands accept wildcards, the most useful of which is * (for "all xrefs").
- Use -XREF ? to get a list of xrefs that you can copy to a text or word processing document.
Xref features added in AutoCAD R13, R14, and 2000
The following xref features were new in AutoCAD R13, R14 or 2000.
- Overlay vs. attach (R13):
The difference between overlaying and attaching an xref appears only when you have multiple levels of xrefs (e.g., A.dwg references B.dwg, which references C.dwg). If you attach C.dwg in B.dwg, and then attach B.dwg in A.dwg, you see C.dwg’s geometry in both B.dwg and A.dwg. If instead you overlay C.dwg in B.dwg, you see C.dwg’s geometry in B.dwg, but not in A.dwg. In other words, an overlaid xref displays only one level up in the hierarchy. Above that one level, it disappears.
- "Bind as insert vs. "bind as bind" (R13):
When you bind as bind, AutoCAD creates a slew of unwieldy names containing $0$ for xref layers and other named objects. When you bind as insert, AutoCAD merges the xref’s named objects with those of the current drawing, thus eliminating the unwieldy names. There is one potential danger with bind as insert, though: If an xref has a layer or other named object that uses the same name as one in the parent drawing, but is defined differently (e.g., S-GRID is red in the parent but gray in the xref), then the properties of the xref objects will change when you bind as insert.
- Xref clipping (R14):
Xref clipping allows you to define a clipping boundary that limits which part of the xref displays. For example, you can draw a full plan in one DWG file, xref it into multiple "plot sheet" DWG files, and in each plot sheet clip the xref so that only the desired area displays. This method is similar to the older paper space approach, but it isn’t limited to paper space or rectangular viewports. There’s nothing wrong with using paper space, but the xref clipping procedure is more intuitive than creating paper space viewports and zooming the model inside of them. With xref clipping, you can create everything on your plot sheet – clipped plan, title block, and additional notes – in model space if you want to. Also, you can clip xrefs to irregular polygonal areas, which avoids the rectangular limitation of paper space viewports. See my document "Xref Clipping of Building Plans" for more information. (Warning: AutoCAD LT does not include the XCLIP command. AutoCAD LT will display and plot drawings with clipped xrefs properly, but LT cannot you cannot create or manipulate clipping boundaries with LT.)
- Project xref files search path (R14):
You can define various project names in the Preferences dialog box, specify xref search directories for each project, and then specify the project with which a particular drawing is associated (and thus in which additional directories AutoCAD should look for xrefs when opening that file). The project files search path feature can help on one computer, but it doesn’t really address the drawing exchange problem that xrefs in different directories cause. For that reason, I don’t think it’s a very helpful feature for most people. I continue to recommend keeping parent and child drawings in the same folder.
- Demand loading (R14):
When you open a drawing containing an xref, AutoCAD normally must load the entire xrefed DWF file from the disk into memory. Demand loading allows AutoCAD to load only those portions of the xref that are displayed in the parent drawing. If you use xref clipping to show a small portion of a large xref, or you freeze layers containing a large amount of xrefed geometry, then demand loading might help improve performance. Taking advantage of demand loading requires that you set the INDEXCTL system variable to a non-zero value in the xrefed DWGs so that AutoCAD creates the necessary indices. You also must set XLOADCTL to a non-zero value so that AutoCAD knows to use demand loading. Warning: The default XLOADCTL setting of 1 is not good in a networked office where one AutoCAD user may need to open a drawing that’s attached as an xref in a parent drawing that another user has open. Change XLOADCTL either to 0 (turn off demand loading) or to 2 (make a local temporary copy of any xrefs).
- In-place xref editing (2000):
With the new REFEDIT command, you can edit an xref (or block insert) "in place" – that is, you don’t have to open the child drawing.
Return to the markcad.com series of AutoCAD tutorials on xrefs.
Last updated 14-Sep-2000 by
mark@markcad.com