Shaft boundaries

For those looking for the solution to this problem i solved it with the code below.
the clue is in the fact that u don’t need to use BoudanryCurves (wich sounds logical) but the SketchId.
Then retrieve the profile from the sketch.

this code was for testing purposes in dynamo but also aplies in python(pyrevit):

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

link = IN[0]

shafts = FilteredElementCollector(link).OfCategory(BuiltInCategory.OST_ShaftOpening).ToElements()
# Place your code below this line
shaft_curves =[]

for shaft in shafts:
    sketch = link.GetElement(shaft.SketchId)
    profile = sketch.Profile
    curves = []
    for profile_curve in profile:
        for curve in profile_curve:
            curves.append(curve.ToProtoType())
    shaft_curves.append(curves)
 
# Assign your output to the OUT variable.
OUT = shaft_curves
2 Likes