JoeyG_77 Posted August 11, 2020 Share 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 Link to comment Share on other sites More sharing options...
dlanorh Posted August 11, 2020 Share 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 Link to comment Share on other sites More sharing options...
JoeyG_77 Posted August 11, 2020 Author Share Posted August 11, 2020 This worked perfect ! ... Thank You Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 11, 2020 Share 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 Link to comment Share on other sites More sharing options...
JoeyG_77 Posted August 11, 2020 Author Share Posted August 11, 2020 Thawat ... Thanks for the revision works perfect Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 11, 2020 Share Posted August 11, 2020 You're welcome anytime. With every post you write my name in a different way. Quote Link to comment Share on other sites More sharing options...
JoeyG_77 Posted August 11, 2020 Author Share 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 Link to comment Share on other sites More sharing options...
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.