Tunnelrat Posted July 30, 2015 Share 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 Link to comment Share on other sites More sharing options...
Stefan BMR Posted July 30, 2015 Share 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 Link to comment Share on other sites More sharing options...
Tunnelrat Posted July 30, 2015 Author Share Posted July 30, 2015 It works beautifully. Thank you Stefan. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted July 30, 2015 Share Posted July 30, 2015 Some releases asked for verification to LOck the current layer So maybe: (command "_.LAYER" "_LOck" (strcat "~" (getvar "CLAYER")) "") -David Quote Link to comment Share on other sites More sharing options...
Tunnelrat Posted July 30, 2015 Author Share Posted July 30, 2015 Thank you David, I'll keep this code handy for future use. Quote Link to comment Share on other sites More sharing options...
iconeo Posted July 30, 2015 Share Posted July 30, 2015 Why not just use layiso? Quote Link to comment Share on other sites More sharing options...
Tunnelrat Posted July 30, 2015 Author Share 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 Link to comment Share on other sites More sharing options...
tombu Posted July 30, 2015 Share 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 Link to comment Share on other sites More sharing options...
iconeo Posted July 30, 2015 Share 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 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.