Files

31 lines
801 B
C#
Raw Permalink Normal View History

2025-09-16 16:06:41 +08:00

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