FamilyInstanceExtension.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 static class FamilyInstanceExtension
  10. {
  11. /// <summary>
  12. /// 获取FamilyInstance的FamilySymbol
  13. /// </summary>
  14. /// <param name="familyInstance"></param>
  15. /// <returns></returns>
  16. public static FamilySymbol GetFamilySymbol(this FamilyInstance familyInstance)
  17. {
  18. FamilyInstance finst = familyInstance;
  19. if (familyInstance != null)
  20. {
  21. return finst.Symbol;
  22. }
  23. return null;
  24. }
  25. /// <summary>
  26. /// 获取FamilyInstance的Family
  27. /// </summary>
  28. /// <param name="familyInstance"></param>
  29. /// <returns></returns>
  30. public static Family GetFamily(this FamilyInstance familyInstance)
  31. {
  32. FamilyInstance finst = familyInstance;
  33. if (familyInstance != null)
  34. {
  35. return finst.Symbol?.Family;
  36. }
  37. return null;
  38. }
  39. }
  40. }