Overwriting CustomGeometryFilter to check if current object is selected or deselected

Hi,

is it possible to check if the current object in the virtual function CustomGeometryFilter will be selected or deseleted (e.g. an edge). If not, is there any event action when a edge in the function GetObjects() is selected or deslected. Thanks,

Best Regards,
Michael

In the custom geometry filter method you will get access to the RhinoObject that is being selected. On the object, you can ask the object if it is selected or selectable.

If the componentIndex variable is pointing to a sub object (for example an edge on a Brep) you can ask the object if that sub-object is selected, or selectable.

private bool GeometryFilter(RhinoObject rhobject, GeometryBase geometry, ComponentIndex componentindex)
{
    // normal object selection if type is invalid
    if (componentindex.ComponentIndexType == ComponentIndexType.InvalidType)
    {
        bool checkSubObjectSelection = false;
        bool isSelected = rhobject.IsSelected(checkSubObjectSelection) > 0;
        bool isSelectableSimple = rhobject.IsSelectable();

        bool isAlreadySelected = false;
        bool isSelectableWithGripsOn = true;

        bool isSelectableOnLockedLayer = true;
        bool isSelectableOnHiddenLayer = true;

        bool isSelectableAdvanced = rhobject.IsSelectable(
            isAlreadySelected,
            isSelectableWithGripsOn,
            isSelectableOnLockedLayer,
            isSelectableOnHiddenLayer);

    }
    else // sub object selection if type is not invalid
    {
        bool isSubObjectSelected = rhobject.IsSubObjectSelected(componentindex);
        bool isSubObjectAlreadySelected = false;
        bool isSubObjectSelectable = rhobject.IsSubObjectSelectable(componentindex, isSubObjectAlreadySelected);
    }

    // decide what to do
    return true;
}

Hi menno,

that is exactly what I need. Thank you.

Best Regards,
Michael