ParseLevel.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* ==============================================================================
  2. * 功能描述:ParseLevel
  3. * 创 建 者:Garrett
  4. * 创建日期:2019/6/26 15:16:34
  5. * ==============================================================================*/
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using Autodesk.Revit.DB;
  12. using JBIM;
  13. using RevitExport.Export;
  14. using RevitToJBim.Common;
  15. using SAGA.RevitUtils.Extends;
  16. using JLevel=JBIM.Component.Level;
  17. namespace RevitToJBim.ComponentParse
  18. {
  19. /// <summary>
  20. /// ParseLevel
  21. /// </summary>
  22. [UsableParseAttribute]
  23. class ParseLevel : ParseBase
  24. {
  25. public override List<string> FastIndex()
  26. {
  27. return new List<string>() { typeof(Level).FullName };
  28. }
  29. public override bool Match(ElementWrapper wrapper)
  30. {
  31. return wrapper.RefElement is Level;
  32. }
  33. protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
  34. {
  35. var level = wrapper.RefElement as Level;
  36. if (level == null)
  37. {
  38. return null;
  39. }
  40. JLevel jObject=new JLevel();
  41. //ElementType
  42. ParseCore.AttachObject(jObject,wrapper);
  43. //Name,SourceId
  44. jObject.Name = level.Name;
  45. //Value
  46. jObject.Value = level.Elevation.FtToUse();
  47. //Id
  48. context.AddBimObject(jObject);
  49. return new List<BimId>(){jObject.Id};
  50. }
  51. }
  52. }