Radu Iordache Posted March 31, 2023 Share Posted March 31, 2023 Hi everybody, I need a lisp that will show/hide all images in a drawing by the push of a button. From my search this is possible by change in dxf codes. By command (ENTGET (CAR (ENTSEL))) I got the DXF codes for an image when "Show image" property is "YES" and then "NO". It appears that the only difference is (70 . 7) when "YES" versus (70 . 6) when "NO". I am wondering if there is a way by lisp to select all images and change (70 . 7) to (70 . 6) for all of them (and back). Of course I could do it by just selecting all images and change the property in properties window but it seems to be more elegant with a button that I would assign to the lisp command If you know of any lisp that does this maybe for another property of another type of object, would be good anyway to adapt. Thank you! Quote Link to comment Share on other sites More sharing options...
Radu Iordache Posted March 31, 2023 Author Share Posted March 31, 2023 Solved by ChatGPT ;IMGOFF (defun c:IMGOFF (/ ss) (setq ss (ssget "_X" '((0 . "IMAGE")))) (if ss (progn (setq i 0) (while (< i (sslength ss)) (entmod (subst (cons 70 6) (assoc 70 (entget (ssname ss i))) (entget (ssname ss i)))) (setq i (1+ i)) ) (princ (strcat "\nChanged DXF code for " (itoa (sslength ss)) " images.")) ) (princ "\nNo images found.") ) ) ;IMGON (defun c:IMGON (/ ss) (setq ss (ssget "_X" '((0 . "IMAGE")))) (if ss (progn (setq i 0) (while (< i (sslength ss)) (entmod (subst (cons 70 7) (assoc 70 (entget (ssname ss i))) (entget (ssname ss i)))) (setq i (1+ i)) ) (princ (strcat "\nChanged DXF code for " (itoa (sslength ss)) " images.")) ) (princ "\nNo images found.") ) ) 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.