Retrieving SectionBox Parameters with Python

Hi,

I can’t find any parameters associated with section boxes in the Revit API. Simply, I want to convert a section box into a bounding box and retrieve the bounding box parameters if these are not available as parameters from a section box.

I assumed a section box was essentially a bounding box in the first place; however, I don’t think this is the case.

Thank you. BTW this script works for getting the parameters of any category that has parameters, just returns none for section box.

# Enable Python support and load DesignScript library
import clr

# wrapping and unwrapping Revit Elements
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

sectionBoxCat = UnwrapElement(IN[0])
output = []

# assign current document
doc = DocumentManager.Instance.CurrentDBDocument

# filter for sectionBox
collector = FilteredElementCollector(doc, doc.ActiveView.Id)
#filter = ElementCategoryFilter(BuiltInCategory.OST_SectionBox)
sectionBox = collector.OfCategoryId(sectionBoxCat.Id).FirstElement()

parameters = sectionBox.GetOrderedParameters()

for item in parameters:
output.append(item.Definition.Name)
#output.append(parameter.Definition.BuiltInParameter)

OUT = output

Hi @ebroberg

Agreed not much in there:

What parameters are you looking to retrieve?

Are you looking to get Bounding Box GetSectionBox Method ?

From this post, it looks like the sectionbox info is a parameter set of the view, not separate. I know this is C#, but may give you insight on what your looking for. Note it has to be done in a 3D view with the SectionBox actively applied.
https://forums.autodesk.com/t5/revit-api-forum/how-get-coordinates-of-section-box/td-p/7715530

Thanks for the responses.
@SeanP - I think it should be relatively straightforward to convert this C# example to python. I’ll post my progress. Hope it works.

Thanks again.

@Kulkul - the link you provided seems to offer a way to get the section box’s ‘bounding box’ coordinates. I am just unclear as to the documentation (I am looking VS)

It seems that the bounding box is required as an input. Maybe I am reading this wrong. My goal is to get the bounding box from the section box to decompose the faces.

thanks!

Maybe this is useful?

1 Like

@Mark.Ackerley - this is very useful. Thanks! I appreciate the help.

1 Like