ConnectorSearchOptions.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Autodesk.Revit.DB;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace FWindSoft.Revit
  8. {
  9. public class ConnectorSearchOptions
  10. {
  11. /// <summary>
  12. /// 允许元素限定
  13. /// </summary>
  14. public Predicate<Element> AllowElement { get; set; }
  15. /// <summary>
  16. /// 允许连接件限定
  17. /// </summary>
  18. public Predicate<Connector> AllowConnector { get; set; }
  19. /// <summary>
  20. /// Connector可用判定
  21. /// </summary>
  22. /// <param name="connector"></param>
  23. /// <returns></returns>
  24. public bool ConnectorUsable(Connector connector)
  25. {
  26. return AllowConnector == null || AllowConnector(connector);
  27. }
  28. /// <summary>
  29. /// 元素可用判定
  30. /// </summary>
  31. /// <param name="connector"></param>
  32. /// <returns></returns>
  33. public bool ElementUsable(Element element)
  34. {
  35. return AllowElement == null || AllowElement(element);
  36. }
  37. }
  38. }