I want to write a very simple program that will turn all layers OFF except the current layer, which I *think* would look something like this:
; "LOFF" command (turn all layers OFF except current layer)
(defun c:loff ()
(command "-la" "OFF" "*" "n")
(princ)
)
Yet this does not work. What am I doing wrong? Is it something to do with the astericks?
Thanks for any help as always.
@mikegera wrote:
Thanks, but that does not work either.
I am in 2014, FYI, if that matters.
Works for me, AC2010/2012/2014
EDITED
Try your code:
; "LOFF" command (turn all layers OFF except current layer) (defun c:loff () (command "-layer" "OFF" "*" "n" "") (princ) )
Henrique
That does not work either. Is there a way I can save some sort of output file when I run an AutoLISP file so we can see what is going on?
I have edited the previous post, test it...
"Is there a way I can save some sort of output file when I run an AutoLISP file so we can see what is going on?"
In a command call, affter running the code, press F2
For more complex codes, read this Lee Mac Tutorial
HTH
Henrique
I see what I did now. Wow, what a stupid mistake on my part. Using "la" instead of "layer". I am so used to entering "la" at the command line. The F2 thing helped identify that problem instantly. Thanks.
An additional "" is required at the end, by the way, or you'll be left hanging.
Thanks.
In A2014 this would be robust way:
(defun c:loff () (initcommandversion) (command "_.-layer" "_OFF" "*" "_N" "") (princ) )