2025-04-24 20:56:10 +08:00
|
|
|
|
using Autodesk.Revit.DB;
|
|
|
|
|
|
using Autodesk.Revit.UI.Selection;
|
|
|
|
|
|
|
2025-04-24 20:56:44 +08:00
|
|
|
|
namespace ShrlAlgoToolkit.Revit.Assists;
|
2025-04-24 20:56:10 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 任意选择过滤器
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class FuncFilter(Func<Element, bool> allowElement, Func<Reference, XYZ, bool> allowReference = null)
|
|
|
|
|
|
: ISelectionFilter
|
|
|
|
|
|
{
|
|
|
|
|
|
public bool AllowElement(Element elem)
|
|
|
|
|
|
{
|
2025-12-28 11:47:54 +08:00
|
|
|
|
return allowElement(elem);
|
2025-04-24 20:56:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool AllowReference(Reference reference, XYZ position)
|
|
|
|
|
|
{
|
2025-12-28 11:47:54 +08:00
|
|
|
|
return allowReference == null || allowReference(reference, position);
|
2025-04-24 20:56:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|