CPython 3 'name element is not defined'

Hi,

I found this code a while ago and until now it did work with the node Python Script From String, but i have to convert it to CPython3 and must use the node Python Script and get the error → name element is not defined
afbeelding
afbeelding

Hope somebody can help me here.

Hi EzDoesIt,

I’m not a Python Pro, but i think it happens because you only use the variable “element” inside the for loop. So it doesn’t exist outside.
Hope that helps!

Hi,

Thanks for thinking with me, but after i restarted Dynamo and Revit it works as expected but, only line 22 must be on line 21 with 4 spaces in front so it can be a list.