How do I get a centroid of a brep using RhinoCommon?

Following only works with a brep straight on the world xyz plane.
@stevebaer, @dale What to do when the brep is rotated along the z-axis or how to say ‘comare the curves to an existing plane and determine which curve is closests to which axis’ by which the curves can be tagged by a axis?

Angle comparison thingy?

def create_brepdims(brep):
    brepcrvs=brep.Edges
    for c in brepcrvs:
        strpn=rs.CurveStartPoint(c)
        endpn=rs.CurveEndPoint(c)
        vector=strpn-endpn
        if vector[0]!=0:
            xdim=c.GetLength()
        if vector[1]!=0:
            ydim=c.GetLength()
        elif vector[2]!=0:
            zdim=c.GetLength()
    return [xdim,ydim,zdim]