WinForms: Button EventHandler for GetObject

I spent all day methodically piecing code together to make a valid attempt at a user interface for a simple script that pipes surface normals. I’m stuck trying to “GetObject” by pressing a button. I scoured the forums and the internet for possibilities and made some valiant attempts with no luck (limited skill). Any help would be appreciated.

Draw Surface Normals (with GUI interface) 08.py (8.8 KB)

1 Like

Steve,

One way is to hide the modal form before requiring user input in Rhino’s main window:
Draw Surface Normals (with GUI interface) 08_2.py (9.1 KB)

Steve

1 Like

Hi @stevefuchs,

in case of a modal form, there is [Rhino.UI.Dialogs.PushPickButton] (http://developer.rhino3d.com/api/RhinoCommonWin/html/M_Rhino_UI_Dialogs_PushPickButton.htm) which allows to pick an object and return to the modal state of the dialog.

You might also consider using Rhino.UI.Dialogs.Dialogs.ShowSemiModal to still display your dialog as modal but allow interaction with Rhino. Compared to form.ShowDialog() it does have a return value.

c.

1 Like