Section Box not match bounding box

I got two questions here.

  1. 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?
  2. The max and min XYZ values of section box was diferent with the bounding box I created.Why?


image
image

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]

Hello @A.C

try this (transform of an 3DSectionbox is not null)

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

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
av = doc.ActiveView.GetSectionBox()
tf = av.Transform
pta = tf.OfPoint(av.Min)
ptb = tf.OfPoint(av.Max)
DSbbx = BoundingBox.ByCorners(pta.ToPoint(), ptb.ToPoint())

OUT = DSbbx
3 Likes