31 lines
801 B
C#
31 lines
801 B
C#
|
|
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);
|
|
}
|
|
}
|
|
} |