ctrlaltdel Posted August 12, 2016 Share Posted August 12, 2016 (edited) The LISP below I googled will list the entity layer name & type including its block name & nested to what level. (DEFUN C:XS ( / NLVL ) (SETQ NENT (NENTSEL)) (SETQ EN (CAR NENT)) (SETQ ENT (ENTGET EN)) (PROMPT (STRCAT "\nEntity type >>>" (CDR (ASSOC 0 ENT)) " layer>>> " (CDR (ASSOC 8 ENT)))) (SETQ NLVL (1- (LENGTH (CADDDR NENT)))) (FOREACH EN (CADDDR NENT) (PROGN (SETQ ENT (ENTGET EN)) (PROMPT (STRCAT "\nBlock " (CDR (ASSOC 2 ENT)) " [[layer]] " (CDR (ASSOC 8 ENT)) " [[nesting level]] " (ITOA NLVL))) (SETQ NLVL (1- NLVL)))) (PRINC)) This is shown in command line when LISP is run & Click on an enity Entity type >>>LWPOLYLINE layer>>> DELETEDBlock A [[layer]] 0 [[nesting level]] 3 Block B [[layer]] 0 [[nesting level]] 2 Block C [[layer]] 0 [[nesting level]] 1 Block D [[layer]] DELETED [[nesting level]] 0 Please tell me what code to change to:1) rearrange the list- nesting level,Block name,layer name 2) Add [[]] to BLOCK 3) nesting level 0 start from the top down Entity type >>>LWPOLYLINE layer>>> DELETED[[nesting level]] 0 [[Block]] D [[layer]] DELETED [[nesting level]] 1 [[Block]] C [[layer]] 0 [[nesting level]] 2 [[Block]] B [[layer]] 0 [[nesting level]] 3 [[Block]] A [[layer]] 0 Cheers Edited August 12, 2016 by ctrlaltdel Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 13, 2016 Share Posted August 13, 2016 Instead of the PROMPT you need to do a cons so you make a list of the blocks nesting level as a text string then display the list, you can also (reverse lst) use (nth x lst) to retrieve each item. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.