JoeyG_77 Posted August 11, 2020 Posted August 11, 2020 Hey everyone .... I have a lisp that turns off a set of layers, but I want to click the icon again and have them turn on (defun c:XLAYERS (/ l n v e) (while (setq l (tblnext "LAYER" (not l))) (and (wcmatch (setq n (cdr (assoc 2 l))) "*XLINE*") (or (minusp (setq v (cdr (assoc 62 (setq e (entget (tblobjname "LAYER" n))))))) (entmod (append e (list (cons 62 (- v))))) ) ) ) (princ) ) This is the code I found from Twarwat ... Thanks Man any help would be appreciated Thanks Joey G Quote
dlanorh Posted August 11, 2020 Posted August 11, 2020 40 minutes ago, JoeyG_77 said: Hey everyone .... I have a lisp that turns off a set of layers, but I want to click the icon again and have them turn on (defun c:XLAYERS (/ l n v e) (while (setq l (tblnext "LAYER" (not l))) (and (wcmatch (setq n (cdr (assoc 2 l))) "*XLINE*") (or (minusp (setq v (cdr (assoc 62 (setq e (entget (tblobjname "LAYER" n))))))) (entmod (append e (list (cons 62 (- v))))) ) ) ) (princ) ) This is the code I found from Twarwat ... Thanks Man any help would be appreciated Thanks Joey G Try this modification. It is case agnostic. (defun c:XLAYERS (/ l n v e) (while (setq l (tblnext "LAYER" (not l))) (cond ( (wcmatch (strcase (setq n (cdr (assoc 2 l)))) "*XLINE*") (setq v (cdr (assoc 62 (setq e (entget (tblobjname "LAYER" n)))))) (cond ( (not v) (entmod (append e (list (cons 62 (* v -1)))))) (t (entmod (subst (cons 62 (* v -1)) (assoc 62 e) e))) ) ) ) ) (princ) ) Quote
JoeyG_77 Posted August 11, 2020 Author Posted August 11, 2020 This worked perfect ! ... Thank You Quote
Tharwat Posted August 11, 2020 Posted August 11, 2020 Hi, I guess this is enough. (defun c:foo (/ l n e) (while (setq l (tblnext "LAYER" (not l))) (and (wcmatch (setq n (cdr (assoc 2 l))) "*XLINE*") (entmod (append (setq e (entget (tblobjname "LAYER" n))) (list (cons 62 (- (cdr (assoc 62 e))))))) ) ) (princ) ) 1 Quote
JoeyG_77 Posted August 11, 2020 Author Posted August 11, 2020 Thawat ... Thanks for the revision works perfect Quote
Tharwat Posted August 11, 2020 Posted August 11, 2020 You're welcome anytime. With every post you write my name in a different way. Quote
JoeyG_77 Posted August 11, 2020 Author Posted August 11, 2020 Sometime the brain thinks you type something when you really dont ... so ill go with T*****t Thanks Again G yoeJ 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.