brawleyman Posted April 4, 2014 Posted April 4, 2014 I am using HydraCAD on my machine. There is a command called "HCAD_PRETTYPIPES" that creates a thick line between symbols for pipe lines, I think it is a .dll file. I would like to run a command after that one is done running. The command I would like to run afterward is called "refreshdwg" which scales the pipe line width and some other things. I am brand new to reactors and don't really know where to start. Is this even possible? Here is the code I have conjured up, but nothing happens. (vlr-command-reactor nil '((:vlr-commandEnded . endCommand))) (defun endCommand (calling-reactor endcommandInfo / thecommandend) (setq thecommandend endcommandInfo) (if (= thecommandend "HCAD_PRETTYPIPES") (c:refreshdwg)) (princ) );defun Quote
Hippe013 Posted April 4, 2014 Posted April 4, 2014 I use the following code to remind myself how the reactors are working. (vlr-command-reactor nil '((:vlr-commandended . sayit))) (defun sayit (d1 d2) (alert (strcat (vl-princ-to-string d1) " : " (vl-princ-to-string d2))) ) I would first look at whether this above code triggers the alert. Try using a simple command like line. Keep in mind that your "c:refreshdwg" cannot contain certain code. What code that is not accepted is explained in the help file for reactors. Without knowing more about your code (c:refreshdwg) I couldn't tell you why it isn't working. Hope this helps at least a little. regards, Hippe013 Quote
BlackBox Posted April 4, 2014 Posted April 4, 2014 Rule #VLR01246932: In Visual LISP, one cannot call a Command within a Reactor's callback function; however, one can call a LISP function (including those prefixed with c:), so long as said LISP function does not contain a Command call, and generally speaking does not prompt for user input. Note - One can successfully call Commands in .NET event handlers, as a generalization; application / document context must permit such a command being invoked, however. If your Reactor callback function, and the desired LISP function meet that criteria, you'd want to consider registering a CommandEnded event handler if only wanting to react to successfully completed HCAD_PRETTYPIPES command calls, otherwise also include the CommandCancelled, and CommandFailed events. HTH Quote
BIGAL Posted April 4, 2014 Posted April 4, 2014 Maybe a simple 2 line script called by a lisp as a defun (command "script" "prettypies") HCAD_PRETTYPIPES (load "refreshdwg") Quote
Recommended Posts
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.