PDA

View Full Version : Layer On/Off Shortcut



mjones675692
7th May 2003, 09:46 pm
I would like to know if it is possible to have either a shortcut key or a menu button that could toggle on or off a specific layer (the viewport layer). Thanks in advance.

Mark

CADTutor
7th May 2003, 10:35 pm
Either of these things are possible but you would need to use an underlying LISP routine to actually do the work.

mjones675692
7th May 2003, 11:28 pm
I guess that is my problem, where could I get a LISP routine that could do this? Has anybody seen one that is similar?

gcp310
7th May 2003, 11:46 pm
try this, use the TL=thaw layer FL=freeze layer



;; Name:- Layer Utilities lisps
;; Written by:- Greg Smith
;; Written on:- 16/5/2001

;; Modified by:- Greg Smith
;; Modified on:- 18/7/2001

;; Freezes the select layer
(defun c:fl ( )
(setq flay (cdr (assoc 8 (entget (car (entsel "\nSelect the object on the layer you want to freeze: "))))))
(setq clayer(getvar "clayer"))
(if(= clayer flay)(alert "\nCAN'T FREEZE THE CURRENT LAYER! "))
(command "layer" "f" flay "")
(prompt (strcat " The " lay " layer has been frozen "))
(princ)
) ;; Defun

;; Thaws all frozen layers
(defun c:ta ( )
(command "layer" "t" "*" "")
(prompt "\nAll layers are thawed ")
(princ)
) ;; Defun

Goodluck

G