Couple of things....
First, you seem to be missing a close quote here:
Your logic is sound, in that you're wanting the changes made to DwgProps to be reflected when you're done making changes. Where you've overlooked one option for accomplishing this is by not having a bit more experience - Don't worry, you'll get there.
When you consider that you're wanting to consistently perform a supplementary action following a specific Command, Undefining, and Redefining is one way to go about it. Were I to do this (and I may now add this to my setup, so for that I thank you for asking the question), I would employ a simple Command Reactor.
By using a Visual LISP Command Reactor, we can preclude the need to undefine a Command (in this case DwgProps), and instead simply monitor for the CommandEnded event (in lieu of CommandWillStart, CommandCancelled, etc.), as only when the DwgProps Command has successfully ended do we want our supplementary action to take place (in this case a regen).
Another advantage of using Visual LISP in this case is that we can regen the viewports without using another Command, as this has been exposed to the ActiveX API.
What does all of this look like?
Simple; to test load this psuedo-code:
** Note - Be sure to NOT have the DwgProps Command undefined.Code:(vl-load-com) (defun DwgPropsCommandReactor:Start () (or *DwgPropsCommandReactor* (setq *DwgPropsCommandReactor* (vlr-command-reactor "DwgPropsCommandReactor" '( (:vlr-commandended . DwgPropsCallback:CommandEnded) ) ) ) ) (prompt "\n >> DwgProps command reactor loaded ") (princ) ) (defun DwgPropsCallback:CommandEnded (rea cmd) (if (wcmatch (strcase (car cmd)) "DWGPROPS") (vla-regen (vla-get-activedocument (vlax-get-acad-object)) acAllViewports ) ) ) (defun c:StopR () (if *DwgPropsCommandReactor* (progn (vlr-remove *DwgPropsCommandReactor*) (setq *DwgPropsCommandReactor* nil) (prompt "\n** DwgProps command reactor stopped ** ") ) ) (princ) ) (DwgPropsCommandReactor:Start)
** Edit to add - I've also included a "STOPR" command so that if you'd like to turn this reactor of, you may.
HTH




Reply With Quote



Bookmarks