Identifying layer on an XREF

Identifying layer on an XREF

Anonymous
Not applicable
27,043 Views
25 Replies
Message 1 of 26

Identifying layer on an XREF

Anonymous
Not applicable

How do I properly identify a layer on an xref. Please do not say "XLIST" which gives me a pop up window from 2003 standards that list the object and layer which are both misidentified, with the layer mislabeling the actual xref drawing and not the layer. It boils down to me opening the xref and going through it to track down the actual layer. And once I have identified the proper layer through manual means, it is not easily manipulated sometimes, meaning I can't change the color in my drawing, etc.

 

0 Likes
Accepted solutions (2)
27,044 Views
25 Replies
Replies (25)
Message 2 of 26

S.Faris
Advisor
Advisor
Accepted solution
  1. Type NCOPY(enter)
  2. Select the xref element or multiple elements you want to identify the layer of(enter)
  3. Pick a basepoint and move your cursor
  4. Pick a second point
  5. Now a copy of all the the elements from your xref is part of your main drawing and here you can select the elements and check the layer easily

SALMANUL FARIS

0 Likes
Message 3 of 26

Kent1Cooper
Consultant
Consultant
Accepted solution

Welcome to these Forums!

 

If you have some variety of full AutoCAD [not LT], put this in at the command line:

 

(cdr (assoc 8 (entget (car (nentsel "\nSelect object for its underlying Layer: ")))))

 

However, be aware that this will give the deepest-nested  Layer of whatever you pick on.  Say you have a toilet whose parts are drawn on Layer 0, defined as a Block and inserted on a plumbing-fixture Layer into a bathroom, and the bathroom is defined as a Block and inserted on a room-layout Layer in an apartment layout, and the apartment is defined as a Block and inserted on a building-plan Layer.  When you do the above and pick on some element of the toilet, it will report Layer 0 as the Layer of the object, not the plumbing-fixture Layer or the room Layer or the building-plan Layer.

Kent Cooper, AIA
Message 4 of 26

rkmcswain
Mentor
Mentor

 

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 5 of 26

Anonymous
Not applicable

S.Faris, Thanks. This allows me to identify the specific layer which is what I am looking for.

0 Likes
Message 6 of 26

Anonymous
Not applicable

  

0 Likes
Message 7 of 26

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

....

However, be aware that this will give the deepest-nested  Layer of whatever you pick on.  ....


 

You can get a listing of all the Layers of nesting  of a nested object, if you need it, with this:

(defun C:RNL (/ ent nestlist); = Report Nested Layers
  (if (setq ent (nentsel (strcat "\nSelect object: ")))
    (progn ; then
      (setq nestlist (last ent))
      (cons
        (cdr (assoc 8 (entget (car ent)))); Layer of object itself
        (if (> (length ent) 2); nested object -- Layer(s) of what it's nested in
          (mapcar '(lambda (x) (cdr (assoc 8 (entget x)))) nestlist)
        ); if
      ); cons
    ); progn
  ); if
); defun

It returns a list of Layer names, starting with the Layer the object you picked on was drawn on at its deepest level [and that's all if it's not  a nested object], followed by [if  it's nested] the Layer of whatever Block or Xref it's a part of, and the Layer of whatever that is nested in if applicable, all the way up to the Layer where the top-level object is Inserted/Xref'd in the current drawing.  For example, I have a line drawn on a Layer called A-ELEV-HIDN [for HIDdeN-line things in interior ELEVation views], which is part of a Block that is Inserted on a Layer called A-ELEV-MEDM [for MEDiuM-weight linework for the majority of elements in the Block], in a drawing called IntElv32 [Interior Elevations for 3/8"=1'-0" scale], and that drawing is Xref'd into the current drawing on Layer 0.  When I run the RNL command and pick on that hidden Line, it returns:

 

("IntElv32|A-ELEV-HIDN" "IntElv32|A-ELEV-MDLT" "0")

 

which is the Layer the Line itself was drawn on, then the Layer the Block that it's a part of is Inserted on, then the Layer that the IntElv32 drawing is Xref'd into the current drawing on.

Kent Cooper, AIA
Message 8 of 26

RobDraw
Mentor
Mentor

@Anonymous wrote:

Please do not say "XLIST"

 


 

XLIST works as expected for me. Maybe something is broken with yours.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
Message 9 of 26

rkmcswain
Mentor
Mentor
@RobDraw  wrote:

XLIST works as expected for me. Maybe something is broken with yours.

XLIST works fine on top level nested entities, but in the case of a block [1] inside of a block [2] inside of a block [3] in an xref, it will simply tell you the layer and name of the block [3] in the xref.

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 10 of 26

RobDraw
Mentor
Mentor

I'm not seeing any mention of multilevel nesting in the OP, although I do understand how that would make XLIST not work in this case.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
Message 11 of 26

RDunkley
Advocate
Advocate

Hi @Kent1Cooper, I have been using this code for a while and it works great..!

I thought I would have a play and add an Alert Box but it turns out even that is beyond me..! 

The use of the lambda is what I think has thrown me, I am assuming it has something to do with no actual variable being created but it could be something else too... I have a lot to learn!

If you have any ideas or suggestions that would be greatly appreciated!

Regards.

Currently using Civil 3D 2024 & AutoCAD 2025
0 Likes
Message 12 of 26

RDunkley
Advocate
Advocate

Does anyone else have any suggestions?

Regards.

Currently using Civil 3D 2024 & AutoCAD 2025
0 Likes
Message 13 of 26

Amy_SchneiderJDMJT
Explorer
Explorer

Thank you for the command to identify a layer in an attached xref. Is there a way to turn this into a command by entering this into lisp. I'm new to programming, so be gentle...lol.  Thanks in advance.

0 Likes
Message 14 of 26

cadffm
Consultant
Consultant

Look at Nentsel [F11]

Sebastian

0 Likes
Message 15 of 26

Amy_SchneiderJDMJT
Explorer
Explorer

Is this the command I'm supposed to use?  I'm not following the purpose of the link to the nentsel command. Thanks for the reply!

0 Likes
Message 16 of 26

RDunkley
Advocate
Advocate

Hi @Amy_SchneiderJDMJT the code that @Kent1Cooper posted is ready to be used as a lisp. You can simply copy and paste the code ‘as is’ into a blank text file then change the file extension from .txt to .lsp The lisp can then be loaded into your current AutoCAD session using the ‘APPLOAD’ command or set it up to auto load for every session.

 

 https://help.autodesk.com/view/ACD/2020/ENU/?guid=GUID-FDB4038D-1620-4A56-8824-D37729D42520). 

 

Once the lisp is loaded into your AutoCAD session, typing ‘RNL’ at the command line will invoke the command.

Regards.

Currently using Civil 3D 2024 & AutoCAD 2025
0 Likes
Message 17 of 26

Kent1Cooper
Consultant
Consultant

@Amy_SchneiderJDMJT wrote:

.... Is there a way to turn this into a command by entering this into lisp. ....


Maybe you're talking about the code in Message 3, which is the one marked as an accepted solution.  The one that's already turned into a command definition is in Message 7.

Kent Cooper, AIA
0 Likes
Message 18 of 26

Amy_SchneiderJDMJT
Explorer
Explorer

When I create a lisp file from the code that @Kent1Cooper created, I get this error message.

 

Command: DCLRNLISTCLICKED
; error: too few arguments

 

Any ideas what is wrong?

0 Likes
Message 19 of 26

Kent1Cooper
Consultant
Consultant

@Amy_SchneiderJDMJT wrote:

.... DCLRNLISTCLICKED ; error: too few arguments ....


Since there is nothing like that in my code, it must be coming from somewhere else.  Did you just change the command name, and might you have accidentally tweaked something else about it?  It works for me [code pasted into a drawing, not via a saved .lsp file].  Post the .lsp file you made.  Or, attached is the.lsp file version of it that I made at the time -- see whether that works for you.

Kent Cooper, AIA
0 Likes
Message 20 of 26

Amy_SchneiderJDMJT
Explorer
Explorer

Thank you @Kent1Cooper ! Your lsp file you just posted contains the last line that the original post is missing

 

(prompt "\nType RNL to Report Nested Layer(s).")

 

When I use your lsp file, the RNL command works. I appreciate the help!

0 Likes