[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Control Xref Layer Colors
Tip# 4523 By Matt Sibum On 17-Aug-2015
Rated By 1 users Downloaded : 459
Categories : Standardize Data
Software type : AutoCAD 2016
Rename File To : Xreflayers.lsp
Change the colors of xref layers with the AutoLISP routine.

Changing the color of xref dependent entities is a popular topic here in the Cadalyst CAD Tips. Tips 4330, 3995, 3828, 3770, and 2278 all have something to do with modifying xref layer colors. Matt’s routine is similar, but it’s different enough to warrant a new entry. When you run this routine, a list of each xref is generated along three options for the colors of the xref layers: Default (keep things as is), Reset (reset colors back to those in the source drawing), or Change (change all layers to a single color). If you are in a floating viewport, you also have the option of making these color changes to just that viewport.

After you load the LISP file, run the command XRL. A dialog box will open, listing each xref. If you do nothing and press OK, no changes will occur since all of the radio buttons are set to Default. Find the one or more xrefs you want to change, and choose either Reset or Change and press OK. Of course, entities in xrefs whose color is hardcoded cannot be changed by modifying the xref layer color. Also note that the dialog box for this command is generated dynamically so depending on the size of your display, if you have more than about 30 xrefs, the dialog box may not fit. Lastly, AutoCAD 2016 and later includes a system variable named XrefOverride that can be used to force layer colors on xref entities, even if they have been hardcoded in the source drawing.


Average Rating:

User comments
Comment by Partenheimer,Michael
Posted on 2015-08-17 15:22:16
Since VISRETAIN is an all or nothing setting, this routine works around that limiting issue. It's like a VISRETAIN reset (for colors) per Xref. Well done.