Getting finishing material inside of the room


#1

Hi everyone, I’m new to Dynamo. I am wondering is it possible if I could tag finishing wall, ceiling, floor inside of the room by roomtag. I heard we could get finishing material by room boundary but i dont know how to do it. Any help would be appreciated. Thank you.


#2

Did you get a routine?
I’m looking for it also.


#3

Yeah. I l have look for the information and then i found out something. I
will send you what i had right after I can acess to my computer


#4
import clr

clr.AddReference("RevitAPI")
clr.AddReference("RevitServices")

from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager


rooms = UnwrapElement(IN[0])

doc =  DocumentManager.Instance.CurrentDBDocument
calculator = SpatialElementGeometryCalculator(doc)

elementMaterial = list()
for room in rooms:    
    results = calculator.CalculateSpatialElementGeometry(room)    
    roomSolid = results.GetGeometry()
    
    roomMaterial = list()    
    for face in roomSolid.Faces:        
        for subface in results.GetBoundaryFaceInfo(face): 
            if subface.SubfaceType == SubfaceType.Side:        
                boundingElement = subface.GetBoundingElementFace()                        
                elementId = boundingElement.MaterialElementId          
                materialName = doc.GetElement(elementId).Name            
                roomMaterial.append(materialName)         
    elementMaterial.append(roomMaterial)            
    
OUT = elementMaterial

#5

Can you help me?
How should i use this code?

I don’t know too much about Dynamo hehe.


#6

@daniel.petrin,

Copy and paste the code in a Python Script node, then connect your Rooms to the node.


#7

this returns some code error not sure what it says…!

image


#8

Just delete “.Name” at the end of this line and wire List.Clean + Material.Name nodes to the output instead…