What is the python command to check if current view is in orthographic or perspective mode?

  • $\begingroup$ Why the downvote? $\endgroup$
    – Pullup
    Jun 3, 2020 at 19:59
  • $\begingroup$ No effort... @Pullup $\endgroup$
    – brockmann
    Aug 26, 2021 at 15:23
  • $\begingroup$ @Pullup People playing as God ? judging other people by their standard. $\endgroup$
    – andio
    Aug 31, 2021 at 2:42

1 Answer 1



Get the space data of the 3D view area. A screen is split up into areas. The space associated with area is the active space. The spaces 3d region has the view settings.

>>> for i, a in enumerate(C.screen.areas):
...     i, a.type
(1, 'CONSOLE')
(2, 'VIEW_3D')

>>> space = C.screen.areas[2].spaces.active

If we are sure we are in a 3d view (a panel there, an operator that polls there) then instead use

space = context.space_data

the property to change is view_perspective, in example below I am in perspective view

>>> space.region_3d.view_perspective

Tip A quick way to find the options available is crunch in something wrong.

>>> space.region_3d.view_perspective = 'FOO'
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
TypeError: bpy_struct: item.attr = val: enum "FOO" not found in ('PERSP', 'ORTHO', 'CAMERA')

Check if in ortho view. Could also check if in camera view, is camera ortho

>>> ortho_view = space.region_3d.view_perspective == 'ORTHO'

or perhaps (needs testing)

>>> ortho_view = not space.region_3d.is_perspective

Set to ortho

>>> space.region_3d.view_perspective = 'ORTHO'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .