Tunnelrat Posted July 30, 2015 Posted July 30, 2015 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. Quote
Stefan BMR Posted July 30, 2015 Posted July 30, 2015 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) ) Quote
Tunnelrat Posted July 30, 2015 Author Posted July 30, 2015 It works beautifully. Thank you Stefan. Quote
David Bethel Posted July 30, 2015 Posted July 30, 2015 Some releases asked for verification to LOck the current layer So maybe: (command "_.LAYER" "_LOck" (strcat "~" (getvar "CLAYER")) "") -David Quote
Tunnelrat Posted July 30, 2015 Author Posted July 30, 2015 Thank you David, I'll keep this code handy for future use. Quote
Tunnelrat Posted July 30, 2015 Author Posted July 30, 2015 Because I need to use all layers that are there to draw on top of them making right of way descriptions. Quote
tombu Posted July 30, 2015 Posted July 30, 2015 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. Quote
iconeo Posted July 30, 2015 Posted July 30, 2015 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 I actually prefer the layiso method because of the fade but I suppose you can accomplish this with locked layers as well. Quote
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.