Simple lisp request please :)
is it possible for someone to make me a lisp to invert the layer status? (on/off, frozen/thawed)what do you think? is it easy?
many thanks in advance I'll be glad when this insomnia wears off, I'd like to go to bed.
This is a fairly easy task to accomplish. Definitely something anyone could accomplish with a little work.
Hope this helps.BTW, I think this can be accomplish in the layer manager, but I'm not sure, I never open it.
;;; Invert on/off and freeze/thaw state of all layers in drawing;;; Alan J. Thompson, 09.14.09(defun c:LayerInvert (/ #Doc) (vl-load-com) (vlax-for x (vla-get-Layers (setq #Doc (vla-get-activedocument (vlax-get-acad-object)) ) ;_ setq ) ;_ vla-get-Layers ;; invert on/off state (vl-catch-all-apply 'vla-put-layeron (list x (if (eq (vla-get-layeron x) :vlax-true) :vlax-false :vlax-true ) ;_ if ) ;_ list ) ;_ vl-catch-all-apply ;; invert freeze/thaw state (vl-catch-all-apply 'vla-put-freeze (list x (if (eq (vla-get-freeze x) :vlax-true) :vlax-false :vlax-true ) ;_ if ) ;_ list ) ;_ vl-catch-all-apply ) ;_ vlax-for (vla-regen #Doc acActiveViewport) (princ)) ;_ defun hmmm.... it doesnt seem to switch on those that are off......
(because it needs to do that) Works fine for me. On->Off, Off->On, Frozen->Thawed, Thawed->Frozen
I even tested it on a file that has 730 layers (some even xrefed) with all assorted states. Everything was completely successful. i'll try again on another drawing later.... busy at work at the moment.... btw have you managed to get some sleep? Hope you get it to work. I'll give it another look tomorrow. Still no sleep, but I'm going to make another attempt at it. i realised my problem now which is with my original question :S
can you remove the part where it inverts the freeze/thawed state because i was letting everything thawed so it froze everything....
my mistake sorry....
thanks again for your help
Easy fix, just remove this portion from the above code (I marked it in red):
;; invert freeze/thaw state (vl-catch-all-apply 'vla-put-freeze (list x (if (eq (vla-get-freeze x) :vlax-true) :vlax-false :vlax-true ) ;_ if ) ;_ list ) ;_ vl-catch-all-apply
页:
[1]