Jump to content

Recommended Posts

Posted

Hi All

 

I've been trying my hand at reactors lately.The main question i have for now is; Is it possible to determine which entities you have highlighted without having to run a selection function or something similar?

 

Thanks

Posted

Do you mean which entities are currently selected by the user?

 

If so, you could use:

 

(setq ss (cadr (ssgetfirst)))

 

Lee

Posted
Do you mean which entities are currently selected by the user?

 

If so, you could use:

 

(setq ss (cadr (ssgetfirst)))

Lee

 

Not quite

 

When you select an entity and take no action i would like to start a reactor

Posted

Well, you could use an object reactor I suppose, using:

:vlr-openedForModify

 

 

but I am not sure if it would work or not. :)

Posted

Just tested the above theory using:

 

(defun c:ObjON ()
 (vl-load-com)
 (if (not *Obj)
   (setq *Obj
     (vlr-object-reactor
       (mapcar 'vlax-ename->vla-object
         (mapcar 'cadr (ssnamex (ssget "_X")))) nil
       (list
         (cons :vlr-openedforModify 'ModObj)))))
 (princ))

(defun ModObj (Obj Rea Arg)
 (princ
   (vl-princ-to-string Obj))
 (princ))
 

 

It is obvious from this that it doesn't quite fire exactly when you want it to.

 

I am not sure what else you could try though... :geek:

Posted

On second thoughts, this would be something like what you are after:

 

(defun c:ObjON ()
 (vl-load-com)
 (if (not *Obj)
   (setq *Obj
     (vlr-miscellaneous-reactor nil
       (list
         (cons :vlr-pickfirstModified 'ModObj)))))
 (princ))

(defun ModObj (Reac Args)
 (alert "Selected!")
 (princ))

(defun c:ObjOFF ()
 (if *Obj
   (progn
     (vlr-remove *Obj)
     (setq *Obj nil)))
 (princ))

 

Using a Miscellaneous Reactor, with the :vlr-pickfirstModified callback.

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