Get a Bounding Box from a Section Box


Is there a way to get a bounding box from a section box in a 3D view?

I know that it is possible to go the other way around but I am having difficulty getting a bounding box. I want to be able to take an existing 3D view, duplicate it, and change the scope box of the new view.

The only way I can think do do this is to get a bounding box from an existing 3D view, modify it, and use View3D.SetSectionBox with a duplicated new view.

I’m really stuck here DynaFam, any help is appreciated.

Edit: I’ll be looking further into this, looks like it could have what I’m looking for.

I’ll be sure to post a clear solution for this problem when I find it.

1 Like


@dancleary can you post what you have done so far?



I can and I will tomorrow when I’m in the office.

The problem is I haven’t gotten anywhere. I’ve been trying to use existing nodes to accomplish this task but none seem to exist. The next step is to start looking into the API to see if I can come up with a python script to put in. I figured I’d see if the community knows about a node before I go down that road.



If you go the API route, the command on a 3d view is called .GetSectionBox() and returns a bounding box. This should be what you are asking for.

Keep in mind though that bounding boxes do not save orientation, they are always the same orientation. So if your scope box or sectionbox has been rotated, it won’t be kept over. If that is important, .GetCropRegionShapeManager() might work, but I haven’t tested it.

1 Like


@awilliams python code from her own solution HERE works for what I am trying to accomplish.

import clr
from Autodesk.DesignScript.Geometry import *

import Revit

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

from System.Collections.Generic import *

import Autodesk
from Autodesk.Revit.DB import *


doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

views = UnwrapElement(IN[0])


viewlist = []
sectionboxes = []
floors = []
floorboxes = []

for view in views:
	sectionbox = view.GetSectionBox()
	transform = sectionbox.Transform
	sboxoriginx = transform.Origin.X
	sboxoriginy = transform.Origin.Y
	sboxoriginz = transform.Origin.Z
	minx = sectionbox.Min.X + sboxoriginx
	maxx = sectionbox.Max.X + sboxoriginx
	miny = sectionbox.Min.Y + sboxoriginy
	maxy = sectionbox.Max.Y + sboxoriginy
	minz = sectionbox.Min.Z + sboxoriginz
	maxz = sectionbox.Max.Z + sboxoriginz
	bbox = BoundingBoxXYZ()
	bbox.Min = XYZ((minx), (miny), (minz))
	bbox.Max = XYZ((maxx), (maxy), (maxz))
	tsectionbox = bbox.ToProtoType()
	collector = FilteredElementCollector(doc, view.Id)
	floor = collector.OfClass(Floor).ToElements()


OUT = views, sectionboxes, floors

The python code only takes in a list so single views will not work. What I did is create a list of the same view and pull out one of the boundary boxes from the output. Its kinda jerry-rigged but it works. If I have extra time I will try to change it to single input, I could definitely could use the python practice.



To make it work for list and single items, you just need a simple if statement that turns single objects into a list containing only the single object. Something like this:

if isinstance(IN[0], list):
    views = UnwrapElement(IN[0])
    views = [UnwrapElement(IN[0])]


It is so cool!