LT On-line: Lesson 111 Feb, 2001 By: Mark Middlebrook
layers, loading, and logs
by Mark Middlebrook
1: Xref layer visibility
My previous two LT Online lessons covered xrefs and how to attach and manage them with the Xref Manager dialog box. This lesson rounds out xref coverage with a trio of topics: how to control xref layer settings with the VISRETAIN system variable, when to use demand loading, and how to troubleshoot xref problems with text window messages and the log file.
The procedures described
here work with AutoCAD LT 98 and 2000 and AutoCAD Release 14 and 2000.
As described in the "Layer-palooza"
section of lesson 9, when you attach one file to another as an xref, AutoCAD
adds new layers to the parent drawing that correspond to the layers in
the xrefed DWG. The xrefed layers have the form Xrefname|Layername, as
shown in figure 1. You might wonder what happens
when you make changes (on/off thaw/freeze, color, linetype, etc.) to these
xref layers or to the corresponding layers in the xref itself.
If you change the settings of an xref layer in the parent drawing, do the changes persist after you close and reopen the parent drawing?
change the settings of a layer in the child drawing, do the changes appear
the next time you open the parent drawing?
The answer to both of these questions depends on the setting of the VISRETAIN system variable in the parent drawing. VISRETAIN is short for visibility retain, and this system variable determines whether layer settings in the parent drawing or the child drawing control the appearance of xref layers in the parent.
The default VISRETAIN setting is 1 (= on), which means that the parent drawing's settings for xref layers control over the settings for the corresponding layers in the xref drawing itself. For example, assume that you have attached
(the child drawing into
(the parent drawing). If you turn off the xref layer Myscrew|Text in the
that layer will still be off the next time that you open
Furthermore, if you later open
and change its Text layer from red to green, the Myscrew|Text layer ignores
this change. The Myscrew|Text will still be red when you open
If you change VISRETAIN to 0 (= off) in a parent drawing, you tell AutoCAD
that the child drawing's layer settings control over the parent drawing's
settings for the corresponding layers. Each time you open the parent drawing,
AutoCAD applies the current layer settings from the child drawing. For
example, if you turn off the xref layer Myscrew|Text in the parent drawing
it goes off for the current session. The next time that you open
though, the Myscrew|Text layer is back on, because that's its current
Furthermore, if you later open
MYSCREW.DWG and change its
Text layer from red to green, the Myscrew|Text layer reflects this change
when you open
(i.e., the layer Myscrew|Text layer is green).
Note that all of this
VISRETAIN discussion applies only to how the layers appear in the parent
drawing. No matter what you set VISRETAIN to in any drawing, the child
drawing's layers don't change when you change xref layer settings in a
parent drawing. In other words, changes to the Myscrew|Text layer in
don't affect the Text layer in
regardless of what VISRETAIN is set to.
There are ferocious arguments about whether to turn VISRETAIN on or off. I prefer when possible to turn off VISRETAIN and thereby control the visibility and properties of xrefed layers from the child drawings. But 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).
The most important thing is that you choose one method and stick with it. If you aren't consistent, you can't predict whether changing a layer in a parent or child drawing will persist.
In order to change the VISRETAIN setting in AutoCAD or LT 2000, open the Options dialog box (Tools|Options), and choose the Open and Save tab, as shown in the figure below. Click the Retain Changes to Xref Layers check box to turn VISRETAIN off or on. In LT 98 or AutoCAD Release 14, you must type the system variable name at the Command line. Type VISRETAIN,
press ENTER, type 0 (off) or 1 (on), and press Enter again. Whether you
change the system variable from the Command line or the Options dialog
box, you're changing it only in the current drawing file. The setting
is stored in the DWG file, so that different drawings can have different
VISRETAIN settings shown in figure 2.
If all of these abstract file and layer names have your head spinning, the best thing to do is to test both settings:
1. Create a sample parent and child drawings (e.g.,
Draw some objects on different layers in
and xref attach
3. Set VISRETAIN to 0.
4. Use the Layer Properties Manager dialog box to change settings for some of the xref layers in
5. Save and reopen
Note that the layer changes have disappeared.
6. Open Child drawing, make some changes to the layer settings, and save the drawing.
Note that the layer changes from
8. Repeat steps 3 through 7, but set VISRETAIN to 1 instead. Note that in step 5 the layer changes now persist and in step 7 the layer changes from
do not appear in
A tutorial on my Web site demonstrates these concepts.
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor and Autodesk Technical Evangelist Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD video tips. Subscribe to the free Cadalyst Video Picks newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!