Jump to content

Recommended Posts

Posted

I'm learning Reactor. I want to use reactor for ATT Block.

In found in help: vlr-object-reactor -> :vlr-subObjModified

but don't have any Example about :vlr-subObjModified

Thanks.:love:

Posted

Example:

 

(defun c:Start_Object_Reactor nil

 (if (not (vl-position "ATT-REACT"
            (mapcar
              (function
                (lambda (x)
                  (strcase
                    (vlr-data x))))
              (cdar (vlr-reactors :vlr-object-reactor)))))

   (if (and (princ "\n Select Objects to Trigger Reactor: ")
            (setq i -1 ss (ssget '((0 . "INSERT") (66 . 1)))))
     (progn

       (while (setq ent (ssname ss (setq i (1+ i))))
         (setq OwnerList (cons (vlax-ename->vla-object ent) OwnerList)))
   
       (vlr-object-reactor OwnerList "Att-React"
         (list
           (cons :vlr-subobjmodified 'DoIt)))))

   (princ "\n** Object Reactor Already Running **"))

 (princ))


(defun DoIt (Object Reactor Args)
 (alert
   (strcat "You Modified an Attribute in Block: "
           (vl-prin1-to-string Object)))
 (princ))


(defun c:End_Object_Reactor (/ React)

 (if (and (setq React
            (vl-some
              (function
                (lambda (x)
                  (if (eq "ATT-REACT"
                          (strcase (vlr-data x))) x)))
              (cdar (vlr-reactors :vlr-object-reactor))))
          (vlr-added-p React))

   (vlr-remove React)
   (princ "\n** Reactor Not Running **"))

 (princ))
 

   

   

Posted

thanks Lee.

I have 2 attriblock.

attriblock1 have: Tag1 ->string1

attriblock2 have: Tag2 ->string2

 

I want always string1 = string2.

 

Help me code in function "DO IT"

vlr-object-reactor OwnerList "Att-React"

(list

(cons :vlr-subobjmodified 'DoIt)))))

  • 1 year later...
Posted

Hi Lee,

 

This is about what I need, but why does the alert fire once for each attribute in the block when I only change one or none and then use ok ?

If canceled it does not fire the alert.

 

my code in the Doit part only needs to happen once each time the block is accessed and modified.

 

Thanks

 

roby

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