Get room bounding elements from linked models

Hi one and all,

I am trying to get the room bounding elements and their parameter values in the linked models. I have an architecture model with rooms, but few room bounding elements are in the linked model.

Model - architecture with rooms
model linked - facade with elements such as windows which act as room boundary
model linked - shell and core which again has room bounding elements

I am trying to extract room bounding elements and their parameter values in linked models.
My research online led me to some scripts which I have tried using, but my efforts have proven futile. Is it possible to get room bounding elements and their parameter values using dynamo?

Hi,

try the python code below. Input is a list of rooms. Output is bounding elements, regardless if they are from current or linked doc.

import clr

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
import RevitServices

from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

#The inputs to this node will be stored as a list in the IN variables.
rooms = UnwrapElement(IN[0])

options = SpatialElementBoundaryOptions()
options.SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Finish

output = []

for r in rooms:
	segments = r.GetBoundarySegments(options)
	boundaries = []
	for sl in segments:
		for s in sl:
			#boundaries.append([s.ElementId,s.LinkElementId])
			e = doc.GetElement(s.ElementId)
			if isinstance(e,RevitLinkInstance):
				linkDoc = e.GetLinkDocument()
				linkElement = linkDoc.GetElement(s.LinkElementId)
				boundaries.append(linkElement)
			else:
				boundaries.append(e)
	output.append(boundaries)

#Assign your output to the OUT variable.
OUT = output

4 Likes

Hi Maciek, thanks a lot. This works good… but I still do not get the windows from the linked model… I wanna know the number of windows in a room and also extract their properties… Is there a way to achieve this?

Thank you.

Well, windows do not bound rooms. But having those walls you can probably find windows hosted in them. Also windows have fromRoom and toRoom parameters that could tell you which room they belong to - as a wall can bound many rooms.

but the windows are in linked model… this is the current issue i am trying to address.

Ok…I didn’t get that exactly at the beginning…
So there is an API function to retrieve inserts (such as windows)

and apparently there is a node Element.Inserts in Clockwork package that does same thing.
So you can start with that.

But then you have to determine if the window is located next to the room in question.
I think you can do it as described here:

Eg. shoot a vector and use point in room node.

@maksym ,
Try Element.Type+ from Clockwork

1 Like