Jump to content

Test for "Edit Block In Place" Active


PDuMont

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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