default layer for xrefs

default layer for xrefs

M_c3d
Advisor Advisor
3,803 Views
19 Replies
Message 1 of 20

default layer for xrefs

M_c3d
Advisor
Advisor

I'm trying to set the default layer for all x-refs being attached, but it doesnt seem to work, is this possible to do or is the code missing something?

 

^C^C-layer;set;xref;;_xattach

 

It completley ignores the layer selection, or is there a better way of achieving this?

 

0 Likes
Accepted solutions (2)
3,804 Views
19 Replies
Replies (19)
Message 2 of 20

imadHabash
Mentor
Mentor

Hi,

 

you may find some thing here. >> Click <<

 

Regards,

Imad Habash

EESignature

0 Likes
Message 3 of 20

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

....for AutoCAD 2018 there is no macro needed!

The system variable XREFLAYER let's you define a layer that is automatically used when you insert a XRef (>>>details<<<)

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 4 of 20

rkmcswain
Mentor
Mentor
mmcgovern wrote:

.... or is there a better way of achieving this?

Go grab this utility 

Message 5 of 20

M_c3d
Advisor
Advisor

Brilliant thanks, don't suppose there is also one for viewports?

0 Likes
Message 6 of 20

rkmcswain
Mentor
Mentor
Accepted solution
Yes, if you use the LayerDirector utility I posted the link to, you can control ANY command.
Message 7 of 20

violetflames
Observer
Observer

Hi

how can I customize xref layer name in "LayerDirectorV1-8"?

thanks your helping.

0 Likes
Message 8 of 20

mlfgale
Enthusiast
Enthusiast

This seems to be getting ignored in 2025. I have it set to current, which is 0. the xrefs come in on some new made up layer. Changing the variable does nothing.

0 Likes
Message 9 of 20

pendean
Community Legend
Community Legend

@mlfgale wrote:

This seems to be getting ignored in 2025...


Or could it be just this limitation

pendean_0-1717425603279.png

 

pendean_1-1717425664166.png

 

pendean_2-1717425690940.png

 

pendean_3-1717425718980.png

 

 

Message 10 of 20

mlfgale
Enthusiast
Enthusiast

we are coming from 2016, so that could be why.

 

however, the value is set to . which is "current layer". Current layer is 0. But it's creating it's own oddly named layer when xref'd in. The layer it's creating doesn't even exist in either file. This is definitely a bug.

 

(edit: spelling)

0 Likes
Message 11 of 20

cadffm
Consultant
Consultant

Hi,

 

>>"This is definitely a bug"

Let's see.

 

Change Xreflayer to "123" and test it. Does it work?

Change Xreflayer back(?) to "." and test it. Does it work now?

Sebastian

0 Likes
Message 12 of 20

mlfgale
Enthusiast
Enthusiast

Tried that. Still creates the odd name in both situations.

0 Likes
Message 13 of 20

cadffm
Consultant
Consultant

What  is the ' the odd name ' ?

Please share a Screenshot of the whole program window, or ABOUT dialog.

 

Start the Program in SAFEMODE and try it again with DWG Xref

 
 

 

 

Sebastian

Message 14 of 20

pendean
Community Legend
Community Legend

@mlfgale wrote:

we are coming from 2016, so that could be why....

...Tried that. Still creates the odd name in both situations.


Not sure that was an option in 2016, but if it is, I can't image it was that different. Perhaps you used a 3rd party LISP?

Also... what is that xref layer name that keeps appearing in 2025 please?

and is this an issue with one XREF, of ALL xrefs?

 

We all have AutoCAD2025 so you'll need to show us how to repeat the issue exactly as in my own files at least there is nothing odd going on.

Message 15 of 20

TomBeauford
Advisor
Advisor

To customize xref layer name in "LayerDirectorV1-8" find the lines: 

;;-----------------------------------------------------------------------------------------------------------------------------------------------------;;
;;  Command Pattern  |  Layer Name    |       Description       |    Colour    |   Linetype   |    Lineweight    |       Plot       |    Plot Style    ;;
;;-----------------------------------------------------------------------------------------------------------------------------------------------------;;
;;     [string]      |   [string]     |         [string]        | 0 < int <256 |   [string]   | -3 = Default     |  1 = Will Plot   |     [string]     ;;
;;                   |                |     Use "" for none     |              |              |  0 <= int <= 211 |  0 = Won't Plot  |  Use nil for CTB ;;
;;-----------------------------------------------------------------------------------------------------------------------------------------------------;;
 
("[DM]TEXT,TEXT"       "TEXT"           "Text Layer"                   2        "Continuous"           -3                 1                 nil         )
("DIM*,*LEADER"        "DIMENSIONS"     "Dimension Layer"              3        "Continuous"           -3                 1                 nil         )
("*VPORT*"             "DEFPOINTS"      ""                             7        "Continuous"           -3                 0                 nil         )
("XLINE"               "XLINE"          "Construction Lines"          12        "HIDDEN"                0                 0                 nil         )

and add line:

("XREF"                "XREF"           "Xref Layer"                   2        "Continuous"           -3                 1                 nil         )

below it then save and reload "LayerDirectorV1-8".

All the settings Lee includes are suggestions you can modify or add to and if you use an STB you need to replace the nil values for Plot Style to what you want them to be.

64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
0 Likes
Message 16 of 20

mlfgale
Enthusiast
Enthusiast

Thank you for this! I forgot i do have a layer redirector lisp running. (not sure why it wasn't doing this in the older Acad). I had totally forgotten about it!

 

Thanks again!!

Message 17 of 20

mlfgale
Enthusiast
Enthusiast

Thanks! this is exactly what I forgot that I had running. For some reason tho, it has only done it in 2025.

Message 18 of 20

cadffm
Consultant
Consultant

definitely

Sebastian

Message 19 of 20

mlfgale
Enthusiast
Enthusiast

yeah yeah i know. I've had the script along time tho. I know it's loaded because the other commands in it work. 2025 is the only version so far where this part of the script actually started working. Who knows.. lol

0 Likes
Message 20 of 20

cadffm
Consultant
Consultant

The important thing is that your problem is solved.
I knew that AutoCAD doesn't create layers on its own, unless you set it up that way.

It was just a matter of determining exactly where on your side the program had been adjusted, or what a toolset you are using (not AutoCAD, but maybe an other variant/Toolset have another feature for this)

 

Rock on  👍

 
 

 

 

Sebastian

0 Likes