qin
2024-09-28 e358beb08f5be49703009b64f058ecfbcfeefbd9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Autodesk.Revit.DB;
using HStation.RevitDev.RevitDataExport.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace HStation.RevitDev.RevitDataExport.Utility
{
    internal static class BoundingBoxHelper
    {
        public static string BoundingBoxSerialize(this BoundingBoxXYZ bbox)
        {
            var box = new Box
            {
                min = new Point { x = bbox.Min.X * 304.8 / 1000, y = bbox.Min.Y * 304.8 / 1000, z = bbox.Min.Z * 304.8 / 1000 },
                max = new Point { x = bbox.Max.X * 304.8 / 1000, y = bbox.Max.Y * 304.8 / 1000, z = bbox.Max.Z * 304.8 / 1000 }
            };
            var strBox = JsonHelper.ToJson(box);
            return strBox;
        }
    }
 
    /// <summary>
    /// "min":{"x":38.66255950927734,"y":62.70765773109019,"z":99.20000457766155},"max":{"x":39.418655395507805,"y":62.87425526329459,"z":101.039993286108}}
    /// </summary>
    public class Box
    {
        public Point min { get; set; }
        public Point max { get; set; }
    }
 
    public class Point
    {
        public double x { get; set; }
        public double y { get; set; }
        public double z { get; set; }
    }
}