Converter.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 JBIM.Definition;
  14. using SAGA.RevitUtils.Extends;
  15. namespace RevitToJBim.Common
  16. {
  17. public static class BimConvert
  18. {
  19. public static readonly int CoordinateDecimalDigits = 2;
  20. public static double Round(double coordinateDecimal)
  21. {
  22. return Math.Round(coordinateDecimal, CoordinateDecimalDigits);
  23. }
  24. /// <summary>
  25. /// 英尺转换成现在阶段使用单位
  26. /// </summary>
  27. /// <param name="footValue"></param>
  28. /// <returns></returns>
  29. public static double FtToUse(this double footValue)
  30. {
  31. return Round(footValue.FromApi());
  32. }
  33. public static XYZ ConvertToXYZ(Autodesk.Revit.DB.XYZ xyz)
  34. {
  35. return new XYZ() {X = Round(xyz.X.FromApi()), Y = Round(xyz.Y.FromApi()), Z = Round(xyz.Z.FromApi()),};
  36. }
  37. }
  38. }