RevitModelPath.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using SAGA.MBI.DataArrange;
  7. using SAGA.MBI.Model;
  8. namespace SAGA.GplotRelationComputerManage
  9. {
  10. public class RevitModelPath
  11. {
  12. private static List<string> FilePaths = new List<string>();
  13. /// <summary>
  14. /// 获取所有Revit文件信息(目录结构:根目录+proId+proName+builtingName)
  15. /// </summary>
  16. /// <returns></returns>
  17. public static List<string> GetAllRevitFiles()
  18. {
  19. if (FilePaths.Count == 0)
  20. {
  21. List<string> files = new List<string>();
  22. var projectFloors = DalModeFileManange.GetMissFileFloors(false);
  23. projectFloors.ForEach((tni) => GetFilePaths(tni, files));
  24. files.Reverse();
  25. FilePaths = new List<string>(files);
  26. }
  27. return FilePaths;
  28. }
  29. /// <summary>
  30. /// 获取所有楼层信息
  31. /// </summary>
  32. /// <param name="tni"></param>
  33. /// <param name="files"></param>
  34. private static void GetFilePaths(TreeNodeItem tni, List<string> files)
  35. {
  36. if (tni.Item is MFloor floor)
  37. {
  38. files.Add(floor.FullPath);
  39. }
  40. else
  41. {
  42. foreach (TreeNodeItem t in tni.Children)
  43. {
  44. GetFilePaths(t, files);
  45. }
  46. }
  47. }
  48. }
  49. }