Filled Region from Room Boundary Error

I am utilizing a method I have found from another topic to create filled regions from room boundaries and I receive an error on the Python script node. This same script was also used how to video (links below).

This is the error I receive:
Traceback (most recent call last):
File “”, line 36, in
TypeError: iteration over non-sequence of type NoneType

Can anyone help me here. A little new to dynamo, and not great with code.

Can you expand the preview of the Room.Boundaries node? Also, I think the PickElement nodes delivers a single item, bit not a list. If that’s true, you can use the for loop on a single item that isn’t a list.

This is the room boundaries preview.
image

If I can give you any tip don’t use these nodes.
I have struggled so much with this topic. The node is not the issue here but revit api fails to return the room boundary lines for some big rooms when there is a lot of room boundary element. It’s not too often but often enough that I found a couple of rooms that did not wanted to give me bounding lines in every project. This happened even if the color fill was calculated and in revit everything looked good.
The only reliable solution I found it to get the room geometry with the element.geometry node and intersect it with a plane of the same level as your room. This will give you surfaces as a result and get the surface perimeter curves.
it may run a bis slower but you are not limited with the buggy api.

Well it may be that you are feeding it “Spaces” from the categories node and not rooms. It sure this node will work for spaces and not only rooms.