Ho to focus rhino and select object like grasshopper set geometry

-Rhinocommon, -C#,

Hi, I’m new to Rhino Developing.
How to select and get geometry from a windows-form button-click? The form takes RhinoDoc as an argument.
-public MainForm(RhinoDoc rd)

I want to implement interactive-user-operation like grasshopper’s “set one geometry”.

Thanks

Hi @akitohotta3,

If you are using WinForms, then you might peek in the Rhino Developer samples repository on GitHub, as there are a couple of WinForms samples that might be help. In particular is the the PickButton_Click member on this model form.

SampleCsModalForm.cs

– Dale

@dale Thank you so much. your advice helped me a lot.
Can I ask:
I’ve put the form on new thread in command.cs and “Rhino.Input.RhinoGet.GetPoint” in the form didn’t work correctly. Maybe it is basic question of threading, but can I know why/where I can know why?
it was like:

protected override Result RunCommand(RhinoDoc doc, RunMode mode){
Thread thread = new Thread(new ThreadStart(() =>{
string receiveText = MainForm.ShowMainForm(doc); //MainForm

Why? What problem does this solve?

– Dale

Dale, no, sorry my words were not enough. I meant:
by showing the form on new thread, “Rhino.Input.RhinoGet.GetPoint” command from the form didn’t work.
By showing the form without using thread, the command worked.

Hi - assuming that I’m reading this right, Dale’s question is why are you trying to put it on a new thread. Especially so if it works fine on the same thread.
-wim

1 Like

Wim, Dale,
It was just to keep rhino controllable during huge amount of calculation on the form. And I found it is not necessary to put the form itself on a new thread, so It is ok now. But I couldn’t find why the command didn’t work.