PDuMont Posted August 23, 2017 Share Posted August 23, 2017 Hello, If searched around and haven't found a way to test if a refedit is active. I know there is a system variable for the block editor, it seems there isn't one for refedit. I thought I may be able to test for unavailable/illegal commands while refedit is active, "block" command for example, but can't seem to make this work. Can anyone point me in the right direction? Quote Link to comment Share on other sites More sharing options...
rlx Posted August 24, 2017 Share Posted August 24, 2017 Hi PDuMont, found something that has to do with reactors. Think its from Poland and I don't exactly know what they're saying so I hope it makes more sense to you than it does to me. http://www.cadtutor.net/forum/showthread.php?101534-Test-for-quot-Edit-Block-In-Place-quot-Active (setq g_lastHandle nil g_tmpHandel nil) (defun callbackStart(obj lst) (if (= "REFEDIT" (car lst)) (setq g_lastHandle (cdr (assoc 5 (entget (entlast))))) ) ) (defun callbackEnd(obj lst) (if (= "REFCLOSE" (car lst)) (progn (setq g_tmpHandel g_lastHandle) (setq g_lastHandle nil) ) ) ) (defun callbackAbort(obj lst) (if (= "REFEDIT" (car lst)) (setq g_lastHandle nil) ) (if (= "REFCLOSE" (car lst)) (setq g_lastHandle g_tmpHandel) ) ) (if (null refeditDetect) (setq refeditDetect (vlr-command-reactor nil '((:vlr-commandWillStart . callbackStart) (:vlr-commandEnded . callbackEnd) (:vlr-commandCancelled . callbackAbort) (:vlr-commandFailed . callbackAbort))))) (defun getRefeditSS( / elst en i len ss) (setq ss (ssget)) (if g_lastHandle (progn (setq i 0 len (sslength ss)) (setq elst nil) (while (< i len) (setq en (ssname ss i)) (setq elst (cons en elst)) (setq i (1+ i)) ) (foreach en elst (if (<= (cdr (assoc 5 (entget en))) g_lastHandle) (ssdel en ss) ) ) ) ) ss ) (defun c:foo() (print (sslength (getRefeditSS) )) (princ) ) gr. Rlx Quote Link to comment Share on other sites More sharing options...
PDuMont Posted August 24, 2017 Author Share Posted August 24, 2017 Thanks for that rlx. Seems a bit much for what I was trying to do. I was trying to stop a routine from running if a refedit was open because the lisp is creating a block, which you can't do via command call inside of a refedit. So I just modified the routine to create the block via entmake. Problem solved. Thanks again. Quote Link to comment Share on other sites More sharing options...
rlx Posted August 24, 2017 Share Posted August 24, 2017 Thanks for that rlx. Seems a bit much for what I was trying to do. I was trying to stop a routine from running if a refedit was open because the lisp is creating a block, which you can't do via command call inside of a refedit. So I just modified the routine to create the block via entmake. Problem solved. Thanks again. Glad you were able to crack it. Often the best solution is the simplest. Reactors can be difficult to handle, espescially if you have to many of them. Temporarily un-defun a command would be another option but I think your solution is the best option. gr. Rlx Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted August 24, 2017 Share Posted August 24, 2017 To answer the OP: Check the REFEDITNAME variable. Quote Link to comment Share on other sites More sharing options...
PDuMont Posted August 25, 2017 Author Share Posted August 25, 2017 Boom, there it is... right in front of my face. Thanks Roy! 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.