Keep selection with GetObject and command option

Hi,

i’m using the class CRhinoGetObject to interactively select an object. But i also want to provide an command option like it is in the sample

For all objects which are pre selected everything works fine. But when i post select an object and then i change the option, i loose the selection.

Is it possible to keep the selection (regardless if pre or post selected) when i change an option in the command line?

Thanks

Hi @dsw,

Do you know of a Rhino command that works in this manner?

– Dale

Hi @dale

i thought all commands with options have this behavior, but after searching for it i realized they work always in a different way.
But at the other hand if i use this sample and post select some objects and then change the option i do not see any selected objects any more. If i now press enter to finish the command i would assume there are no objects in the list (because nothing is selected anymore). But there are still the objects in the list of the CRhinoGetObject and that is because of the line go.EnableClearObjectsOnEntry(false);.

So it’s only the visual selection missing and it would work as i wanted. In my opinion the command can make the behavior i wanted, it’s just “one line missing” (or something).

Can you try this on your own and share your thoughts about it?

Thanks

Hi @dsw,

Does the attached get close to what you want?

cmdTestWolfgang.cpp (2.4 KB)

– Dale

Hi @dale

sorry, but in my opinion this example does the same as the example in the developer samples repository, doesn’t it?

I’m not sure if you understand what i try to tell you (maybe it’s lost in translation :wink:).
The functionality of the example is ok so far, the only issue is the visual yellow selection of the selected object in the 3D view is missing if it is post selected (at least on my side).
Can you confirm this on your side?

Thanks

@dsw I think you might be after the problem I was facing and got solved in this topic:

Hi @dsw,

This is my understand of what you want to be able to do:

1.) If objects are pre-selected, select those and then allow for post-selection. During post-selection, allow for command options.

2.) If objects are not pre-selected, then allow for post-selection. During post-selection, allow for command options.

I believe this is what the sample does. Where am I confused?

– Dale

Hi @dale

sorry for my late answer.
Yes, you are right so far.

My issue comes afterwards:
3.) make a post selection (you see the object highlighted in the 3d)
4.) change option
5.) ----> the highlight of the selection is lost.
6.) press enter
7.) i assume there is nothing selected (because it was not highlighted), but i get the object selected in point 3.

Can you confirm this also on your side?
Thanks

Hi @dsw,

With the code I posted above, I am not seeing #5:

What am I missing?

– Dale

Hi @dale

you are right. Now I’ve run your code standalone and it works as it should and i expect.

In my code i run this selection not from a standalone command but i run it from a callback in a self created panel. So this is obviously the reason why it does not work in my code.

Sorry for keeping you busy so long.
Thanks anyhow.

Hi @dsw,

Maybe your panel just just run a hidden, test command. Rhino panels do this frequently.

– Dale