Cutting Surface, polycurve or curves... HELP!

Hi… I’ve been trying all day to find a way to cut the area shown bellow, I need to select from revit all lines and import them to dynamo, but only to create the surface area from “surface”. I’m able to cut out not adjacent curves from inside the area, but not adjacent ones.

How about this?

I tought about it and I should have explained a bit more than one single rectangle example, it will be more than one rectangle and it could have another shape, I can group other curves but not with the adjacents.
Also, the main idea is to use only one Select Model Elements node, I think that I will have to write some code to find the curves that are triming my surface, but thanks for your fast response =).

It seems like the script @theshysnail made could be easily converted into a script that cuts multiple surfaces. :slight_smile: