Cycle through local axis permutations of a model orientation in 90degrees increments

Hello all. I am a modeler looking for a way to do the following. (I do not have any scripting knowledge, so this is an informal request for anyone interested in helping out). This is a cross-post from the Modeling sub forum, whose users directed me here.


I am looking for a script cycling through all possible permutations of the local rotation transformation of the selected object, in increments of 90 degrees around each axis, at the repeated press of a single keyboard button.

http://i.imgur.com/z5Ym463.gif

If possible, the preferred first permutations would be :

Permutation 1
+X >> +X
+Y >> +Z
+Z >> -Y

Permutation 2
+X >> -Z
+Y >> +Y
+Z >> +X

It should be possible to launch the script through a keyboard keypress (not predefined - the user should be free to assign a custom key from the preferences/input menu), pressed repeatedly until the desired permutation is reached. No T/N panel integration required. It should work on a object oriented freely in space (that is to say, with no relation to the world orientation). The model would inherit the opposite Rotation transformation.

Thanks ! And sorry for the typo in the title, I can’t seem a way to edit it.