Hello, I am trying to modify the Clockwork Room.Boundaries node to give me the elements from a linked file so that i can get parameter info from them.
The Room.Boundaries node uses GetSpatialElementBoundaryLocation() method and im not sure how to use that in such a way to get those bounding elements, from what i skimmed in the RevitApiDocs i cant find a specific solution.
I am also not a complete expert with Python but i can work with it.
My question is: what would you recommend as a method or if you know a different node/package that can help me make these changes to the node and get the info i need.
PS: the project is quite large at around 3000 rooms so getting the geometry and doing a “manual check” is a solution i would like to explore last.
Normally these types of custom nodes are set to run on the active document. You’ll have to make sure you specify a linked document and run the same methods with the linked doc.
I have tried that and i get nulls where the elements are, i believe i have to change how i get those elements maybe but i have no idea where to do that.
in the case of elist.append(doc.GetElement(bface.SpatialBoundaryElement.HostElementId))i already have get element on the linked doc so i don`t really understand why i would get nulls.
Hi,
try the code below. It’s not easy for me to analyse somebody else’s code so I am not sure what is the problem with the one above, but you are not setting the spatial element boundary options - it might be the problem.
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
#The inputs to this node will be stored as a list in the IN variables.
rooms = UnwrapElement(IN[0])
linkInstance = UnwrapElement(IN[1])
linkedDoc = linkInstance.GetLinkDocument()
options = SpatialElementBoundaryOptions()
options.SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Finish
calculator = SpatialElementGeometryCalculator(linkedDoc,options)
output = []
for r in rooms:
try:
results = calculator.CalculateSpatialElementGeometry(r)
solid = results.GetGeometry()
elements = []
for f in solid.Faces:
#faces.append(f)
subfaces = results.GetBoundaryFaceInfo(f)
for sf in subfaces:
e = linkedDoc.GetElement(sf.SpatialBoundaryElement.HostElementId)
elements.append(e)
output.append(elements)
except:
output.append(None)
#Assign your output to the OUT variable.
OUT = output