Trigger Rhino selection event without changing the selection

Hi,

I have custom realtime displaymode that utilize a render engine which is partly controlled in Grasshopper. Some of the render settings for this displaymode are exposed in an object properties panel which shows up when a viewport with the specific displaymode is selected.

Now when the render engine becomes invalid (turned off in grasshopper) the render class in the displaymode triggers and internal close event which sets the displaymode for this view back to wireframe.

        private void CloseDisplaymode()
        {
            foreach (var view in Rhino.RhinoDoc.ActiveDoc.Views.GetStandardRhinoViews())
            {
                if (view.ActiveViewport.DisplayMode.EnglishName == "Cyclops")
                {
                    view.ActiveViewport.DisplayMode = Rhino.Display.DisplayModeDescription.FindByName("Wireframe");
                }
            }
        }

This works nicely as it subsequently calls ShutdownRenderer() and closes the displaymode in the same way as if it was closed through a normal displaymode change in the viewport.

So now to my problem, this does not trigger a selection list change event the same way as when I change the display mode manually in the viewport. Which means that the object properties panels are not redrawn and my settings panel for this displaymode stays open (until I select something new).

So my question is how to trigger this event without actually changing the selection.

1 Like

Hi @oborgstrom,

Perhaps your CloseDisplaymode code should just call ObjectTable.UnselectAll?

– Dale

Hi @dale,

Thanks for your answer.

This does indeed trigger a selection changed event, but only if an object is actually selected as the function is called. I guess otherwise there is no change to the selection list and therefore the event is not triggered.

It’s also a bit counter intuitive since you’re suddenly losing your selection.

Something happens when I manually change the displaymode that triggers the event without actually changing the selection. Would it be possible to call the same functionality here?

Thanks
Oscar

No, sorry.

– Dale