Lisp to find out and amend properties of XREF/Block layers

Lisp to find out and amend properties of XREF/Block layers

barry2104
Collaborator Collaborator
406 Views
2 Replies
Message 1 of 3

Lisp to find out and amend properties of XREF/Block layers

barry2104
Collaborator
Collaborator

I use the following lisp in order to find out layer names of entities within an xref or block. It works great, much better than the standard XLIST command which only shows you the first 40-odd charachters of the layer name without the ability to copy the text out of the output window. However 90% of the time I only want to find the layer name out in order to then change its properties via the layer manager (e.g. change colour from red to black).

 

Is it possible to amend the lisp so that upon entering the command and picking the entity, it then opens up Layer Manager and has that layer selected (or filtered out) so that I can instantly change its properties and save time finding the layer?

 

if this isn't possible then I guess a consolation would be to amend the lisp so that the selected layer name is automatically added to the clipboard, with a * before and after the layer name so that I can just paste (CTRL+V) the clipboard into the layer filter within layer manager to get faster access to the layer properties.

 

 

(defun C:XRL ()
 (setq EnL (entget (car (nentsel "\nSelect object to identify layer it is on : ")))
       LNm (cdr (assoc 8 EnL))
 )
 (princ "\n Entity layer name: ")
 (princ LNm)
(prin1))

 

 

Running AutoCAD Architecture 2020, in German
0 Likes
407 Views
2 Replies
Replies (2)
Message 2 of 3

vinodkl
Mentor
Mentor

Hi,

 

Why not use "-XLIST"? (note the hyphen in front of xlist)

using "-XLIST" would pop up the command history with the layer used.

--------------------------------------------------------------------------------------------------------------------------
ವಿನೋದ್ ಕೆ ಎಲ್( System Design Engineer)
Likes is much appreciated if the information I have shared is helpful to you and/or others.

Please mark "Accept as Solution" if my reply resolves the issue or answers your question, to help others in the community.
--------------------------------------------------------------------------------------------------------------------------
0 Likes
Message 3 of 3

barry2104
Collaborator
Collaborator

Although -XLIST is much better than XLIST because it shows the entire layer name in the command bar, not in a separate pop-up window (which only shows the first ~40 charachters), it still takes time to then e.g. change the colour of this layer via layer manager (open LM, find/filter layer) - I want to automate this layer filtering/searching via an extension to my lisp

Running AutoCAD Architecture 2020, in German
0 Likes