GetAnalyticalModelSupports() how to use this?

GetAnalyticalModelSupports() how to use this?

Anonymous
Not applicable
959 Views
5 Replies
Message 1 of 6

GetAnalyticalModelSupports() how to use this?

Anonymous
Not applicable

I'm trying to see if it is possible to get connected framing elements through the api. My end goal is to be able select a beam and be able to retrieve the elementId of the elements the 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 this post: http://thebuildingcoder.typepad.com/blog/2011/01/finding-connected-structural-elements.html. But I'm confused on the actual implementation of it. Has anybody come across a working example of GetAnalyticalModelSupports(). I'm not sure if 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.

0 Likes
Accepted solutions (1)
960 Views
5 Replies
Replies (5)
Message 2 of 6

JimJia
Alumni
Alumni

Dear jp2982,

 

You may try to following two API as well:

/// <summary>
/// Returns all elements joined to given element.
/// </summary>
ICollection<ElementId> JoinGeometryUtils.GetJoinedElements(Document document, Element element)
/// <summary>Get all elements joining to the end of this element's location curve or change the order of elements participation in the end join with this location curve's end.</summary>

/// <param name="end">The end at which the join occurs.</param>
/// <remarks>The list of elements is expected to be a permutation of the elements already in the join at the end.
/// It is expected that no new elements will be introduced, and existing ones will not be removed.</remarks>
ElementArray LocationCurve.ElementsAtJoin(int end)

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 3 of 6

Anonymous
Not applicable

Thanks for the reply. I tried to follow through with this, but structural member in Revit aren't joined the same way solid members are. This approach on beams just gives back nulls. 

 

I know when you tab through beams it will select all connected beams. So I'm assuming there is some form of internal property holding the neighbor values.

 

also bump, please help

0 Likes
Message 4 of 6

dragos.turmac
Autodesk
Autodesk
Accepted solution

Hi @Anonymous,

 

Does this snippet below works/answers your question?

 

                   AnalyticalModel model3D =
                       aWallFoundation.GetAnalyticalModel() as AnalyticalModel;
                   if (null == model3D)
                       continue;
                   IList<AnalyticalModelSupport> supportList = new List<AnalyticalModelSupport>();
                   supportList = model3D.GetAnalyticalModelSupports();
                   List<ElementId> supportingElements = new List<ElementId>();
                   foreach (AnalyticalModelSupport model in supportList)
                        supportingElements.Add(model.GetSupportingElement());


Turmac Dragos
Pr. SW. Engineer
Message 5 of 6

Anonymous
Not applicable

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 anyway to programmatically get the connected beams similar to how tab behavior works, I would still be interested to learn how.

0 Likes
Message 6 of 6

jeremytammik
Autodesk
Autodesk

Congratulations on solving the issue and getting it to work!

 

Would you mind sharing a code snippet or two illustrating the most important points?

 

I would like to share the basics of making use of GetAnalyticalModelSupports on The Building Coder, since you pointed out the lack of available information, and a code snippet or two showing it in action would be a tremendous help.

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes