TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Bmossman on October 04, 2017, 09:27:28 AM
-
I am trying to VPFREEZE all layers that are currently turned off in the active viewport only. Does anyone have a routine that accomplishes this?
-
You'll need a few steps.
1) Create a list of layers which are turned off
2) Process each layer by freezing it
3) Increase productivity
4) ...
5) ...
6) Profit!
-
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/turn-off-all-frozen-layers/td-p/3779634
-
Thank you for the responses. Is it possible to issue the VPLAYER command that will VPFREEZE in lieu of freezing? Sorry this all looks Greek to me. I tried changing the command to VPLAYER, but apparently I'm doing something wrong.
(defun c:fo (/ l dxf code list)
(defun dxf (code list)
(cdr (assoc code list))
);defun
(setq l (tblnext "layer" T))
(command "VPLAYER")
(while l
(cond ((< (dxf 62 l) 0) (command "f" (dxf 2 l))))
(setq l (tblnext "layer"))
);while
(command "")
(setq l ())
(cond ((not (null gc)) (gc)))
)
Seems to be erroring out obtaining the layer names that are turned off:
Command: FO
VPLAYER Enter an option [?/Color/Ltype/LWeight/TRansparency/Freeze/Thaw/Reset/Newfrz/Vpvisdflt]: f
Enter layer name(s) to freeze or <specify layers by object selection>: S-ANNOT-P-TXT
Specify viewport(s) [All/Select/Current/eXcept current] <Current>: f
Invalid option keyword.
; error: Function cancelled
Specify viewport(s) [All/Select/Current/eXcept current] <Current>:
Enter an option [?/Color/Ltype/LWeight/TRansparency/Freeze/Thaw/Reset/Newfrz/Vpvisdflt]:
-
Figured it out. I had to add "c" to select the "current" viewport under line 8
(defun c:fo (/ l dxf code list)
(defun dxf (code list)
(cdr (assoc code list))
);defun
(setq l (tblnext "layer" T))
(command "VPLAYER")
(while l
(cond ((< (dxf 62 l) 0) (command "f" (dxf 2 l) "c")))
(setq l (tblnext "layer"))
);while
(command "")
(setq l ())
(cond ((not (null gc)) (gc)))
)