End while(true) loop with right mouse click

Inside a while(true) loop i use GetOption to change a set of parameters an create a set of breps. The loop runs until the breps are the way i want them. Right now an EscapeKeyEvent is used to exit the loop.
I want to use a right mouse click to exit the loop.
So fare i suspect that the GetOption is controlling the mouse events, but i dont get it to work.
Is it the if(go.Command.Result…) line that should do the trick?

Please post your code, otherwise it is difficult to help.

I’ll say one thing though:

A right-click in a Rhino command is interpreted as an Enter key press, and that gets reported to GetObject.Get... as the GetResult.Nothing result. To use this you first need to call go.AcceptNothing(true) on the GetOption object.

GetOption go = new GetOption();
  GetResult res = go.Get();
  if (res == GetResult.Nothing) break;

This is it! :slight_smile: Thank you!

1 Like