There are two commands “C1” & “C2”. The two commands inherits from CRhinoScriptCommand. I run C1 command and run C2 command when C1 still running. How can I end command C1 before running C2?
There is no problem when the two commands inherits from CRhinoCommand. How to do when commands inherited from CRhinoScriptCommand?
When you press the Esc key while a CRhinoScriptCommand command is running, only the currently running scripted command is canceled, not the entire command.
The workaround for this is for you plug-in to have a CRhinoEventWatcher object that overrides OnEndCommand(). When commands are ended, cache the CRhinoCommand::result code returned by the command. Then, check this code after calling RhinoApp().RunScript() to see if your command should continue.
I want to enforce end C1 when C2 is beginning. I overrides ONBeginCommand(). When C2 is beginning, program cache the event and enforce end C1. Is is right?
Command 1 and command 2 are not called in the same RunCommand()…I do not know when command 1 or command 2 begin running.
I use CRhinoEventWatcher:: OnBeginCommand() to cache the event. If the last command is still running, I will stop the last command. I do not know how to end command.(use what function?)
See the sample code: