# Toggle orthographic views opposite sides

How to ... ... toggle views with the opposite 3d space viewing side ?

e.g.

press key for front view and press again for back view

An half solution is to reuse the same hot key.

• This method has the benefit of quickly reviewing the front and back side. You can keep the hot key pressed to see one side and press shift to see the other side and release shift to go back to the other view.

• Another half solution might be to assign double click (possible with keyboard key) to go to the complementary side view.

When these half solutions work fine the operation still seems a bit complicated.

• Why do you want to "re-invent the wheel"? In the default UI, to see the front view, one presses the "1" key on the numeric keypad; to see the opposite (back) view, one presses "CTRL-1" key on the numeric keypad; to see the top view, one presses the "7" key on the numeric keypad; to see the opposite (bottom) view, one presses "CTRL-7" key; and to see front right, one presses the "3" key on the numeric keypad; to see the opposite (left) view, one presses "CTRL-3" key . – brasshat May 7 '17 at 1:07
• In short, some key positioning doesn't work for me. And I do not try to reinvent the wheel. It's better in general to stick to default. I'm changing some keys (not all) for my work flow. (For further notice see also my last few comments at blender.stackexchange.com/questions/78960/… ) – odn May 7 '17 at 13:32

It is script chenge view to the opposite

import bpy
from bpy_extras import view3d_utils
from mathutils import Vector

def getView(self, context, event):
region = context.region
rv3d = context.region_data
#coord = event.mouse_region_x, event.mouse_region_y
#view_vector = view3d_utils.region_2d_to_vector_3d(region, rv3d, coord)
return rv3d.view_rotation * Vector((0.0, 0.0, -1.0))

def findView(self, context, event):
vector = getView(self, context, event)
if vector == Vector((0.0, 1.0, 0.0)):
elif vector == Vector((0.0, -1.0, 0.0)):
elif vector == Vector((1.0, 0.0, 0.0)):
elif vector == Vector((-1.0, 0.0, 0.0)):
elif vector == Vector((0.0, 0.0, 1.0)):
elif vector == Vector((0.0, 0.0, -1.0)):

class ModalOperator(bpy.types.Operator):
"""swich view to opposite"""
bl_idname = "object.modal_operator"
bl_label = "Simple Modal Operator"

def invoke(self, context, event):
findView(self, context, event)
return {'FINISHED'}

def register():
bpy.utils.register_class(ModalOperator)

def unregister():
bpy.utils.unregister_class(ModalOperator)

if __name__ == "__main__":
register()