2D Diagonal Length of 3d object

I have a Rectangle and I want the diagonal length of one of the face…but in Revit it gives me the length from 3D corner to opposite corner. Which i don’t want.

What have you tried, can you please show your work?

What shapes are you working with? Are you looking for the longest line or the actual diagonal?

Depending on what you want and how big your dataset is, you could try this:

Geometry.Explode
Surface.PerimeterCurves
Curve.StartPoints
Geometry.DistanceTo with cross produce lacing and levels set correctly.
List.MaximumItem will then get the largest.

Lacing and levels will be key across the entire graph.