TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Bmossman on October 04, 2017, 09:27:28 AM

Title: VP Freezing all layers that are turned off
Post 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?


Title: Re: VP Freezing all layers that are turned off
Post by: ChrisCarlson on October 06, 2017, 02:14:44 PM
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!
Title: Re: VP Freezing all layers that are turned off
Post by: reyas1123 on October 08, 2017, 04:01:13 AM
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/turn-off-all-frozen-layers/td-p/3779634
Title: Re: VP Freezing all layers that are turned off
Post by: Bmossman on October 10, 2017, 01:29:04 PM
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.

Code: [Select]
(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]:
Title: Re: VP Freezing all layers that are turned off
Post by: Bmossman on October 11, 2017, 12:10:31 PM
Figured it out. I had to add "c" to select the "current" viewport under line 8

Code: [Select]
(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)))
)