LAYLCK

LAYLCK

Anonymous
Not applicable
402 Views
3 Replies
Message 1 of 4

LAYLCK

Anonymous
Not applicable

I am writing an autolisp to lock certain layers (these layers do not have anything drawn on them in the project due to client request). I want to be able to type in the layer names instead of selecting an object, does anyone know how to do this?

0 Likes
403 Views
3 Replies
Replies (3)
Message 2 of 4

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

I am writing an autolisp to lock certain layers (these layers do not have anything drawn on them in the project due to client request). I want to be able to type in the layer names instead of selecting an object, does anyone know how to do this?


One approach:  You can lock any number of Layers in a Layer command, all at once, by typing in their names in one comma-delimited string.  [The same goes for assigning colors, linetypes, etc.]  So, in case some Users may not be aware of that, try something like:

 

(command "_.layer" "_lock" (getstring "n\Type all Layer names to lock, separated by commas: ") "")

Kent Cooper, AIA
0 Likes
Message 3 of 4

pbejse
Mentor
Mentor

@Kent1Cooper wrote:

One approach:  You can lock any number of Layers in a Layer command, all at once, by typing in their names in one comma-delimited string.  [The same goes for assigning colors, linetypes, etc.]  So, in case some Users may not be aware of that..

 

 


To add to that , users can use wildcards 

 

C-ANNO*,C-PROP*,*BANANA*,C-DIMENSION

 

0 Likes
Message 4 of 4

stevor
Collaborator
Collaborator

To add to that, you can get the quantity of entities on each layer:

 

 (Defun Dxf_ (n L) (cdr (assoc n L)) )
 
 ; tabLe name List
 (Defun TbL_nL (tn / td L) (setq @Anonymous "tbL_nL") (whiLe (setq td
  (tbLnext tn (not td))) (setq L (cons (Dxf_ 2 td) L))) L )

  (setq NCDL nil  CDL nil)
  (foreach LNS (tbl_NL "LAYER")
   (setq ss (ssget "x"(list (cons 8 LNS ) )))
   (SETQ QSS (if SS (sslength SS) 0))  
   (if ss (setq CDL (if CDL (strcat CDL "," LNS) LNS))
     (setq NCDL (if NCDL (strcat NCDL "," LNS) LNS)))
  )

 

Where NCDL, None Comma Delimited List,

is as string of the layers without entities.

 

S
0 Likes