ehsantavassolian Posted August 20, 2018 Posted August 20, 2018 auto on/off an object i have an object or block drawn on a picture or map i want to choose an object , and then for 10 times (twice a second) , turn off and on the object , so i can compare the object with the picture below Please advise me to improve the following code or alternate code (defun c:onoff () (setvar "cmdecho" 0) (setq s (ssget "_:L")) (while t (c:hideit) (redraw) (command "._delay" "300") (c:showit) (redraw) (command "._delay" "300") ) (c:showit) (setvar "cmdecho" 0) (princ) ) ;;;;;;;;;;;;;;;;;; (defun c:showit ( / i s ) (if (setq s (ssget "_X" '((60 . 1)))) (repeat (setq i (sslength s)) (_substdxf 60 0 (entget (ssname s (setq i (1- i))))) ) ) (princ) ) (defun c:hideit ( / i s ) (if (setq s (ssget "_X" '((60 . 0)))) (repeat (setq i (sslength s)) (_substdxf 60 1 (entget (ssname s (setq i (1- i))))) ) ) (princ) ) (defun _substdxf ( key value elst / pair ) (if (setq pair (assoc key elst)) (entmod (subst (cons key value) pair elst)) (entmod (append elst (list (cons key value)))) ) ) Quote
ehsantavassolian Posted August 20, 2018 Author Posted August 20, 2018 (edited) i fond it (defun c:onoff (/ CurEnt CurObj CurSet) (setq CurSet (ssget "_:L")) ;(ssget "P") ;(command "ZOOM" "OBJECT" CurSet "") (setq CurEnt (ssname CurSet 0)) (setq CurObj (vlax-ename->vla-object CurEnt)) (repeat 6 ;;; (vl-cmdf "._delay" "200") (repeat 200000 (princ)) (vla-put-Visible CurObj :vlax-false) (repeat 200000 (princ)) ;;; (vl-cmdf "._delay" "200") (vla-put-visible CurObj :vlax-true) );repeat (ssdel CurEnt CurSet) (princ) ) Edited August 20, 2018 by ehsantavassolian Quote
hanhphuc Posted August 20, 2018 Posted August 20, 2018 (edited) FWIW alternative suggestion (not hiding method) (vla-put-fade image 50) Edited August 20, 2018 by hanhphuc Quote
Grrr Posted August 20, 2018 Posted August 20, 2018 https://www.cadtutor.net/forum/topic/47487-highlight-2-overlapping-blocks-for-visual-verification/ 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.