I highlight yet another thread from the Revit API discussion forum, on how to use GetAnalyticalModelSupports, answered by Dragos Turmac, Autodesk Software Engineer, and with additional usage hints by J. Peele, who also raised the question in the first place:
Question: I'm trying to retrieve connected framing elements through the API.
My end goal is to select a beam and retrieve the element id of the elements its ends are framing into.
I have been able to do this by checking location intersection of all other beams, but this scales by n^2
based on the number of beams for the check.
I read the article on finding connected structural elements, but I'm confused on the actual implementation of it.
Has anybody come across a working example showing how to
call GetAnalyticalModelSupports
?
I'm not sure what objects have this property since they all seem to inherit it. Or am I missing an import?
I'm working in Python. Here is the code so far:
import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * # Import RevitAPI clr.AddReference('RevitAPI') import Autodesk from Autodesk.Revit.DB import * # Import ToDSType(bool) extension method clr.AddReference('RevitNodes') import Revit clr.ImportExtensions(Revit.Elements) from Autodesk.Revit.DB.Structure import * # The inputs to this node will be stored as a list in the IN variables. dataEnteringNode = IN if isinstance(IN[0], list): elements = [UnwrapElement(i) for i in IN[0]] else: elements = [UnwrapElement(IN[0])] AnalyticalEl = [element.GetAnalyticalModel() for element in elements] # Assign your output to the OUT variable. OUT = AnalyticalEl;
Thanks so much for any help you can give.
Answer: Does this snippet work for you and answer your question?
AnalyticalModel model = aWallFoundation.GetAnalyticalModel() as AnalyticalModel; if( null == model ) continue; IList<AnalyticalModelSupport> supports = model.GetAnalyticalModelSupports(); List<ElementId> ids = new List<ElementId>(); foreach( AnalyticalModelSupport m in supports ) { ids.Add( m.GetSupportingElement() ); }
Response: Finally got it working yesterday.
This code does the trick, though the problem was a conceptual oversight on my part.
I was imagining the supports would be similar to what pressing tab on a beam element does; however, it seems the supports are actually the members involved in the gravity load path.
More importantly, the analytical supports will be null if Revit has 'Automatic Member Supports' turned off (as it should be, Revit is unusably slow on large projects with it on).
I had to run a manual support check before anything would show up.
Hope this helps anyone having similar issue to what I ran into. Also, if there is any way to programmatically get the connected beams similar to how tab behaviour works, I would still be interested to learn how.
Many thanks to Dragos and J. for raising and solving this issue!