Modo's "Align Workplane to Selection" for Maya

While rigging a model I'm working on right now, I found myself wanting to use a feature in Modo called Align Workplane to Selection to create a view perpendicular to the character's hand for joint placement. Maya has a similar feature to Modo's workplanes called construction planes. However, the default placement for a construction plane is at 0, 0, 0 with no rotation - Modo's placement at the current selection's position and normal is much more useful.

Modo's Align Work Plane to Selection

Modo's Align Work Plane to Selection

So I wrote a quick mel script to provide the same functionality:

You can select different polygons over and over again, and the construction plane and camera will be reused and moved to the new position.

I also created a second shelf button that let me toggle between the perspective and construction plane camera (toggleWorkplaneAndPerspCam).

The script has some dependencies on other scripts, which are listed in gist below: