Thanks Lee, I was about the same point as you, with less nice code, that is...
But the UCS does not follow the rotation of the block, see attached DWG
If I do the "UCS" command with "Object" option it does follow the rotation like I would like it to do.