Jump to content

Recommended Posts

Posted

Hello all,

 

I'm pretty new to the reactor side of coding and I'm trying to make one that does a regenall after doing a grip_stretch to a polyline on a specific layer "a-area". This is what I've found so far. Thanks

 

(if (not *field-update*)

(setq *field-update*

(vlr-command-reactor "Field-Update" '((:vlr-commandended . field-regen)))

)

)

(defun field-regen ( reactor params )

(cond

( (equal params '("GRIP_STRETCH"))

(vla-regen

(setq *acdoc*

(cond ( *acdoc* )

( (vla-get-activedocument (vlax-get-acad-object)) )

)

)

acactiveviewport

)

)

)

(princ)

)

Posted

Here is a quick example for LWPolylines:

 

(vl-load-com)
(if (null *grip-reactor*)
   (setq *grip-reactor*
       (vlr-command-reactor "grip-reactor"
          '(
               (:vlr-commandwillstart . grip-reactor-start)
               (:vlr-commandended     . grip-reactor-end)
               (:vlr-commandfailed    . grip-reactor-fail)
               (:vlr-commandcancelled . grip-reactor-fail)
           )
       )
   )
)

(defun grip-reactor-start ( reactor params / en in ss )
   (if
       (and
           (wcmatch (strcase (car params)) "*GRIP_STRETCH")
           (setq ss (cadr (ssgetfirst)))
       )
       (progn
           (setq in -1)
           (while
               (and
                   (null *willregen*)
                   (setq en (ssname ss (setq in (1+ in))))
               )
               (setq *willregen*
                   (and
                       (eq "LWPOLYLINE" (cdr (assoc 0 (setq en (entget en)))))
                       (eq "A-AREA" (strcase (cdr (assoc 8 en))))
                   )
               )
           )
       )
   )
   (princ)
)

(defun grip-reactor-end ( reactor params )
   (if
       (and
           (wcmatch (strcase (car params)) "*GRIP_STRETCH")
           *willregen*
       )
       (progn
           (vla-regen
               (setq *acdoc*
                   (cond
                       (*acdoc*)
                       ((vla-get-activedocument (vlax-get-acad-object)))
                   )
               )
               acactiveviewport
           )
           (setq *willregen* nil)
       )
   )
   (princ)
)

(defun grip-reactor-fail ( reactor params )
   (if *willregen*
       (setq *willregen* nil)
   )
   (princ)
)

Posted

Out of curiosity, why do you need to regen if you grip edit LWPolylines on a particular layer?

Posted

We have a Room Tag Block w/ a square footage field linked to a polyline. So everytime we remodel a area and update are databases we modify that pline and if you do a regen it updates that field. So instead of regen everytime we do a grip_stretch it will only react we modifing a pline on a that layer. I hope that make sence. Thanks

Posted
We have a Room Tag Block w/ a square footage field linked to a polyline. So everytime we remodel a area and update are databases we modify that pline and if you do a regen it updates that field. So instead of regen everytime we do a grip_stretch it will only react we modifing a pline on a that layer. I hope that make sence. Thanks

Clear as mud. Fantastic idea.

Posted

Hey Lee, This seems to work. Thanks for your help. Now I just need to digest it. Thanks

Posted
Hey Lee, This seems to work. Thanks for your help. Now I just need to digest it. Thanks

 

Good stuff, shout if you have questions :thumbsup:

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