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?
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
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?
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.