Is there a python function that sets ortho view such that X and Y axes are visible - the equivalent of numpad 7?
Thanks in advance!
Is there a python function that sets ortho view such that X and Y axes are visible - the equivalent of numpad 7?
Thanks in advance!
You can override the context when calling view_axis() operator.
Blender 3.2+
import bpy
from bpy import context
for area in context.screen.areas:
if area.type == 'VIEW_3D':
with context.temp_override(area=area, region=area.regions[-1]):
bpy.ops.view3d.view_axis(type='TOP')
break
Blender 2.8+
import bpy
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
override = bpy.context.copy()
override['area'] = area
bpy.ops.view3d.view_axis(override, type='TOP')
break