Is there a way to recognize mouse clicks with Python?

Is there a way in Rhino/Python to allow the use to mouse click in the viewport and return a result?

I notice there is a SendKeystrokes method, but I don’t see “SendMouseClicks” or anything similar.

I’ve got a project that could benefit from the workflow that we experience with WireCut or Boolean2Objects where picking in open space in your model toggles through choices.



I’ve done it through event handling, which is kind of pushing the limit of what “scripting” can do, debugging gets wonky, but it can be done.

There is Rhino.UI.MouseCallback.

Rhino.Input.Custom.GetPoint can also be used to get a viewport point and viewport.

Be sure to disconnect the events when done!

Thanks @JimCarruthers and @nathancoatney.

I’ll see what I can come up with.