Nested XREFs and layer states

If you use a system of drawing sheet and drawing model in your practice where both are seperate files and the sheets are like a piece of paper with the drawing information pulled into it then this is something you might have come across already, if not then this might help you in the future if you encounter it.

So generally you will attach one or two external drawings to a sheet file and then adjust layers to suit in the sheet file. However occaisonally you will set up a drawing with an XREF, usually an overlay type of drawing (not to be confused with overlay type of XREF) where you have a base drawing and the layers are adjusted to be simplistic and then further information is drawn over the top, e.g. a fire drawing or drainage drawing.


This is where it gets complicated. There is now a chain of drawings. Drawing A (the base drawing) –> Drawing B (the overlay type of drawing) –> Drawing C (the plot drawing). [Note: the arrows indicate XREF attachements]. This chain of XREFs is called nesting.

The problem comes when you want Drawing C to look the same as drawing B does. When you attach Drawing B to C all the layers on drawing A change to when they were first attached to drawing B, all the changes in drawing B seem to be lost. But when you go back to drawing B it still looks as it should. Confused?

The problem is AutoCAD pulls in XREFs (external references) from their source files and not through the nesting. So any information for drawing A setup in drawing B will not be imported into C as drawing C as the information is directly pulled from drawing A.


In order to circumvent this annoying behaviour layer states export and load should be used. Or you just reset them up if its only a few changes, but if lots of colour changes and layer adjustments have been made then this is the method for you.

This is taken from this page: (Copyright AutoDesk).

To export layer settings

  1. At the command prompt, enter LAYER.
  2. In the Layer Properties Manager, click Layer States Manager.
  3. In the Layer States Manager, create a new layer state or select an existing one. Click Export.
  4. In the Export Layer State dialog box, enter a file name and specify a location for the file.
  5. Click Save.
  6. Click OK to close each dialog box.

To restore layer settings

  1. At the command prompt, enter Layer on the command line.
  2. In the Layer Properties Manager, click Layer States Manager.
  3. In the Layer States Manager, select a named layer state.
  4. Select the settings that you want to restore.
  5. Click Restore.
  6. Click OK

Now you should have the correct layer information in drawing C!

Hatching and XREFs

It appears that there is a fundamental flaw in AutoCAD where if you clip an XREF the information AutoCAD requires in order to HATCH objects in the XREF is lost, therefore AutoCAD cannot HATCH an clipped XREF. How dumb is that.

Retaining XREF Layouts

One of my colleagues was getting very frustrated with the XREF he was using, he had set up an XREF, turn off the layers as he wanted, then saved and exited the drawing. Upon reopening the drawing he found these changes were reset to the layers on the XREF source.

AutoCAD appears to be setup strangely on my colleagues machine where it prefers to inherit layering from the source. Whilst this is a logical method it doesn’t help new users to understand how to “lock” their XREFs. By default AutoCAD should be in the “locked” mode.

Frustratingly AutoCAD also appears to have no visual way to set VISRETAIN, a toggle for XREF state in the XREF manager would be nice, perhaps a check box with a note next to it saying “Check to retain layer information in current drawing”. That way people will know what is going on!

So its back to the command line, type VISRETAIN and then set to 1 for keeping the layers in the current drawing as you want them or 0 to inherit from source.


From AutoCAD help: (Copyright Autodesk).

The layer table, as stored in the reference drawing (xref), takes precedence. Changes made to xref-dependent layers in the current drawing are valid in the current session only and are not saved with the drawing. When the current drawing is reopened, the layer table is reloaded from the reference drawing, and the current drawing reflects all of those layer property settings.
Xref-dependent layer changes made in the current drawing take precedence. Layer settings are saved with the current drawing’s layer table and persist from session to session.