How to determine the space which an element belongs to?

Spacial position of an element isn’t something obvious and out-of-the-box in Dynamo, although it is a very important property.

There is a node in LunchBox for all elements in rooms, how to transform it into “elements in MEP spaces”?

Or even better, how to query the space which an element belongs to?

Hi Nikolay,

Not sure if there are a more simple way of doing this, but here is one soloution that would work.






Thank you, Sylvester, I thought about this approach: trying to guess by creating all possible combinations, but it is very time consuming on real projects.

Somehow Revit itself knows spacial position of each element (schedules can be created very fast), so I think there is a native way…

Sure - there’s code in the API for finding out in which Space or Room an element resides, it’s a property on a FamilyInstance if you read the SDK help document. The only issue if that you also need to provide which Phase you’re interested in.

You can do something like this:

2015-08-05 14-07-03

And if you would like to do the same on many elements - some will not be FamilyInstances, some will not be in a Space - so YMMV:

2015-08-05 15-05-40

Hi I tried this code band works :slight_smile:

How should we modify code that in case there is no space there will be null and no skip like now…I need script that will keep right lengtht of my list so can later on bring parameters…now when element is place and there is no space my list is shorted and this causing me issues, thanks a lot Michal

Rhythm has an node that should do this.

I just checked Rhythm 2015.10.7 and could not find any space node there I can see only Element.Room ?

OK i found this in Rhytm 2016.2.8 thanks a lot

I have almost everything working one issue remaining when I extract instant parameters value from link model everything works OK but when I try to extract type paramter it does not work?

How to get type parameters?



try: linked elements -> getParameter(Family) ->GetParameter(Voltage)

Hi Tomasz,

I am not sure what you mean by getParameter(Family) here? to type family name in component Element.GetParameterValueByName?.. I have many families under LightingFixture category…