Obtain Parent Geometric model from Analytical Element

Hi Guys,

I am trying to obtain the “parent” geometric element ID for an analytical element. Being inexperienced with programing I have written a simple Python Script that returns the element ID. But what I want to do to obtain the parent element ID.

When I “snoop” an analytical element I can’t find a parameter that links back to the element ID back to the geometric element.

When I snoop the geometric element I can find a link to the Analytical element ID. Any way of going back the other way?

Python Code

import clr
clr.AddReference(‘RevitAPI’)
clr.AddReference(‘RevitAPIUI’)
from Autodesk.Revit.DB import *
import Autodesk
#@jbenoit44
analytics = IN[0]
hostid = list()
for item in analytics:
_ try:_
_ hostid.append(item.Id)_
_ except:_
_ hostid.append(list())_
OUT = hostid

Thanks for your help

Brett

Try this. This code will get the element that the Analytical Line is hosted to.

In the Revit SDK there is a .chm file called Revit 2015 API (or whatever version you are using). In there you can type in AnalyticalModel Methods, in this you can review the methods that operate on the analytical model elements, you can see in the code i wrote above that there is a method “GetElementId” which “Retrieves Element Id of the structural element corresponding to the Analytical Model.”. I believe this is what you are after.

Thanks Daniel, that worked a treat