Regen after Visibility change?

Regen after Visibility change?

Anonymous
Not applicable
1,405 Views
3 Replies
Message 1 of 4

Regen after Visibility change?

Anonymous
Not applicable

Hello, I just recently find out about lisps and I am looking for one that would Regen after block changes as this one after using grip stretch, but I would like that it would Regen as well after visibility changes too. :


(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)

0 Likes
1,406 Views
3 Replies
Replies (3)
Message 2 of 4

dennis
Advisor
Advisor

Add this to your LSP routines.  Then call it after the changes.

(defun c:lspRegenAll()(allRegen))  ;;;  this one can be entered at the command line

 

(defun allRegen () (vl-load-com) (setq mydwg (vla-get-activedocument (vlax-get-acad-object))) (vla-Regen mydwg acAllViewports) (princ) )

0 Likes
Message 3 of 4

dennis
Advisor
Advisor

Wait....I miss read.

If you remove the condition (equal params '("GRIP_STRETCH") from it completely, then any change will call the 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
;;;)
;;;)
)

0 Likes
Message 4 of 4

Ranjit_Singh
Advisor
Advisor

I assume you mean dynamic block visibility state. I see you are using reactors to automate regen when any stretch command is called. You can try replacing

( (equal params '("GRIP_STRETCH"))

with

 

( (equal params (or '("GRIP_POPUP") '("GRIP_STRETCH")))

 Use the visibility state popup-menu (which is available once you select a dynamic block) for the above line of code to work. However, note that just as grip_stretch will get fired every time you use a hot grip (not only when u manipulate dynamic block using grip), grip_popup will get fired every time you use a pop-up menu from grip (not only for dynamic block but any entity). Moreover, if you change the visibility state using the properties window then the grip_popup does not get fired and you won't see any viewports regenerate.

 

 

Best way to accomplish what you are doing is to use an object reactor for your block. See Autodesk help for reactors. But, if you have no LISP programming experience I will not make any changes except what I pointed out in the above code window. Or even simple, just call the regen command.

0 Likes