ParseUnit.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 bool Match(ElementWrapper wrapper)
  25. {
  26. return wrapper.RefObject is FormatOptions;
  27. }
  28. protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
  29. {
  30. var options= wrapper.RefObject as FormatOptions;
  31. if (options == null)
  32. {
  33. return null;
  34. }
  35. JUnit jObject = new JUnit();
  36. jObject.Name = "Length";
  37. jObject.Tag = "长度单位";
  38. jObject.Value = options.DisplayUnits.ToString();
  39. context.AddBimObject(jObject);
  40. return new List<BimId>(){jObject.Id};
  41. }
  42. }
  43. }