Script to rotate objects 90 degrees around their center

Try this one.
It will enable you to rotate objects left and right by 90 degrees around z,y,x axis with following aliases:
‘lz’ - left 90 degrees around z axis, ‘rz’ - right 90 degrees around z axis, ‘ly’ - left 90 degrees around y axis, ‘ry’ - right 90 degrees around y axis, ‘lx’ - left 90 degrees around x axis, ‘rx’ - right 90 degrees around x axis

import rhinoscriptsyntax as rs

def rotateObject(_id):
    if _id:
        if rs.IsCurve(_id) and rs.IsCurveClosed(_id):
            centroid = rs.CurveAreaCentroid(_id)[0]
        elif rs.IsCurve(_id) and not rs.IsCurveClosed(_id):
            d = rs.CurveDomain(_id)
            centroid = rs.EvaluateCurve(_id, (d[0]+d[1])/2)
        elif rs.IsSurface(_id) or rs.IsPolysurface(_id):
            centroid = rs.SurfaceAreaCentroid(_id)[0]
        elif rs.IsMesh(_id):
            centroid = rs.MeshAreaCentroid(_id)
        else:
            print "Something is wrong with your geometry"
            return

        directionAxis = rs.GetString("Choose rotation direction and axis", "lz", ["lz","rz","ly","ry", "lx", "rx"])
        if directionAxis == "lz":
            rs.RotateObject(_id, centroid, 90, [0,0,1])
        elif directionAxis == "rz":
            rs.RotateObject(_id, centroid, -90, [0,0,1])
        elif directionAxis == "ry":
            rs.RotateObject(_id, centroid, 90, [0,1,0])
        elif directionAxis == "ly":
            rs.RotateObject(_id, centroid, -90, [0,1,0])
        elif directionAxis == "lx":
            rs.RotateObject(_id, centroid, 90, [1,0,0])
        elif directionAxis == "rx":
            rs.RotateObject(_id, centroid, -90, [1,0,0])
        else:
            print "You typed an unsupported rotation"
            return
    else:
        print "You did not pick anything"
        return

id = rs.GetObject("Pick up the object you wish to rotate", preselect=True)
rotateObject(id)

By the way, did not know about the BoxEdit command.
Thanks Mitch.