SelectionFilterSettings problem

Hi @dale,

i have a command which requires to temporarily enable sub object selection by enabling the SelectionFilterSettings.SubObjectSelect property to True. As soon as i enable my own tmp_settings using:

SelectionFilterSettings.UpdateFromState(tmp_settings)

the Selection Filter panel pops up. I want to control this, preferrably it should not pop up at all. I’m aware that i can close it after my command finished by scripting it:

rs.Command("! _SelectionFilter", False)

but this would close it if a user had it open, either docked or floating before running my command. Is there a way to access this panel and check if it was visible before my command has been started ? Or is there a way to prevent it popping up ?

thanks,
c.

@Trav - is this something you can help with?

This panel’s visibility is tied directly to the filter state and cannot be overridden via RhinoCommon. This is hardwired this way so that a filter state isn’t active without the user knowing why they can’t select something.

Hi @Trav, thank you for your answer. Before i change the Selection Filter to use sub-object (mesh face) selection i store the current panel state using:

SelectionFilterSettings.GetCurrentState()

so i can restore what the user had once my command is done. The problem is, the panel pops up and remains visible if it was not visible before. And if it was visible before, calling the _SelectionFilter command makes it invisible instead of keeping it visible. To sum it up, i don’t know if i need to hide it.

Hm, that makes no sense to me. If i have the Selection Filter panel visible (floating) with these settings:

grafik

i cannot select anything. As soon as i close the Selection Filter panel, without enabling any of those checkboxes, i can select everything. If i open it again, i can select nothing but trying to select, eg. by performing a window selection over a bunch of meshes causes a noticable timeout and the panel blinks to indicate that i have none of these checkboxes checked.

Btw. above image shows how the panel looks like if i have my SelectionFilter set to allow mesh faces like so:

settings = Rhino.ApplicationSettings.SelectionFilterSettings.GetDefaultState()
settings.SubObjectSelect = True
settings.GlobalGeometryFilter = Rhino.DocObjects.ObjectType.MeshFace
Rhino.ApplicationSettings.SelectionFilterSettings.UpdateFromState(settings)

I understand that the behaviour of the panel tries to be smart but using the filters programmatically without leaving the panel’s visibility in a state which was not there before should be possible somehow or ?

_
c.

That’s correct, when the panel closes, the active filter state is disabled. This follows the rule that a filter state cannot be active without the panel being visible. And yes the panel flashes when it thinks the user is trying to select something and the filter state is preventing that selection from happening.

You’re able to set the current filter state to any combo that you want programmatically, you just can’t do it without summoning the panel. You “might” possibly be able to set a few bit flags without awakening the panel if you keep the filters disabled.

You should be able to control the panel visibility state programmatically using something like the example below. I couldn’t find the guid ID of that panel publicly exposed but this it.

        var panel_id = Guid.Parse("918191ca-1105-43f9-a34a-dda4276883c1");
        var is_panel_visible = Panels.IsPanelVisible(panel_id);
        if (is_panel_visible)
        {
          Panels.ClosePanel(panel_id);
        }
        else
        {
          Panels.OpenPanel(panel_id);
        }
1 Like

Thank you @Trav, me too. Where did you find this guid ? Is your guid also valid for Rhino 7 or Rhino 8 only ? I’ve tried this using Python in Rhino 7:

import Rhino
import System

def DoSomething():

    panel_id = System.Guid.Parse("918191ca-1105-43f9-a34a-dda4276883c1")
    is_panel_visible = Rhino.UI.Panels.IsPanelVisible(panel_id)
    print is_panel_visible
    
if __name__=="__main__":
    DoSomething()

but it doesn’t get the visibility state.

SelectionFilterPanel

It seems to work in Rhino 8 though:

SelectionFilterPanelRhino8

_
c.

Sorry I see now that you tagged this post both 7 and python I came here via Dales @ mention and didn’t realize lol.

Unfortunately that won’t work in v7

In v7 the selection filter interface is written based on MFC and was also a Windows only DockBar which is a part of RhinoWindows.dll and not a part of RhinoCommon. For v8 we’ve rewritten both. SelectionFilters is now an ETO based Rhino Panel (I gave you the id from its source code) and DockBars are now a part of RhinoCommon.

1 Like

Hi @Trav, thank you for the explanation. I think soon we’re all using Rhino 8 so your solution then works. In Rhino 7 i’ll just toggle it using Rhino.Command.

_
c.

1 Like