Hi - I’m very new to programming so don’t really understand what I’m doing!

In the following script, I’m taking input from a bunch of rooms (as shown in screenshot). I’d like to extract the room boundaries of each room and maintain the inputted list structure as I perform various other operations (essentially finding the overall boundary of a unit group in Revit by using the rooms in the group). I can perform everything on a single group but as soon as I am inputting multiple groups (so nested lists of rooms), I can’t get the function to work.

I found Konrad’s post about defining a function to work through lists but can’t get it to work in this instance (perhaps because the each room then gets its own nested list once the room boundaries are found?).

Any help appreciated!

```
rooms = IN[0]
rBounds = []
def ProcessList(_func, _list):
return map(lambda x: ProcessList(_func, x) if type(x)==list else func(x), _list)
def roomBounds(room):
return room.FinishBoundary
# get room boundaries as curves
if isinstance (rooms, list):
for r in rooms:
s = ProcessList(roomBounds(r), rooms)
rBounds.append(s)
OUT = rBounds
```

This is the desired outcome:

And this is the python that currently works for a single list of rooms (the above is working towards getting the below function working with nested lists)

```
# The inputs to this node will be stored as a list in the IN variables.
rooms = IN[0]
offAmount = IN[1]
solids = []
plane = Plane.XY()
rBounds = []
# get room boundaries as curves
t = []
for r in rooms:
s = r.FinishBoundary
t.append(s)
rBounds = List.Flatten(t, 1)
#for each list of curves in input list
for a in rBounds:
b = PolyCurve.ByJoinedCurves(a, 0.001) #create polycurves
c = Curve.Offset(b, offAmount) #offset curves
d = Surface.ByPatch(c) #create surface
e = Surface.Thicken(d, 10000, True) #extrude surface (create solid)
solids.append(e)
solid = Solid.ByUnion(solids) #union solids
surfaceInt = Geometry.Intersect(solid,plane) #find intersection of a plane with this solid
perimCurves = Surface.PerimeterCurves(surfaceInt[0]) #get the perimeter curves of the intersection
# Assign your output to the OUT variable.
OUT = perimCurves
```