Clear Last Command

Hey, I am working on a plugin and am having an issue with the commands not clearing when another command is started.

Let’s say I made the plugin with 2 buttons. One Join Curves, and one is Delete. If I click Delete, then click Join, then hit Esc. Delete pops back up in the Command line. If I clicked Join 10 times, I would have to Esc. 10 times to get out out the command.

How do I cancel the previous call when I click another button? This doesn’t seem to be an issue except in my plugin, but I don’t see what I need to do.

Thanks for the help,

It seems like when I press the button the function Join or Delete gets called each time. That call does not complete, so every time a new button is pressed the function is called again and the previous one is still not complete. When I cancel the current command, I am then showed the last command that hasn’t completed.

I am assuming that there should be a way to cancel the function that I am currently in when I start a new one, but I don’t know how that would work.


Yes it is a lack in the rhinocommon API.

Currently, I’m using Rhino.RhinoApp.RunScript ("! [Your command name]", false); where the character ‘!’ stop previous commands.


Thanks for the reply.

I am trying to figure out how I could use this. I guess my problem may be that I am not really running a command when I hit the button. I run a command that opens the UI which has buttons.

The button will use GetObject or whatever. That GetObject command is the one that is persistent. I’m not sure what to put in the [Your command name] to stop the previous command.

Any command.

Or you can juste run Rhino.RhinoApp.RunScript ("!", false); then execute your GetObject.

1 Like

Cool, I will try that out.


Sorry, I had to take the solution away. Rhino.RhinoApp.RunScript ("!", false); causes a couple of strange things.
For some reason my buttons only work every other time it’s pressed. I can’t think of why the GetObject command won’t run right after the RunScript when a previous command was running. It does quit the previous command, but it doesn’t let the next one run.

test RhinoApp.Wait () after RunScript

1 Like

Thanks! That fixed the problem.