I need a LISP routine that will run another LISP routine if a block by the name of "CabinetSchedule" is double clicked...Is this even possible??? It seems possible, but I have no experience with reactors...Thanks in advance for the help...
|
I need a LISP routine that will run another LISP routine if a block by the name of "CabinetSchedule" is double clicked...Is this even possible??? It seems possible, but I have no experience with reactors...Thanks in advance for the help...
You can start to play with this. . .
: ) Happy Computing !Code:;;--- The Reactor (vl-load-com) (setq Check_Mouse_DoubbleClick_Reactor (vlr-mouse-reactor nil '((:vlr-beginDoubleClick . Check_Mouse_DoubbleClick_Function ))) ) ;;--- The function that the reactor trigger (defun Check_Mouse_DoubbleClick_Function ( ObjReactor_In 3Dpoint_In / 3Dpoint ) (setq 3Dpoint (car 3Dpoint_In ) ) (if (= (cdr (assoc 2 (entget (caar (reverse (nentselp 3Dpoint )))))) "CabinetSchedule" ) (MyLisp) ( ) ) (princ) ) ;;--- The lisp that the function call (defun MyLisp ( / ) (alert "MyLisp is running" ) ) ;;--- Cleaning (vlr-remove Check_Mouse_DoubbleClick_Reactor ) ; Remove the reactor (setq Check_Mouse_DoubbleClick_Reactor nil ) ; Clear / assign nil to the reactor (setq Check_Mouse_DoubbleClick_Function nil ) ; Clear / assign nil to the function
kennet
BTW
it will interfere with AutoCADs default reactor "Referense Edit"
Last edited by kennet.sjoberg; 2007-01-17 at 11:29 PM. Reason: BTW
Thanks for the code...It works great except a few things...
For some reason it runs "MyLisp" twice...Also, is there any way to disable it going to the blockeditor or the ref editor??? Basically I only want one thing to run if this block is picked...
Thanks again for the help...
It runs "MyLisp" as many times that you load the reactor . . . clean up and try again.Originally Posted by Ogre
to disable the blockeditor you can set pickfirst to 0, and then reset pickfirst.
: ) Happy Computing !
kennet
It does not seem to work...I added a few thing that I thought may have helped...Originally Posted by kennet.sjoberg
Thanks again for the help...Code:(vl-load-com) (setq Check_Mouse_DoubbleClick_Reactor (vlr-mouse-reactor nil '((:vlr-beginDoubleClick . Check_Mouse_DoubbleClick_Function ) );' );vlr-mouse-reactor );setq ;(setq Check_LISP_Ended_Reactor (vlr-lisp-reactor nil '((:vlr-lispended . Reset_Pickfirst)))) ;;--- The function that the reactor trigger (defun Check_Mouse_DoubbleClick_Function ( ObjReactor_In 3Dpoint_In / 3Dpoint ) (setq 3Dpoint (car 3Dpoint_In ) ) (if (caar (reverse (nentselp 3Dpoint ))) (cond ( (= (cdr (assoc 2 (entget (caar (reverse (nentselp 3Dpoint )))))) "CABINETSCHEDULE" ) (MyLisp) );case ) (Reset_Pickfirst) );if (princ) ) (defun Reset_Pickfirst ( / ) (setvar "pickfirst" 1) );defun (defun Set_Pickfirst ( ObjReactor_In 3Dpoint_In / ) (setq 3Dpoint (car 3Dpoint_In ) ) (if (= (cdr (assoc 0 (entget (car (nentselp 3Dpoint))))) "LINE") (if (= (cdr (assoc 2 (entget (caar (reverse (nentselp 3Dpoint )))))) "CABINETSCHEDULE" ) (setvar "pickfirst" 0) );if (setvar "pickfirst" 1) );if (princ) );defun ;;--- The lisp that the function call (defun MyLisp ( / ) (progn (alert "MyLisp is running" ) );progn ;;; );if
Hmm.. it seems to be a "who comes first problem", the hen or the egg ?
If you set pickfirst to 0 before you run the reactor it works. . . but then you miss the pickfirst advantage.
I do not know the way out. . . sorry.
: ) Happy Computing !
kennet
No problem...Thanks again for the help...Originally Posted by kennet.sjoberg