@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