MBIDocument.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*-------------------------------------------------------------------------
  2. * 功能描述:MBIDocument
  3. * 作者:xulisong
  4. * 创建时间: 2019/6/28 10:57:07
  5. * 版本号:v1.0
  6. * -------------------------------------------------------------------------*/
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using Autodesk.Revit.DB;
  13. using JBIM;
  14. using SAGA.RevitUtils;
  15. namespace RevitToJBim.MBI
  16. {
  17. /// <summary>
  18. /// 项目传输数据结构
  19. /// </summary>
  20. public class MBIDocument
  21. {
  22. public string MBIName { get; set; }
  23. public string PlanName { get; set; }
  24. public Dictionary<string, List<BimObject>> Elements { get;private set; }
  25. /// <summary>
  26. /// 附加元素Elements信息
  27. /// </summary>
  28. /// <param name="document"></param>
  29. public void AttachElements(BimDocument document)
  30. {
  31. var bimObjects = document.BimObjects;
  32. var group = bimObjects.GroupBy(bim => bim.ElementType);
  33. Dictionary<string, List<BimObject>> dic = new Dictionary<string, List<BimObject>>();
  34. foreach (var collection in group)
  35. {
  36. dic[collection.Key + "s"] = collection.ToList();
  37. }
  38. Elements = dic;
  39. }
  40. public static MBIDocument CreateDocument(Document document)
  41. {
  42. MBIDocument dto = new MBIDocument();
  43. dto.MBIName = "PjXXX_001";//待读取
  44. dto.PlanName = document.GetUseView()?.Name;
  45. return dto;
  46. }
  47. }
  48. }