ParseUnit.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 JUnit=JBIM.Component.Unit;
  15. namespace RevitToJBim.ComponentParse
  16. {
  17. /// <summary>
  18. /// ParseUnit
  19. /// </summary>
  20. [UsableParseAttribute]
  21. class ParseUnit : ParseBase
  22. {
  23. public override List<string> FastIndex()
  24. {
  25. return new List<string>() { typeof(FormatOptions).FullName };
  26. }
  27. public override bool Match(ElementWrapper wrapper)
  28. {
  29. return wrapper.RefObject is FormatOptions;
  30. }
  31. protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
  32. {
  33. var options= wrapper.RefObject as FormatOptions;
  34. if (options == null)
  35. {
  36. return null;
  37. }
  38. JUnit jObject = new JUnit();
  39. jObject.Name = "Length";
  40. jObject.Tag = "长度单位";
  41. jObject.Value = options.DisplayUnits.ToString();
  42. context.AddBimObject(jObject);
  43. return new List<BimId>(){jObject.Id};
  44. }
  45. }
  46. }