Autodesk Community Tips - AutoCAD Products
Autodesk Community Tips are bite-sized fixes, shortcuts, advice, and how-to tips shared by Community members.

Did You Know...About XLIST and -XLIST?

Contributed by:

Tips & Tricks Banner V1.0 XLIST.png

XLIST is an Express Tool used to view information about a selected object in an Xref similar to the LIST command.

 

Here is an example using the XLIST command on a block named Building-2 in an xref named civil_example-imperial.dwg. Notice that the Xref drawing name precedes the Block Name and Layer in the resulting dialog.

 

C3D_TomR_1-1673421259007.png

 

Sometimes the drawing name + layer name combination is longer than can be displayed in the resulting dialog, as shown here:

 

C3D_TomR_4-1673421758620.png

 

Adding a hyphen in front of the XLIST command will redirect the output to the command line. This resolves the issue of the long reference name + layer name combination. Here is the result of the same block selection using -XLIST:

C3D_TomR_5-1673422046554.png

 

A benefit of redirecting the output to the command line is that the information can by highlighted and copied to the clipboard.

Comments

Thank you @C3D_TomR Great tip 

You're welcome, @handjonathan. I hope many users find this tip useful.

@C3D_TomR great example of using a modifier on a standard command!

 

It's frustrating trying to find the layer an object is on inside of an XREF without a tool like this. In our system, I load a number of small lisp routines at startup for all users. But lisp isn't available to LT users. One lisp addresses the query listing of an XREF layer while redefining the "LI" keyboard shortcut. It also outputs to the command line.

DanielLenchWPM_0-1673535769471.png

 

It's a really old lisp but one I use regularly. 

 

(defun c:li (/ LAY PIK STR )      ;lists xref layers
   (setq pik (nentsel "\nSelect an item on layer to List: "))
   (setq lay (assoc 8 (entget (car pik))))
   (setq str (cdr lay))
   (princ "\nYou just chose layer    ")
   (princ str)
   (princ)
)

 

 

Another fun one is the "FXL" command in the below code. It will freeze a stubborn layer inside an XREF or a layer inside a block inside an XREF.

Full code with credits:

 

;
;;   LAYER.LSP     (c) 1987 Mare Island Naval Shipyard
;   Authors: Hugh J. Williams Revisions by Zack Williams 1994
;   RELEASE 10 VERSION
;
;    Function      Description
;    ----------    -----------------------------
;    C:FXL         Freeze xref layers by selecting entities on the layers
;    C:Li          Lists xref layers by selecting entities on the layers
;    C:CXC         Display Color-bar, set xref layer-color of selected ent
;    C:CEC         Display Color-bar, change color of selected ent
;    C:FVL         Freeze viewport layers by selecting from paperspace     
;    C:CLL         Select one entity, change subsequent entities to that layer
;    C:COPYLAY     Select one entity, MAKE copy of subsequent ents on layer
;    C:DCC         Decolor entity to bylayer
(defun c:fxl (/ LAY PIK STR )      ;freezes xref layers
   (setq pik (nentsel "\nSelect an item on layer to Freeze: "))
   (setq lay (assoc 8 (entget (car pik))))
   (setq str (cdr lay))
   (command "layer" "F" str "" )
   (princ "\nYou just froze layer     ")
   (princ str)
   (princ)
)
(defun c:li (/ LAY PIK STR )      ;lists xref layers
   (setq pik (nentsel "\nSelect an item on layer to List: "))
   (setq lay (assoc 8 (entget (car pik))))
   (setq str (cdr lay))
   (princ "\nYou just chose layer    ")
   (princ str)
   (princ)
)
(defun c:cxc ( /  c u o p dens ydrop yinit i)     
    (setvar "cmdecho" 0)
    (setq c (getvar "viewctr")
          u (/ (getvar "viewsize") 10)
          o (list (+ (car c) (* u 5)) (+ (cadr c) (* u 4)))
          p o i 1 yinit (cadr o) ydrop (/ u 2)
    )
    (graphscr)
    (repeat 17
        (repeat 3
            (grdraw p (list (+ (car p) u) (cadr p)) i 0)
            (setq p (list (car p) (- (cadr p) (/ u 23))))
        )
        (setq o (list (car o) (- (cadr o) ydrop)) p o i (1+ i))
    )
    (setq e t)
    (command "layer")
    (while e
      (setq e (car (nentsel "\nSource Ent: ")))
      (if e (progn
        (setq lay (cdr (assoc 8 (entget e))))
        (setq clr (fix (/ (- yinit (cadr (getpoint "Select Color Bar: "))) 
         ydrop)))
        (command "color" (1+ clr) lay)
      ))
    )
    (command "")
  (princ)
)
(defun c:cEc ( /  c u o p dens ydrop yinit i)     
    (setvar "cmdecho" 0)
    (setq c (getvar "viewctr")
          u (/ (getvar "viewsize") 10)
          o (list (+ (car c) (* u 5)) (+ (cadr c) (* u 4)))
          p o i 1 yinit (cadr o) ydrop (/ u 2)
    )
    (graphscr)
    (repeat 17
        (repeat 3
            (grdraw p (list (+ (car p) u) (cadr p)) i 0)
            (setq p (list (car p) (- (cadr p) (/ u 23))))
        )
        (setq o (list (car o) (- (cadr o) ydrop)) p o i (1+ i))
    )
    (setq e t)
     (while e
      (setq e (car (entsel "\nEnt to change color: ")))
      (if e (progn
        (setq lay (cdr (assoc 8 (entget e))))
        (setq clr (fix (/ (- yinit (cadr (getpoint "Select Color Bar: "))) 
         ydrop)))
        (command "chprop" e "" "color" (1+ clr) "")
      ))
    )
    (command "redraw")
  (princ)
)
(defun c:fvl (/ rel ss ssl vplayname curlayer start tempexpt
  vp ent layernam laylist)
  (setq rel (getvar "acadver"))      ; check for rel. 11
  (setq rel (atoi (substr rel 1 2)))
  (if (>= rel 11)
     (progn
        (setq curlayer nil start 't)
        (setq tempexpt(getvar "expert"))
        (setvar "expert" 1)
        (if (= (getvar "tilemode") 1)(setvar "tilemode" 0))
        (command "pspace")
        (setq ss (ssget "x" '((0 . "viewport"))))
        (setq ss1 (entget (ssname ss 0)))
        (setq vplayname (cdr (assoc 8 ssl)))
        (command "layer" "thaw" vplayname "on" vplayname "")
        (command "move" ss "" "0,0" "0,0")
        (princ "\nPick Viewport(s) to Freeze Layers in: ")
        (command "select" pause)
        (setq vp (ssget "p"))
        (command "mview" "on" vp "" "mspace")
        (while
          (setq ent(entsel
   "\nPick object on layer to Freeze in Viewport <done>: "))
          (setq layernam(cdr(assoc 8(entget(car ent)))))
          (if(=(getvar "clayer")layernam)(setq curlayer 't))
          (if start(setq laylist layernam start nil)
               (setq laylist(strcat laylist "," layernam)))
          (princ(strcat "\nPicked Layer " layernam))
     )
     (command "pspace" "vplayer" "freeze" laylist
         "s" vp "" "")
     (setvar "expert" tempexpt)
     (if curlayer(princ "\nCannot Freeze Current Layer !"))
     (princ)
  )
  (princ
     "\nAutocad Release 11 or higher is required for program!!")
   )(princ)
)
;end
(defun c:cll ( / lay)          ;change ents to same layer as source ent
  (setq lay (cdr (assoc 8 (entget (car (entsel "source ent: "))))))
  (apply 'command (list "chprop" (ssget) "" "la" lay ""))
  (princ)
)
(defun c:copylay ( / lay)      ;copy ents to same layer as source ent
  (setq lay (cdr (assoc 8 (entget (car (entsel "source ent: "))))))
  (apply 'command (list "copy" (setq ss (ssget)) "" "@" "@"))
  (command "chprop" ss "" "la" lay "")
  (princ)
)
(defun c:DCC ()
  (apply 'command (list "chprop" (ssget) "" "co" "bylayer" ""))
  (princ)
)
(command "pdmode" "1")