Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8678

GetObject only one with enter prompt

$
0
0

Hello everyone,

I’m developing rhinocommon with c# WPF

I have a question about selecting object.

My scenario was below.

In my WPF, I added one button in xaml.

When user click button, user can select one mesh object.
And If user want to change selected object, then click button again.
Then, selected Object is highlighted, and user can select other object.
At that time, only one object is highlighted and When user press enter, last highlighted object is selected.

For that scenario, I make a function, but It is not worked like my purpose.
Because when I call Get(), EnablePressEnterWhenDonePrompt is not working

Is there any possible way to get one object with press enter?

public Guid? GetObjectId(Guid? selectedID)
            RhinoDoc.Objects.UnselectAll();
            using (GetObject go = new GetObject { GeometryFilter = ObjectType.Mesh})
            {
                if (selectedID.HasValue)
                {
                    RhinoDoc.Objects.Select(selectedID);
                    go.Get();
                    go.EnablePreSelect(false, true);
                    go.AlreadySelectedObjectSelect = true;
                    go.EnableClearObjectsOnEntry(false);
                    go.DeselectAllBeforePostSelect = false;
                    go.EnableUnselectObjectsOnExit(false);
                }
                go.AcceptEnterWhenDone(true);
                go.AcceptNothing(true);
                go.EnablePressEnterWhenDonePrompt(true);
                return result == GetResult.Cancel ? selectedID : go.Object(0).ObjectId;
            }

Best regards,
Kyungmin

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 8678