Help on setting parameters based on lines gotten from the surface of an object

Hello everyone.
In Revit, I have a sloped roof, curtain roof, where it’s composed by curtain panels, but with cutted geometry, such as the image below.
I wanted to create a script where it will get it’s major length and width and put this info on some paramethers by instance, but am failing on my attempts to get the major lines of those surfaces…

When I tried to get Elements.Geometry, some elements fails (“Unable to create Line. Points are likely coincident”).

Could anybody help me? :smiley: