2027 Interface
Changes 0
I

ISelectionFilter

Description:
An interface that provides the ability to filter objects during a selection operation.
public interface ISelectionFilter
public static IList<Element> GetManyRefByRectangle(UIDocument doc)
{
    ReferenceArray ra = new ReferenceArray();
    ISelectionFilter selFilter = new MassSelectionFilter();
    IList<Element> eList = doc.Selection.PickElementsByRectangle(selFilter, 
        "Select multiple faces") as IList<Element>;
    return eList;
}

public class MassSelectionFilter : ISelectionFilter
{
    public bool AllowElement(Element element)
    {
        if (element.Category.Name == "Mass")
        {
            return true;
        }
        return false;
    }

    public bool AllowReference(Reference refer, XYZ point)
    {
        return false;
    }
}
Name Return Type Description
M AllowElement(Element) Boolean Override this pre-filter method to specify if the element should be permitted to be selected.
M AllowReference(Reference, XYZ) Boolean Override this post-filter method to specify if a reference to a piece of geometry is permitted to be selected.