Conversion from surface to curve fails


I created a code, that calculates the overall squaremeters of a building complex. In one part I want to cull all top horizontals that represent the roofs of the building and remove them from the calculation.
But when I want to create boundarys for these top horizontals, after filtering the top from the bottom horizontals of my geometry I always get the error that conversion from surface to curve failed for one surface and I don’t understand why.
To create my geometry I used curves and polylines as input from rhino and extruded and moved them in the right position. (I internalised them in my gh file).

2021.01.11_sqm calculation (50.8 KB)

2021.01.11_sqm calculation (46.3 KB)

Thank you so much!