Jump to content

Recommended Posts

Posted

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

Posted
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)
)

 

Posted

This worked perfect ! ... Thank You 

Posted

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)
)

 

  • Like 1
Posted

Thawat ... Thanks for the revision works perfect 

Posted

You're welcome anytime.

With every post you write my name in a different way. 🤪

Posted

Sometime the brain thinks you type something when you really dont ... so ill go with T*****t

Thanks Again G yoeJ

  • Dislike 2

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...