ParseUnit.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* ==============================================================================
  2. * 功能描述:ParseUnit
  3. * 创 建 者:Garrett
  4. * 创建日期:2019/6/26 15:15:33
  5. * ==============================================================================*/
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using JBIM;
  12. using RevitExport.Export;
  13. using Autodesk.Revit.DB;
  14. using RevitToJBim.Common;
  15. using JUnit=JBIM.Component.Unit;
  16. namespace RevitToJBim.ComponentParse
  17. {
  18. /// <summary>
  19. /// ParseUnit
  20. /// </summary>
  21. [UsableParseAttribute]
  22. class ParseUnit : ParseBase
  23. {
  24. public override List<string> FastIndex()
  25. {
  26. return new List<string>() { CategoryGenerator.BuildingCategory(Common.FamilyType.Other) };
  27. }
  28. public override bool Match(ElementWrapper wrapper)
  29. {
  30. return wrapper.RefObject is FormatOptions;
  31. }
  32. protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
  33. {
  34. var options= wrapper.RefObject as FormatOptions;
  35. if (options == null)
  36. {
  37. return null;
  38. }
  39. JUnit jObject = new JUnit();
  40. jObject.Name = "Length";
  41. jObject.Tag = "长度单位";
  42. jObject.Value = options.DisplayUnits.ToString();
  43. context.AddBimObject(jObject);
  44. return new List<BimId>(){jObject.Id};
  45. }
  46. }
  47. }