Jamie Duncan
Usenet Archive
- Joined
- Jun 27, 2003
- Messages
- 177
- Reaction score
- 0
Trying to save and restore layer states within lisp routines. Came up with these - seems to store 'em just fine, but doesn't seem to be able to restore them...any help is appreciated:
(defun c:savealllayers (/ end1 temp )
(setq Savethelayers nil temp T)
(while (setq end1 (tblnext "LAYER" temp))(princ end1)
(setq temp nil
Savethelayers (cons (list (cdr (assoc 2 end1))(cdr (assoc 70 end1))(cdr (assoc 62 end1))) Savethelayers)) )
)
(defun c:Restorealllayers (/ temp layval1 laynam1 layval2) (foreach temp Savethelayers (setq laynam1 (car temp) layval1 (cadr temp) layval2 (caddr temp)) (if (tblsearch "LAYER" laynam1) (progn (if (< 0 layval2)(command "-layer" "off" laynam1 "")(command "-layer" "on" laynam1 "")) (if (logand layval1 1)(command "-layer" "f" laynam1 "")(command "-layer" "t" laynam1 "")) (if (logand layval1 4)(command "-layer" "lo" laynam1 "")(command "-layer" "u" laynam1 "")) ) ) )
)
Jamie Duncan
Consulting - If you're not part of the solution, there's good money in prolonging the problem.
(defun c:savealllayers (/ end1 temp )
(setq Savethelayers nil temp T)
(while (setq end1 (tblnext "LAYER" temp))(princ end1)
(setq temp nil
Savethelayers (cons (list (cdr (assoc 2 end1))(cdr (assoc 70 end1))(cdr (assoc 62 end1))) Savethelayers)) )
)
(defun c:Restorealllayers (/ temp layval1 laynam1 layval2) (foreach temp Savethelayers (setq laynam1 (car temp) layval1 (cadr temp) layval2 (caddr temp)) (if (tblsearch "LAYER" laynam1) (progn (if (< 0 layval2)(command "-layer" "off" laynam1 "")(command "-layer" "on" laynam1 "")) (if (logand layval1 1)(command "-layer" "f" laynam1 "")(command "-layer" "t" laynam1 "")) (if (logand layval1 4)(command "-layer" "lo" laynam1 "")(command "-layer" "u" laynam1 "")) ) ) )
)
Jamie Duncan
Consulting - If you're not part of the solution, there's good money in prolonging the problem.