Converter.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*-------------------------------------------------------------------------
  2. * 功能描述:Converter
  3. * 作者:xulisong
  4. * 创建时间: 2019/6/17 12:01:36
  5. * 版本号:v1.0
  6. * -------------------------------------------------------------------------*/
  7. using JBIM;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using SAGA.RevitUtils.Extends;
  14. namespace RevitToJBim.Common
  15. {
  16. public static class BimConvert
  17. {
  18. public static readonly int CoordinateDecimalDigits = 2;
  19. public static double Round(double coordinateDecimal)
  20. {
  21. return Math.Round(coordinateDecimal, CoordinateDecimalDigits);
  22. }
  23. /// <summary>
  24. /// 英尺转换成现在阶段使用单位
  25. /// </summary>
  26. /// <param name="footValue"></param>
  27. /// <returns></returns>
  28. public static double FtToUse(this double footValue)
  29. {
  30. return Round(footValue.FromApi());
  31. }
  32. public static XYZ ConvertToXYZ(Autodesk.Revit.DB.XYZ xyz)
  33. {
  34. return new XYZ() {X = Round(xyz.X.FromApi()), Y = Round(xyz.Y.FromApi()), Z = Round(xyz.Z.FromApi()),};
  35. }
  36. }
  37. }