Jump to content

Recommended Posts

Posted

Hello,

I searched for an autolisp that lock all layers except the current layer that I'm using but I can't find one.

Right now I have to lock all layers then unlock the layer by click on an object of the current layer.

Would you be kind enough to write one for me if it can be done.

Thank you very much.

Posted

Take a look

(defun C:LOCKALL (/ cmdecho)
 (setq cmdecho (getvar 'cmdecho))
 (setvar 'cmdecho 0)
 (command "_.-LAYER" "_LOck" "*" "_Unlock" (getvar "CLAYER") "")
 (setvar 'cmdecho cmdecho)
 (princ)
 )

(defun C:UNLOCKALL (/ cmdecho)
 (setq cmdecho (getvar 'cmdecho))
 (setvar 'cmdecho 0)
 (command "_.-LAYER" "_Unlock" "*" "")
 (setvar 'cmdecho cmdecho)
 (princ)
 )

Posted

It works beautifully.

Thank you Stefan.

Posted

Some releases asked for verification to LOck the current layer

 

So maybe:

 

(command "_.LAYER" "_LOck" (strcat "~" (getvar "CLAYER")) "")

 

-David

Posted

Thank you David, I'll keep this code handy for future use.

Posted

Because I need to use all layers that are there to draw on top of them making right of way descriptions.

Posted
Because I need to use all layers that are there to draw on top of them making right of way descriptions.

 

That's what layiso's [Lock and fade] setting is for. Nothing wrong with doing it with lisp, beauty of AutoCAD is there's at least 3 ways to do anything.

Posted
That's what layiso's [Lock and fade] setting is for. Nothing wrong with doing it with lisp, beauty of AutoCAD is there's at least 3 ways to do anything.

 

Which is good and bad in so many ways :D

 

I actually prefer the layiso method because of the fade but I suppose you can accomplish this with locked layers as well.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...