That files gives the impression that your 3d modeling is more concerned with processed sheet stock rather than lengths of extrusions. If that were the case then I'd recommend using the BoundaryRepresentation namespace functions to analyze the faces to find the two largest, see if they have Normals that are parallel, though not codirectional. Once found, the solid can be transformed to have that vector aligned to the World Z.

Subsequent analysis of the edges to find the longest (though, finding 2 edges that are perpendicular to themselves as well as the Z axis may be more accurate) and set that parallel to the X axis, perhaps.