Converter.cs 930 B

12345678910111213141516171819202122232425262728293031
  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. public static XYZ ConvertToXYZ(Autodesk.Revit.DB.XYZ xyz)
  24. {
  25. return new XYZ() {X = Round(xyz.X.FromApi()), Y = Round(xyz.Y.FromApi()), Z = Round(xyz.Z.FromApi()),};
  26. }
  27. }
  28. }