Python script for getting material from Revit face - help with adding support for nested lists



I’ve found the following script on the web that will fetch the materialid of a list of Revit faces. However, it only excepts flat lists. I’d like to modify the code so it excepts nested lists. It would make my graph a lot simpler.

Anyone any ideas, or perhaps a similar script I could learn the strategy from?

Thank you,

import clr

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

faces = IN[0]

OUT = [doc.GetElement(f.MaterialElementId) for f in faces]


Hi @pieter

Could you please drop complete screenshot of your graph with all the previews visible.


Hey @Kulkul

I was able to fix it two minutes ago!

I made a custom node with an input and output node, and then I was able to define levels (@L2). Nested levels still confuse me, but this seems to work :slight_smile:

Let me know if you know of a better way to do it!