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
5,101 Views
25 Replies
Message 1 of 26

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 just like the -XLIST command (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))

 Thanks in advance

Running AutoCAD Architecture 2020, in German
0 Likes
5,102 Views
25 Replies
  • Lisp
Replies (25)
Message 21 of 26

pbejse
Mentor
Mentor

@barry2104 wrote:

PS: there is no hyperlink to your screencast


Not only that, now my reply to your post is gone, it must be a bug in the matrix.

 

behind.jpg

 

I must've deleted it by mistake whilst i'm tryingto embedd the screencast. [ like i normally do ]

Here is the screencast link : Xref and Block Layer Filter 

 


@barry2104 wrote:

Again, I’m running 2021 Architecture.


And I am running out of ideas 😄

 

 

 

0 Likes
Message 22 of 26

pbejse
Mentor
Mentor

@barry2104 wrote:

I just discovered that the USER SELECTED LAYER filter (sometimes) DOES work,...

Very Weird.


Weird indeed, I guess we need to come up with some other approach, one that doesnt involved layer manager....

 

 

0 Likes
Message 23 of 26

alishu111
Explorer
Explorer

First time posting @pbejse im all for you LISP I've used it briefly. it definitely is buggy but a major time saver. I really would love a solution to this LISP. 

 

UPDATE

 

so I figured out what works with this LISP. 

#1. Type in command XLF

#2 Choose XREF Layer

#3 Click the unfreeze all 

#4 Check USER SELECTED LAYER 

 

and the selected layer will pop up every time. I think it has something to do with reconciling the layer as I see it pop-up in the layer manager briefly and disappears    

0 Likes
Message 24 of 26

pbejse
Mentor
Mentor

@alishu111 wrote:

First time posting @pbejse im all for you LISP I've used it briefly. it definitely is buggy but a major time saver. I really would love a solution to this LISP. 

 

UPDATE


I guess you already answered you're own question @alishu111 😊

I'm not even interested in pursuing this anyway

 

buggy.png  <---- Buggy 

0 Likes
Message 25 of 26

alishu111
Explorer
Explorer
more like a work around but not an automated solution -_-
0 Likes
Message 26 of 26

Sea-Haven
Mentor
Mentor

Like your post 8 I think changing behind the scenes is easier. This just uses my multi gtevals library dcl. The values would be filled from the current layer properties, more can be added. Say a color of 0 or -ve would trigger acad_dialog

 

SeaHaven_0-1630379448534.png

 

 

0 Likes