I got two questions here.
- I get the SectionBox in the current view and use this Section Box to create a bounding box. But
the result is that the bounding box location is not the location of the Section Box. What’s the problem? How to fix it? - The max and min XYZ values of section box was diferent with the bounding box I created.Why?
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
from Revit.Elements import *
clr.ImportExtensions(Revit.GeometryConversion)
doc = DocumentManager.Instance.CurrentDBDocument
A_view = doc.ActiveView.ToDSType(True)
av = doc.ActiveView.GetSectionBox()
x = av.Min.X
y = av.Min.Y
z = av.Min.Z
x1 = av.Max.X
y1 = av.Max.Y
z1 = av.Max.Z
bx = BoundingBoxXYZ()
bx.Min = XYZ((x), (y), (z))
bx.Max = XYZ((x1), (y1), (z1))
bbx = bx.ToProtoType()
OUT = [av, x, y, z, x1, y1, z1, bbx]