Reactor to Grip_strectch and L
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)
) 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)) Out of curiosity, why do you need to regen if you grip edit LWPolylines on a particular layer? 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. Hey Lee, This seems to work. Thanks for your help. Now I just need to digest it. Thanks Please read the CODE POSTING GUIDELINES and edit your post.
Good stuff, shout if you have questions
页:
[1]