using Autodesk.Revit.DB; using Autodesk.Revit.UI.Selection; using System; namespace Szmedi.Toolkit.RvAssists { public class FuncFilter : ISelectionFilter { public FuncFilter(Func funcElement, Func funcReference = null) { this.funcElement = funcElement; this.funcReference = funcReference; } private readonly Func funcElement; private readonly Func funcReference; public bool AllowElement(Element elem) { return funcElement(elem); } public bool AllowReference(Reference reference, XYZ position) { return funcReference == null || funcReference(reference, position); } } }