Test script to put all 3d view areas in context screen into same orientation as first custom scene orientation
import bpy
from mathutils import Matrix
context = bpy.context
# put all view_3d areas in screen into screen.orientation[0]
scene = context.scene
screen = context.screen
for o in scene.transform_orientation_slots:
if o.custom_orientation:
orientation = o.custom_orientation
print("Using ", orientation.name)
view_rot = orientation.matrix.to_quaternion()
view3dareas = [a for a in screen.areas if a.type == 'VIEW_3D']
for a in view3dareas:
r3d = a.spaces.active.region_3d
r3d.view_rotation = view_rot
To make it change from camera perspective would need something like
if r3d.view_perspective == 'CAMERA':
r3d.view_perspective = 'PERSP'
To look "from above" from this orientation
rot = Matrix.Rotation(radians(-90), 3, 'X')
#view_rot = (rot * orientation.matrix).to_quaternion()
view_rot.rotate(rot)
context.space_data.region_3d.view_matrix = context.scene.orientations["blah"].matrix.to_4x4()
and orthogonal rotations of. $\endgroup$